aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2023-04-24 20:10:48 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2023-04-24 20:10:48 +0200
commitd5c93d2b85ab86b81c4ef4e6d3855aa1ee2d8123 (patch)
tree8883484e76d24a79938a8f8e0cc68ec0bbdeac40 /target/linux
parent70e88044d53cff26d803b0dc520530e2f9fdd7bc (diff)
downloadupstream-d5c93d2b85ab86b81c4ef4e6d3855aa1ee2d8123.tar.gz
upstream-d5c93d2b85ab86b81c4ef4e6d3855aa1ee2d8123.tar.bz2
upstream-d5c93d2b85ab86b81c4ef4e6d3855aa1ee2d8123.zip
kernel: ssb: fallback-sprom: optimize struct data
- Remove unneeded mac bytes from struct (it's already present in the SPROM). - Convert devid_override to boolean. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/files/drivers/ssb/fallback-sprom.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/target/linux/generic/files/drivers/ssb/fallback-sprom.c b/target/linux/generic/files/drivers/ssb/fallback-sprom.c
index 93001d20d7..f156522328 100644
--- a/target/linux/generic/files/drivers/ssb/fallback-sprom.c
+++ b/target/linux/generic/files/drivers/ssb/fallback-sprom.c
@@ -48,8 +48,7 @@ struct ssb_fbs {
struct ssb_sprom sprom;
u32 pci_bus;
u32 pci_dev;
- u8 mac[ETH_ALEN];
- int devid_override;
+ bool devid_override;
};
static DEFINE_SPINLOCK(ssb_fbs_lock);
@@ -624,8 +623,8 @@ static void ssb_fbs_fixup(struct ssb_fbs *priv, u16 *sprom)
}
}
-static int sprom_override_devid(struct ssb_fbs *priv, struct ssb_sprom *out,
- const u16 *in)
+static bool sprom_override_devid(struct ssb_fbs *priv, struct ssb_sprom *out,
+ const u16 *in)
{
SPEX(dev_id, SSB_SPROM1_PID, 0xFFFF, 0);
return !!out->dev_id;
@@ -668,7 +667,7 @@ static int ssb_fbs_set(struct ssb_fbs *priv, struct device_node *node)
sprom->itssi_bg = 0x00;
sprom->boardflags_lo = 0x2848;
sprom->boardflags_hi = 0x0000;
- priv->devid_override = 0;
+ priv->devid_override = false;
dev_warn(priv->dev, "using basic SPROM\n");
} else {
@@ -696,6 +695,7 @@ static int ssb_fbs_probe(struct platform_device *pdev)
struct device_node *node = dev->of_node;
struct ssb_fbs *priv;
unsigned long flags;
+ u8 mac[ETH_ALEN];
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -708,18 +708,18 @@ static int ssb_fbs_probe(struct platform_device *pdev)
of_property_read_u32(node, "pci-bus", &priv->pci_bus);
of_property_read_u32(node, "pci-dev", &priv->pci_dev);
- of_get_mac_address(node, priv->mac);
- if (is_valid_ether_addr(priv->mac)) {
- dev_info(dev, "mtd mac %pM\n", priv->mac);
+ of_get_mac_address(node, mac);
+ if (is_valid_ether_addr(mac)) {
+ dev_info(dev, "mtd mac %pM\n", mac);
} else {
- random_ether_addr(priv->mac);
- dev_info(dev, "random mac %pM\n", priv->mac);
+ random_ether_addr(mac);
+ dev_info(dev, "random mac %pM\n", mac);
}
- memcpy(priv->sprom.il0mac, priv->mac, ETH_ALEN);
- memcpy(priv->sprom.et0mac, priv->mac, ETH_ALEN);
- memcpy(priv->sprom.et1mac, priv->mac, ETH_ALEN);
- memcpy(priv->sprom.et2mac, priv->mac, ETH_ALEN);
+ memcpy(priv->sprom.il0mac, mac, ETH_ALEN);
+ memcpy(priv->sprom.et0mac, mac, ETH_ALEN);
+ memcpy(priv->sprom.et1mac, mac, ETH_ALEN);
+ memcpy(priv->sprom.et2mac, mac, ETH_ALEN);
spin_lock_irqsave(&ssb_fbs_lock, flags);
list_add(&priv->list, &ssb_fbs_list);