All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: sdliyong@gmail.com, jic23@kernel.org, knaack.h@gmx.de,
	pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
	cristina.opriceana@gmail.com, tolga.ceylan@gmail.com,
	k.kozlowski@samsung.com, linux-iio@vger.kernel.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] staging: iio: hmc5843: Set iio name dynamically based on i2c name
Date: Wed, 12 Aug 2015 10:28:06 +0200	[thread overview]
Message-ID: <55CB0396.2050303@metafoo.de> (raw)
In-Reply-To: <1439367630-8964-1-git-send-email-sdliyong@gmail.com>

On 08/12/2015 10:20 AM, sdliyong@gmail.com wrote:
> From: Yong Li <sdliyong@gmail.com>
> 
> Load the driver using the below command:
> echo hmc5983 0x1e > /sys/bus/i2c/devices/i2c-?/new_device
> 
> In sysfs, the iio name is hmc5843, however the i2c name is hmc5983,
> they are inconsistent.
> 
> With this patch, the iio name will be the same as the i2c device name
> 
> Signed-off-by: Yong Li <sdliyong@gmail.com>
> ---
>  drivers/staging/iio/magnetometer/hmc5843_i2c.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c b/drivers/staging/iio/magnetometer/hmc5843_i2c.c
> index ff08667..3b03644 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c
> @@ -59,6 +59,7 @@ static const struct regmap_config hmc5843_i2c_regmap_config = {
>  static int hmc5843_i2c_probe(struct i2c_client *cli,
>  			     const struct i2c_device_id *id)
>  {
> +	cli->dev.driver->name = id->name;

You are overwriting a the name of the driver, which is a struct that is
shared between all instances of the device which specific data from one
device. That is most certainly not correct.

Update hmc5843_common_probe() and add a parameter that takes the name for
the device and then pass the id->name when the function is called.

>  	return hmc5843_common_probe(&cli->dev,
>  			devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config),
>  			id->driver_data);
> 


  reply	other threads:[~2015-08-12  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12  8:20 [PATCH v1] staging: iio: hmc5843: Set iio name dynamically based on i2c name sdliyong
2015-08-12  8:28 ` Lars-Peter Clausen [this message]
2015-08-12  8:37   ` LIYONG
2015-08-12  8:37     ` LIYONG

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=55CB0396.2050303@metafoo.de \
    --to=lars@metafoo.de \
    --cc=cristina.opriceana@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=sdliyong@gmail.com \
    --cc=tolga.ceylan@gmail.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.