linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev()
@ 2021-03-02  6:17 Tian Tao
  2021-03-02  6:27 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Tian Tao @ 2021-03-02  6:17 UTC (permalink / raw)
  To: gregkh, rikard.falkeborn, zbr; +Cc: linux-kernel

fix the below warnning which reported by coccicheck.
/drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for
kobj_to_dev().
/drivers/w1/slaves/w1_ds2781.c:90:60-61: WARNING opportunity for
kobj_to_dev().

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/w1/slaves/w1_ds2780.c | 2 +-
 drivers/w1/slaves/w1_ds2781.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
index c281fe5..9dcb5a5 100644
--- a/drivers/w1/slaves/w1_ds2780.c
+++ b/drivers/w1/slaves/w1_ds2780.c
@@ -90,7 +90,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
 			     struct bin_attribute *bin_attr, char *buf,
 			     loff_t off, size_t count)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	return w1_ds2780_io(dev, buf, off, count, 0);
 }
 
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c
index f0d393a..2cb7c02 100644
--- a/drivers/w1/slaves/w1_ds2781.c
+++ b/drivers/w1/slaves/w1_ds2781.c
@@ -87,7 +87,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
 			     struct bin_attribute *bin_attr, char *buf,
 			     loff_t off, size_t count)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	return w1_ds2781_io(dev, buf, off, count, 0);
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev()
  2021-03-02  6:17 [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev() Tian Tao
@ 2021-03-02  6:27 ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-03-02  6:27 UTC (permalink / raw)
  To: Tian Tao; +Cc: rikard.falkeborn, zbr, linux-kernel

On Tue, Mar 02, 2021 at 02:17:02PM +0800, Tian Tao wrote:
> fix the below warnning which reported by coccicheck.
> /drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for
> kobj_to_dev().
> /drivers/w1/slaves/w1_ds2781.c:90:60-61: WARNING opportunity for
> kobj_to_dev().
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/w1/slaves/w1_ds2780.c | 2 +-
>  drivers/w1/slaves/w1_ds2781.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
> index c281fe5..9dcb5a5 100644
> --- a/drivers/w1/slaves/w1_ds2780.c
> +++ b/drivers/w1/slaves/w1_ds2780.c
> @@ -90,7 +90,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
>  			     struct bin_attribute *bin_attr, char *buf,
>  			     loff_t off, size_t count)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	return w1_ds2780_io(dev, buf, off, count, 0);
>  }
>  
> diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c
> index f0d393a..2cb7c02 100644
> --- a/drivers/w1/slaves/w1_ds2781.c
> +++ b/drivers/w1/slaves/w1_ds2781.c
> @@ -87,7 +87,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
>  			     struct bin_attribute *bin_attr, char *buf,
>  			     loff_t off, size_t count)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
>  	return w1_ds2781_io(dev, buf, off, count, 0);
>  }
>  
> -- 
> 2.7.4
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/SubmittingPatches for what needs to be done
  here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev()
  2021-03-02  0:51   ` tiantao (H)
@ 2021-03-02  5:37     ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-03-02  5:37 UTC (permalink / raw)
  To: tiantao (H); +Cc: Tian Tao, zbr, rikard.falkeborn, linux-kernel

On Tue, Mar 02, 2021 at 08:51:08AM +0800, tiantao (H) wrote:
> Hi:
> 
> 在 2021/3/1 21:09, Greg KH 写道:
> > On Mon, Mar 01, 2021 at 08:58:55PM +0800, Tian Tao wrote:
> > > fix the below warnning:
> > > /drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for
> > > kobj_to_dev()
> > What creates that warning?
> This is reported by coccicheck.

Then include that in the changelog text, otherwise this looks like a
warning by the complier, which it is not.

> > > Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> > > ---
> > >   drivers/w1/slaves/w1_ds2780.c | 3 ++-
> > >   drivers/w1/slaves/w1_ds2781.c | 2 +-
> > >   2 files changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
> > > index c281fe5..3cde1bb 100644
> > > --- a/drivers/w1/slaves/w1_ds2780.c
> > > +++ b/drivers/w1/slaves/w1_ds2780.c
> > > @@ -90,7 +90,8 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
> > >   			     struct bin_attribute *bin_attr, char *buf,
> > >   			     loff_t off, size_t count)
> > >   {
> > > -	struct device *dev = container_of(kobj, struct device, kobj);
> > > +	struct device *dev = kobj_to_dev(kobj);
> > > +
> > Why the extra line here, but not in the other chunk?
> 
> This is reported by checkpatch.
> 
> tiantao@ubuntu:~/mailline/linux-next$ ./scripts/checkpatch.pl
> drivers/w1/slaves/w1_ds2780.c
> 
> WARNING: Missing a blank line after declarations
> #94: FILE: drivers/w1/slaves/w1_ds2780.c:94:
> +       struct device *dev = kobj_to_dev(kobj);
> +       return w1_ds2780_io(dev, buf, off, count, 0);

Yes, but you made this change in only one of the hunks, and not the
other.

And, it is a different type of change, only do one "logical" thing per
patch.  This should be a 2 patch series if you care about the coding
style of this driver.

Please fix up and resend.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev()
  2021-03-01 13:09 ` Greg KH
@ 2021-03-02  0:51   ` tiantao (H)
  2021-03-02  5:37     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: tiantao (H) @ 2021-03-02  0:51 UTC (permalink / raw)
  To: Greg KH, Tian Tao; +Cc: zbr, rikard.falkeborn, linux-kernel

Hi:

在 2021/3/1 21:09, Greg KH 写道:
> On Mon, Mar 01, 2021 at 08:58:55PM +0800, Tian Tao wrote:
>> fix the below warnning:
>> /drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for
>> kobj_to_dev()
> What creates that warning?
This is reported by coccicheck.
>
>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>> ---
>>   drivers/w1/slaves/w1_ds2780.c | 3 ++-
>>   drivers/w1/slaves/w1_ds2781.c | 2 +-
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
>> index c281fe5..3cde1bb 100644
>> --- a/drivers/w1/slaves/w1_ds2780.c
>> +++ b/drivers/w1/slaves/w1_ds2780.c
>> @@ -90,7 +90,8 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
>>   			     struct bin_attribute *bin_attr, char *buf,
>>   			     loff_t off, size_t count)
>>   {
>> -	struct device *dev = container_of(kobj, struct device, kobj);
>> +	struct device *dev = kobj_to_dev(kobj);
>> +
> Why the extra line here, but not in the other chunk?

This is reported by checkpatch.

tiantao@ubuntu:~/mailline/linux-next$ ./scripts/checkpatch.pl 
drivers/w1/slaves/w1_ds2780.c

WARNING: Missing a blank line after declarations
#94: FILE: drivers/w1/slaves/w1_ds2780.c:94:
+       struct device *dev = kobj_to_dev(kobj);
+       return w1_ds2780_io(dev, buf, off, count, 0);

>
> Consistancy is key :)
>
> Please fix up.
>
> thanks,
>
> greg k-h
> .
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev()
  2021-03-01 12:58 Tian Tao
@ 2021-03-01 13:09 ` Greg KH
  2021-03-02  0:51   ` tiantao (H)
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2021-03-01 13:09 UTC (permalink / raw)
  To: Tian Tao; +Cc: zbr, rikard.falkeborn, linux-kernel

On Mon, Mar 01, 2021 at 08:58:55PM +0800, Tian Tao wrote:
> fix the below warnning:
> /drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for
> kobj_to_dev()

What creates that warning?

> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/w1/slaves/w1_ds2780.c | 3 ++-
>  drivers/w1/slaves/w1_ds2781.c | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
> index c281fe5..3cde1bb 100644
> --- a/drivers/w1/slaves/w1_ds2780.c
> +++ b/drivers/w1/slaves/w1_ds2780.c
> @@ -90,7 +90,8 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
>  			     struct bin_attribute *bin_attr, char *buf,
>  			     loff_t off, size_t count)
>  {
> -	struct device *dev = container_of(kobj, struct device, kobj);
> +	struct device *dev = kobj_to_dev(kobj);
> +

Why the extra line here, but not in the other chunk?

Consistancy is key :)

Please fix up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev()
@ 2021-03-01 12:58 Tian Tao
  2021-03-01 13:09 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Tian Tao @ 2021-03-01 12:58 UTC (permalink / raw)
  To: zbr, rikard.falkeborn, gregkh; +Cc: linux-kernel

fix the below warnning:
/drivers/w1/slaves/w1_ds2780.c:93:60-61: WARNING opportunity for
kobj_to_dev()

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/w1/slaves/w1_ds2780.c | 3 ++-
 drivers/w1/slaves/w1_ds2781.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
index c281fe5..3cde1bb 100644
--- a/drivers/w1/slaves/w1_ds2780.c
+++ b/drivers/w1/slaves/w1_ds2780.c
@@ -90,7 +90,8 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
 			     struct bin_attribute *bin_attr, char *buf,
 			     loff_t off, size_t count)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
+
 	return w1_ds2780_io(dev, buf, off, count, 0);
 }
 
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c
index f0d393a..2cb7c02 100644
--- a/drivers/w1/slaves/w1_ds2781.c
+++ b/drivers/w1/slaves/w1_ds2781.c
@@ -87,7 +87,7 @@ static ssize_t w1_slave_read(struct file *filp, struct kobject *kobj,
 			     struct bin_attribute *bin_attr, char *buf,
 			     loff_t off, size_t count)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj);
 	return w1_ds2781_io(dev, buf, off, count, 0);
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-02  8:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02  6:17 [PATCH] w1: ds2708 and ds2781 use the new API kobj_to_dev() Tian Tao
2021-03-02  6:27 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2021-03-01 12:58 Tian Tao
2021-03-01 13:09 ` Greg KH
2021-03-02  0:51   ` tiantao (H)
2021-03-02  5:37     ` Greg KH

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).