All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net-next v4 1/9] net: dsa: constify probed name
Date: Sun, 17 Apr 2016 19:53:47 +0200	[thread overview]
Message-ID: <20160417175347.GA4071@lunn.ch> (raw)
In-Reply-To: <1460913843-7459-2-git-send-email-vivien.didelot@savoirfairelinux.com>

On Sun, Apr 17, 2016 at 01:23:55PM -0400, Vivien Didelot wrote:
> Change the dsa_switch_driver.probe function to return a const char *.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Thanks
	Andrew

> ---
>  drivers/net/dsa/bcm_sf2.c   |  6 +++---
>  drivers/net/dsa/mv88e6060.c | 10 +++++-----
>  drivers/net/dsa/mv88e6123.c |  6 +++---
>  drivers/net/dsa/mv88e6131.c |  6 +++---
>  drivers/net/dsa/mv88e6171.c |  6 +++---
>  drivers/net/dsa/mv88e6352.c |  6 +++---
>  drivers/net/dsa/mv88e6xxx.c | 17 +++++++++--------
>  drivers/net/dsa/mv88e6xxx.h |  8 ++++----
>  include/net/dsa.h           |  5 +++--
>  net/dsa/dsa.c               |  6 +++---
>  10 files changed, 39 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
> index 7a5f0ef..448deb5 100644
> --- a/drivers/net/dsa/bcm_sf2.c
> +++ b/drivers/net/dsa/bcm_sf2.c
> @@ -135,9 +135,9 @@ static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds)
>  	return BCM_SF2_STATS_SIZE;
>  }
>  
> -static char *bcm_sf2_sw_drv_probe(struct device *dsa_dev,
> -				  struct device *host_dev,
> -				  int sw_addr, void **_priv)
> +static const char *bcm_sf2_sw_drv_probe(struct device *dsa_dev,
> +					struct device *host_dev, int sw_addr,
> +					void **_priv)
>  {
>  	struct bcm_sf2_priv *priv;
>  
> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> index 92cebab..e36b408 100644
> --- a/drivers/net/dsa/mv88e6060.c
> +++ b/drivers/net/dsa/mv88e6060.c
> @@ -51,7 +51,7 @@ static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
>  			return __ret;				\
>  	})
>  
> -static char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
> +static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
>  {
>  	int ret;
>  
> @@ -69,13 +69,13 @@ static char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
>  	return NULL;
>  }
>  
> -static char *mv88e6060_drv_probe(struct device *dsa_dev,
> -				 struct device *host_dev,
> -				 int sw_addr, void **_priv)
> +static const char *mv88e6060_drv_probe(struct device *dsa_dev,
> +				       struct device *host_dev, int sw_addr,
> +				       void **_priv)
>  {
>  	struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
>  	struct mv88e6060_priv *priv;
> -	char *name;
> +	const char *name;
>  
>  	name = mv88e6060_get_name(bus, sw_addr);
>  	if (name) {
> diff --git a/drivers/net/dsa/mv88e6123.c b/drivers/net/dsa/mv88e6123.c
> index 140e44e..9701c0f 100644
> --- a/drivers/net/dsa/mv88e6123.c
> +++ b/drivers/net/dsa/mv88e6123.c
> @@ -29,9 +29,9 @@ static const struct mv88e6xxx_switch_id mv88e6123_table[] = {
>  	{ PORT_SWITCH_ID_6165_A2, "Marvell 88e6165 (A2)" },
>  };
>  
> -static char *mv88e6123_drv_probe(struct device *dsa_dev,
> -				 struct device *host_dev,
> -				 int sw_addr, void **priv)
> +static const char *mv88e6123_drv_probe(struct device *dsa_dev,
> +				       struct device *host_dev, int sw_addr,
> +				       void **priv)
>  {
>  	return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
>  				   mv88e6123_table,
> diff --git a/drivers/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
> index 34d297b..fa3a354 100644
> --- a/drivers/net/dsa/mv88e6131.c
> +++ b/drivers/net/dsa/mv88e6131.c
> @@ -25,9 +25,9 @@ static const struct mv88e6xxx_switch_id mv88e6131_table[] = {
>  	{ PORT_SWITCH_ID_6185, "Marvell 88E6185" },
>  };
>  
> -static char *mv88e6131_drv_probe(struct device *dsa_dev,
> -				 struct device *host_dev,
> -				 int sw_addr, void **priv)
> +static const char *mv88e6131_drv_probe(struct device *dsa_dev,
> +				       struct device *host_dev, int sw_addr,
> +				       void **priv)
>  {
>  	return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
>  				   mv88e6131_table,
> diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
> index b7af2b78..8d86c9e 100644
> --- a/drivers/net/dsa/mv88e6171.c
> +++ b/drivers/net/dsa/mv88e6171.c
> @@ -24,9 +24,9 @@ static const struct mv88e6xxx_switch_id mv88e6171_table[] = {
>  	{ PORT_SWITCH_ID_6351, "Marvell 88E6351" },
>  };
>  
> -static char *mv88e6171_drv_probe(struct device *dsa_dev,
> -				 struct device *host_dev,
> -				 int sw_addr, void **priv)
> +static const char *mv88e6171_drv_probe(struct device *dsa_dev,
> +				       struct device *host_dev, int sw_addr,
> +				       void **priv)
>  {
>  	return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
>  				   mv88e6171_table,
> diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
> index e8cb03f..c7fa69c 100644
> --- a/drivers/net/dsa/mv88e6352.c
> +++ b/drivers/net/dsa/mv88e6352.c
> @@ -37,9 +37,9 @@ static const struct mv88e6xxx_switch_id mv88e6352_table[] = {
>  	{ PORT_SWITCH_ID_6352_A1, "Marvell 88E6352 (A1)" },
>  };
>  
> -static char *mv88e6352_drv_probe(struct device *dsa_dev,
> -				 struct device *host_dev,
> -				 int sw_addr, void **priv)
> +static const char *mv88e6352_drv_probe(struct device *dsa_dev,
> +				       struct device *host_dev, int sw_addr,
> +				       void **priv)
>  {
>  	return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
>  				   mv88e6352_table,
> diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
> index b018f20..25d7fec 100644
> --- a/drivers/net/dsa/mv88e6xxx.c
> +++ b/drivers/net/dsa/mv88e6xxx.c
> @@ -3173,9 +3173,10 @@ int mv88e6xxx_get_temp_alarm(struct dsa_switch *ds, bool *alarm)
>  }
>  #endif /* CONFIG_NET_DSA_HWMON */
>  
> -static char *mv88e6xxx_lookup_name(struct mii_bus *bus, int sw_addr,
> -				   const struct mv88e6xxx_switch_id *table,
> -				   unsigned int num)
> +static const char *
> +mv88e6xxx_lookup_name(struct mii_bus *bus, int sw_addr,
> +		      const struct mv88e6xxx_switch_id *table,
> +		      unsigned int num)
>  {
>  	int i, ret;
>  
> @@ -3205,14 +3206,14 @@ static char *mv88e6xxx_lookup_name(struct mii_bus *bus, int sw_addr,
>  	return NULL;
>  }
>  
> -char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev,
> -			  int sw_addr, void **priv,
> -			  const struct mv88e6xxx_switch_id *table,
> -			  unsigned int num)
> +const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev,
> +				int sw_addr, void **priv,
> +				const struct mv88e6xxx_switch_id *table,
> +				unsigned int num)
>  {
>  	struct mv88e6xxx_priv_state *ps;
>  	struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
> -	char *name;
> +	const char *name;
>  
>  	if (!bus)
>  		return NULL;
> diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
> index 0debb9f..5eb6013 100644
> --- a/drivers/net/dsa/mv88e6xxx.h
> +++ b/drivers/net/dsa/mv88e6xxx.h
> @@ -462,10 +462,10 @@ struct mv88e6xxx_hw_stat {
>  };
>  
>  int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active);
> -char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev,
> -			  int sw_addr, void **priv,
> -			  const struct mv88e6xxx_switch_id *table,
> -			  unsigned int num);
> +const char *mv88e6xxx_drv_probe(struct device *dsa_dev, struct device *host_dev,
> +				int sw_addr, void **priv,
> +				const struct mv88e6xxx_switch_id *table,
> +				unsigned int num);
>  
>  int mv88e6xxx_setup_ports(struct dsa_switch *ds);
>  int mv88e6xxx_setup_common(struct dsa_switch *ds);
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 689ebd3..c4bc42b 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -217,8 +217,9 @@ struct dsa_switch_driver {
>  	/*
>  	 * Probing and setup.
>  	 */
> -	char	*(*probe)(struct device *dsa_dev, struct device *host_dev,
> -			  int sw_addr, void **priv);
> +	const char	*(*probe)(struct device *dsa_dev,
> +				  struct device *host_dev, 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);
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 60ea9848..efa612f 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -52,11 +52,11 @@ EXPORT_SYMBOL_GPL(unregister_switch_driver);
>  
>  static struct dsa_switch_driver *
>  dsa_switch_probe(struct device *parent, struct device *host_dev, int sw_addr,
> -		 char **_name, void **priv)
> +		 const char **_name, void **priv)
>  {
>  	struct dsa_switch_driver *ret;
>  	struct list_head *list;
> -	char *name;
> +	const char *name;
>  
>  	ret = NULL;
>  	name = NULL;
> @@ -383,7 +383,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
>  	struct dsa_switch_driver *drv;
>  	struct dsa_switch *ds;
>  	int ret;
> -	char *name;
> +	const char *name;
>  	void *priv;
>  
>  	/*
> -- 
> 2.8.0
> 

  reply	other threads:[~2016-04-17 17:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-17 17:23 [PATCH net-next v4 0/9] net: dsa: mv88e6xxx: factorize switch info Vivien Didelot
2016-04-17 17:23 ` [PATCH net-next v4 1/9] net: dsa: constify probed name Vivien Didelot
2016-04-17 17:53   ` Andrew Lunn [this message]
2016-04-17 17:23 ` [PATCH net-next v4 2/9] net: dsa: mv88e6xxx: drop double ds assignment Vivien Didelot
2016-04-17 17:23 ` [PATCH net-next v4 3/9] net: dsa: mv88e6xxx: drop revision probing Vivien Didelot
2016-04-17 17:23 ` [PATCH net-next v4 4/9] net: dsa: mv88e6xxx: read switch ID in probe Vivien Didelot
2016-04-17 17:23 ` [PATCH net-next v4 5/9] net: dsa: mv88e6xxx: add switch info Vivien Didelot
2016-04-17 17:54   ` Andrew Lunn
2016-04-17 17:24 ` [PATCH net-next v4 6/9] net: dsa: mv88e6xxx: add family to info Vivien Didelot
2016-04-17 17:24 ` [PATCH net-next v4 7/9] net: dsa: mv88e6xxx: add number of ports " Vivien Didelot
2016-04-17 17:24 ` [PATCH net-next v4 8/9] net: dsa: mv88e6xxx: add number of db " Vivien Didelot
2016-04-17 17:24 ` [PATCH net-next v4 9/9] net: dsa: mv88e6xxx: remove switch ID from ps Vivien Didelot
2016-04-17 22:54 ` [PATCH net-next v4 0/9] net: dsa: mv88e6xxx: factorize switch info David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160417175347.GA4071@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.