mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-12 19:44:51 -04:00
net: dsa: Have the switch driver allocate there own private memory
Now the switch devices have a dev pointer, make use of it for allocating the drivers private data structures using a devm_kzalloc(). Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
bbb8d79399
commit
7543a6d535
@@ -129,6 +129,12 @@ struct dsa_switch {
|
||||
struct dsa_switch_tree *dst;
|
||||
int index;
|
||||
|
||||
/*
|
||||
* Give the switch driver somewhere to hang its private data
|
||||
* structure.
|
||||
*/
|
||||
void *priv;
|
||||
|
||||
/*
|
||||
* Tagging protocol understood by this switch
|
||||
*/
|
||||
@@ -213,7 +219,7 @@ struct dsa_switch_driver {
|
||||
* Probing and setup.
|
||||
*/
|
||||
char *(*probe)(struct device *dsa_dev, struct device *host_dev,
|
||||
int sw_addr);
|
||||
int sw_addr, void **priv);
|
||||
int (*setup)(struct dsa_switch *ds);
|
||||
int (*set_addr)(struct dsa_switch *ds, u8 *addr);
|
||||
u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
|
||||
@@ -342,7 +348,7 @@ struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
|
||||
|
||||
static inline void *ds_to_priv(struct dsa_switch *ds)
|
||||
{
|
||||
return (void *)(ds + 1);
|
||||
return ds->priv;
|
||||
}
|
||||
|
||||
static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
|
||||
|
||||
Reference in New Issue
Block a user