* [PATCH] i2c: Switch to using the new API kobj_to_dev()
@ 2020-09-15 1:38 Tian Tao
2020-09-18 21:09 ` wsa
2020-09-21 9:14 ` Wolfram Sang
0 siblings, 2 replies; 5+ messages in thread
From: Tian Tao @ 2020-09-15 1:38 UTC (permalink / raw)
To: wsa, linux-i2c, linux-kernel; +Cc: linuxarm
Switch to using the new API kobj_to_dev().
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
include/linux/i2c.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fc55ea4..5662265 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -344,7 +344,7 @@ const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
{
- struct device * const dev = container_of(kobj, struct device, kobj);
+ struct device * const dev = kobj_to_dev(kobj);
return to_i2c_client(dev);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Switch to using the new API kobj_to_dev()
2020-09-15 1:38 [PATCH] i2c: Switch to using the new API kobj_to_dev() Tian Tao
@ 2020-09-18 21:09 ` wsa
2020-09-19 1:01 ` tiantao (H)
2020-09-21 9:14 ` Wolfram Sang
1 sibling, 1 reply; 5+ messages in thread
From: wsa @ 2020-09-18 21:09 UTC (permalink / raw)
To: Tian Tao; +Cc: linux-i2c, linux-kernel, linuxarm
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
> static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
> {
> - struct device * const dev = container_of(kobj, struct device, kobj);
> + struct device * const dev = kobj_to_dev(kobj);
> return to_i2c_client(dev);
Can't we make this a oneliner then merging the last two lines?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Switch to using the new API kobj_to_dev()
2020-09-18 21:09 ` wsa
@ 2020-09-19 1:01 ` tiantao (H)
2020-09-19 6:32 ` wsa
0 siblings, 1 reply; 5+ messages in thread
From: tiantao (H) @ 2020-09-19 1:01 UTC (permalink / raw)
To: wsa, Tian Tao, linux-i2c, linux-kernel, linuxarm
在 2020/9/19 5:09, wsa@kernel.org 写道:
>
>> static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
>> {
>> - struct device * const dev = container_of(kobj, struct device, kobj);
>> + struct device * const dev = kobj_to_dev(kobj);
>> return to_i2c_client(dev);
>
> Can't we make this a oneliner then merging the last two lines?
>
I think two lines have better readability, and if you prefer one line, I
can send v2 to fix that!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Switch to using the new API kobj_to_dev()
2020-09-19 1:01 ` tiantao (H)
@ 2020-09-19 6:32 ` wsa
0 siblings, 0 replies; 5+ messages in thread
From: wsa @ 2020-09-19 6:32 UTC (permalink / raw)
To: tiantao (H); +Cc: Tian Tao, linux-i2c, linux-kernel, linuxarm
[-- Attachment #1: Type: text/plain, Size: 683 bytes --]
On Sat, Sep 19, 2020 at 09:01:12AM +0800, tiantao (H) wrote:
>
>
> 在 2020/9/19 5:09, wsa@kernel.org 写道:
> >
> > > static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
> > > {
> > > - struct device * const dev = container_of(kobj, struct device, kobj);
> > > + struct device * const dev = kobj_to_dev(kobj);
> > > return to_i2c_client(dev);
> >
> > Can't we make this a oneliner then merging the last two lines?
> >
> I think two lines have better readability, and if you prefer one line, I can
> send v2 to fix that!
I just found d75d53cd571c ("i2c: Fix sparse warning in i2c.h"), so we
should leave the two lines. Thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Switch to using the new API kobj_to_dev()
2020-09-15 1:38 [PATCH] i2c: Switch to using the new API kobj_to_dev() Tian Tao
2020-09-18 21:09 ` wsa
@ 2020-09-21 9:14 ` Wolfram Sang
1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-09-21 9:14 UTC (permalink / raw)
To: Tian Tao; +Cc: linux-i2c, linux-kernel, linuxarm
[-- Attachment #1: Type: text/plain, Size: 195 bytes --]
On Tue, Sep 15, 2020 at 09:38:18AM +0800, Tian Tao wrote:
> Switch to using the new API kobj_to_dev().
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-21 9:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 1:38 [PATCH] i2c: Switch to using the new API kobj_to_dev() Tian Tao
2020-09-18 21:09 ` wsa
2020-09-19 1:01 ` tiantao (H)
2020-09-19 6:32 ` wsa
2020-09-21 9:14 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).