[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BLU402-EAS1833F81D76FA29E2297AC96D67E0@phx.gbl>
Date: Wed, 12 Aug 2015 16:37:10 +0800
From: LIYONG <sdliyong@...il.com>
To: Lars-Peter Clausen <lars@...afoo.de>
CC: "jic23@...nel.org" <jic23@...nel.org>,
"knaack.h@....de" <knaack.h@....de>,
"pmeerw@...erw.net" <pmeerw@...erw.net>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"cristina.opriceana@...il.com" <cristina.opriceana@...il.com>,
"tolga.ceylan@...il.com" <tolga.ceylan@...il.com>,
"k.kozlowski@...sung.com" <k.kozlowski@...sung.com>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] staging: iio: hmc5843: Set iio name dynamically based on i2c name
thanks for your comments. let me submit another one
发自我的 iPhone
> 在 2015年8月12日,16:28,Lars-Peter Clausen <lars@...afoo.de> 写道:
>
>> On 08/12/2015 10:20 AM, sdliyong@...il.com wrote:
>> From: Yong Li <sdliyong@...il.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@...il.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);
>>
>
Powered by blists - more mailing lists