Re: [PATCH 1/3] staging:iio:max1363 use device_id instead of searching on name again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/18/10 14:43, Hennerich, Michael wrote:
> Jonathan Cameron wrote on 2010-05-17:
>> Signed-off-by: Jonathan Cameron <jic23@xxxxxxxxx>
>> ---
>>  drivers/staging/iio/adc/max1363.h      |    3 +-
>>  drivers/staging/iio/adc/max1363_core.c |  152
>> +++++++++++++++---------
>> --------
>>  2 files changed, 75 insertions(+), 80 deletions(-)
>> diff --git a/drivers/staging/iio/adc/max1363.h
>> b/drivers/staging/iio/adc/max1363.h index 72cf367..eb20c68 100644 ---
>> a/drivers/staging/iio/adc/max1363.h +++
>> b/drivers/staging/iio/adc/max1363.h @@ -179,7 +179,6 @@ enum
> 
> --[snip]--
> 
>> +     st->chip_info = &max1363_chip_info_tbl[id->driver_data];
>> +     st->name = kstrdup(id->name, GFP_KERNEL);
>> +     if (st->name == NULL) {
>> +             ret = -ENOMEM;
> 
> 
> Isn't id->name == client->name ?
> 
> static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
>                                                 const struct i2c_client *client)
> {
>         while (id->name[0]) {
>                 if (strcmp(client->name, id->name) == 0)
>                         return id;
>                 id++;
>         }
>         return NULL;
> }
> 
> So you don't need an extra copy simply use client->name
> 
Another excellent point.  Thanks!

Will redo this one later.

Jonathan

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux