OSDN Git Service

net: phy: mscc: make arrays static, makes object smaller
authorColin Ian King <colin.king@canonical.com>
Mon, 7 Oct 2019 12:03:08 +0000 (13:03 +0100)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Tue, 8 Oct 2019 18:47:41 +0000 (11:47 -0700)
Don't populate const arrays on the stack but instead make them
static. Makes the object code smaller by 1058 bytes.

Before:
   text    data     bss     dec     hex filename
  29879    6144       0   36023    8cb7 drivers/net/phy/mscc.o

After:
   text    data     bss     dec     hex filename
  28437    6528       0   34965    8895 drivers/net/phy/mscc.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
drivers/net/phy/mscc.c

index 7ada1fd..805cda3 100644 (file)
@@ -895,7 +895,7 @@ static void vsc85xx_tr_write(struct phy_device *phydev, u16 addr, u32 val)
 static int vsc8531_pre_init_seq_set(struct phy_device *phydev)
 {
        int rc;
-       const struct reg_val init_seq[] = {
+       static const struct reg_val init_seq[] = {
                {0x0f90, 0x00688980},
                {0x0696, 0x00000003},
                {0x07fa, 0x0050100f},
@@ -939,7 +939,7 @@ out_unlock:
 
 static int vsc85xx_eee_init_seq_set(struct phy_device *phydev)
 {
-       const struct reg_val init_eee[] = {
+       static const struct reg_val init_eee[] = {
                {0x0f82, 0x0012b00a},
                {0x1686, 0x00000004},
                {0x168c, 0x00d2c46f},
@@ -1224,7 +1224,7 @@ out:
 /* bus->mdio_lock should be locked when using this function */
 static int vsc8574_config_pre_init(struct phy_device *phydev)
 {
-       const struct reg_val pre_init1[] = {
+       static const struct reg_val pre_init1[] = {
                {0x0fae, 0x000401bd},
                {0x0fac, 0x000f000f},
                {0x17a0, 0x00a0f147},
@@ -1272,7 +1272,7 @@ static int vsc8574_config_pre_init(struct phy_device *phydev)
                {0x0fee, 0x0004a6a1},
                {0x0ffe, 0x00b01807},
        };
-       const struct reg_val pre_init2[] = {
+       static const struct reg_val pre_init2[] = {
                {0x0486, 0x0008a518},
                {0x0488, 0x006dc696},
                {0x048a, 0x00000912},
@@ -1427,7 +1427,7 @@ out:
 /* bus->mdio_lock should be locked when using this function */
 static int vsc8584_config_pre_init(struct phy_device *phydev)
 {
-       const struct reg_val pre_init1[] = {
+       static const struct reg_val pre_init1[] = {
                {0x07fa, 0x0050100f},
                {0x1688, 0x00049f81},
                {0x0f90, 0x00688980},
@@ -1451,7 +1451,7 @@ static int vsc8584_config_pre_init(struct phy_device *phydev)
                {0x16b2, 0x00007000},
                {0x16b4, 0x00000814},
        };
-       const struct reg_val pre_init2[] = {
+       static const struct reg_val pre_init2[] = {
                {0x0486, 0x0008a518},
                {0x0488, 0x006dc696},
                {0x048a, 0x00000912},
@@ -1786,7 +1786,7 @@ static int vsc8514_config_pre_init(struct phy_device *phydev)
         * values to handle hardware performance of PHY. They
         * are set at Power-On state and remain until PHY Reset.
         */
-       const struct reg_val pre_init1[] = {
+       static const struct reg_val pre_init1[] = {
                {0x0f90, 0x00688980},
                {0x0786, 0x00000003},
                {0x07fa, 0x0050100f},