From: Jonathan Cameron <jic23@cam.ac.uk>
To: "Hennerich, Michael" <Michael.Hennerich@analog.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
uclinux-dist-devel <uclinux-dist-devel@blackfin.uclinux.org>
Subject: Re: [PATCH 1/3] staging:iio:max1363 use device_id instead of searching on name again
Date: Tue, 18 May 2010 15:25:09 +0100 [thread overview]
Message-ID: <4BF2A345.1070506@cam.ac.uk> (raw)
In-Reply-To: <544AC56F16B56944AEC3BD4E3D5917712E568FC4C2@LIMKCMBX1.ad.analog.com>
On 05/18/10 14:43, Hennerich, Michael wrote:
> Jonathan Cameron wrote on 2010-05-17:
>> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
>> ---
>> 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
next prev parent reply other threads:[~2010-05-18 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-17 21:35 [PATCH 0/3] staging:iio: Minor clean ups Jonathan Cameron
2010-05-17 21:35 ` [PATCH 1/3] staging:iio:max1363 use device_id instead of searching on name again Jonathan Cameron
2010-05-18 13:43 ` Hennerich, Michael
2010-05-18 14:25 ` Jonathan Cameron [this message]
2010-05-17 21:35 ` [PATCH 2/3] staging:iio:max1363 trivial code and comment cleanups Jonathan Cameron
2010-05-17 21:35 ` [PATCH 3/3] staging:iio:lis3l02dq cleanups Jonathan Cameron
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=4BF2A345.1070506@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=Michael.Hennerich@analog.com \
--cc=linux-iio@vger.kernel.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox