linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libnvdimm.h: Remove duplicate struct declaration
@ 2021-04-19 11:27 Wan Jiabing
  2021-04-19 16:04 ` Ira Weiny
  0 siblings, 1 reply; 5+ messages in thread
From: Wan Jiabing @ 2021-04-19 11:27 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny, linux-nvdimm,
	linux-kernel
  Cc: kael_w, Wan Jiabing

struct device is declared at 133rd line.
The declaration here is unnecessary. Remove it.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 include/linux/libnvdimm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 01f251b6e36c..89b69e645ac7 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -141,7 +141,6 @@ static inline void __iomem *devm_nvdimm_ioremap(struct device *dev,
 
 struct nvdimm_bus;
 struct module;
-struct device;
 struct nd_blk_region;
 struct nd_blk_region_desc {
 	int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev);
-- 
2.25.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

* Re: [PATCH] libnvdimm.h: Remove duplicate struct declaration
  2021-04-19 11:27 [PATCH] libnvdimm.h: Remove duplicate struct declaration Wan Jiabing
@ 2021-04-19 16:04 ` Ira Weiny
  2021-04-20  1:54   ` Jiabing Wan
  2021-04-20 13:39   ` Santosh Sivaraj
  0 siblings, 2 replies; 5+ messages in thread
From: Ira Weiny @ 2021-04-19 16:04 UTC (permalink / raw)
  To: Wan Jiabing; +Cc: linux-nvdimm, linux-kernel, kael_w

On Mon, Apr 19, 2021 at 07:27:25PM +0800, Wan Jiabing wrote:
> struct device is declared at 133rd line.
> The declaration here is unnecessary. Remove it.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
>  include/linux/libnvdimm.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
> index 01f251b6e36c..89b69e645ac7 100644
> --- a/include/linux/libnvdimm.h
> +++ b/include/linux/libnvdimm.h
> @@ -141,7 +141,6 @@ static inline void __iomem *devm_nvdimm_ioremap(struct device *dev,
>  
>  struct nvdimm_bus;
>  struct module;
> -struct device;
>  struct nd_blk_region;

What is the coding style preference for pre-declarations like this?  Should
they be placed at the top of the file?

The patch is reasonable but if the intent is to declare right before use for
clarity, both devm_nvdimm_memremap() and nd_blk_region_desc() use struct
device.  So perhaps this duplicate is on purpose?

Ira

>  struct nd_blk_region_desc {
>  	int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev);
> -- 
> 2.25.1
> 
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

* Re:Re: [PATCH] libnvdimm.h: Remove duplicate struct declaration
  2021-04-19 16:04 ` Ira Weiny
@ 2021-04-20  1:54   ` Jiabing Wan
  2021-04-20 13:39   ` Santosh Sivaraj
  1 sibling, 0 replies; 5+ messages in thread
From: Jiabing Wan @ 2021-04-20  1:54 UTC (permalink / raw)
  To: Ira Weiny; +Cc: linux-nvdimm, linux-kernel, kael_w

 
>On Mon, Apr 19, 2021 at 07:27:25PM +0800, Wan Jiabing wrote:>> struct device is declared at 133rd line.
>> The declaration here is unnecessary. Remove it.
>> 
>> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
>> ---
>>  include/linux/libnvdimm.h | 1 -
>>  1 file changed, 1 deletion(-)
>> 
>> diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
>> index 01f251b6e36c..89b69e645ac7 100644
>> --- a/include/linux/libnvdimm.h
>> +++ b/include/linux/libnvdimm.h
>> @@ -141,7 +141,6 @@ static inline void __iomem *devm_nvdimm_ioremap(struct device *dev,
>>  
>>  struct nvdimm_bus;
>>  struct module;
>> -struct device;
>>  struct nd_blk_region;
>
>What is the coding style preference for pre-declarations like this?  Should
>they be placed at the top of the file?
>
>The patch is reasonable but if the intent is to declare right before use for
>clarity, both devm_nvdimm_memremap() and nd_blk_region_desc() use struct
>device.  So perhaps this duplicate is on purpose?
>
>Ira

OK, my script just catch this duplicate.
And I will report the duplicate if there is no MACRO dependence.
But I hadn't thought of whether the duplicate is a prompt on purpose.
Sorry.

Thanks for your reply.
Wan Jiabing

>>  struct nd_blk_region_desc {
>>  	int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev);
>> -- 
>> 2.25.1
>> 


_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

* Re: [PATCH] libnvdimm.h: Remove duplicate struct declaration
  2021-04-19 16:04 ` Ira Weiny
  2021-04-20  1:54   ` Jiabing Wan
@ 2021-04-20 13:39   ` Santosh Sivaraj
  2021-04-20 19:32     ` Dan Williams
  1 sibling, 1 reply; 5+ messages in thread
From: Santosh Sivaraj @ 2021-04-20 13:39 UTC (permalink / raw)
  To: Ira Weiny, Wan Jiabing; +Cc: linux-nvdimm, linux-kernel, kael_w

Hi Ira,

Ira Weiny <ira.weiny@intel.com> writes:

> On Mon, Apr 19, 2021 at 07:27:25PM +0800, Wan Jiabing wrote:
>> struct device is declared at 133rd line.
>> The declaration here is unnecessary. Remove it.
>> 
>> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
>> ---
>>  include/linux/libnvdimm.h | 1 -
>>  1 file changed, 1 deletion(-)
>> 
>> diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
>> index 01f251b6e36c..89b69e645ac7 100644
>> --- a/include/linux/libnvdimm.h
>> +++ b/include/linux/libnvdimm.h
>> @@ -141,7 +141,6 @@ static inline void __iomem *devm_nvdimm_ioremap(struct device *dev,
>>  
>>  struct nvdimm_bus;
>>  struct module;
>> -struct device;
>>  struct nd_blk_region;
>
> What is the coding style preference for pre-declarations like this?  Should
> they be placed at the top of the file?
>
> The patch is reasonable but if the intent is to declare right before use for
> clarity, both devm_nvdimm_memremap() and nd_blk_region_desc() use struct
> device.  So perhaps this duplicate is on purpose?

There are other struct device usage much later in the file, which doesn't have
any pre-declarations for struct device. So I assume this might not be on
purpose :-)

On a side note, types.h can also be removed, since it's already included in
kernel.h.

Santosh

>
> Ira
>
>>  struct nd_blk_region_desc {
>>  	int (*enable)(struct nvdimm_bus *nvdimm_bus, struct device *dev);
>> -- 
>> 2.25.1
>> 
> _______________________________________________
> Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
> To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

* Re: [PATCH] libnvdimm.h: Remove duplicate struct declaration
  2021-04-20 13:39   ` Santosh Sivaraj
@ 2021-04-20 19:32     ` Dan Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2021-04-20 19:32 UTC (permalink / raw)
  To: Santosh Sivaraj
  Cc: Wan Jiabing, linux-nvdimm, Linux Kernel Mailing List, kael_w

On Tue, Apr 20, 2021 at 6:39 AM Santosh Sivaraj <santosh@fossix.org> wrote:
>
> Hi Ira,
>
> Ira Weiny <ira.weiny@intel.com> writes:
>
> > On Mon, Apr 19, 2021 at 07:27:25PM +0800, Wan Jiabing wrote:
> >> struct device is declared at 133rd line.
> >> The declaration here is unnecessary. Remove it.
> >>
> >> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> >> ---
> >>  include/linux/libnvdimm.h | 1 -
> >>  1 file changed, 1 deletion(-)
> >>
> >> diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
> >> index 01f251b6e36c..89b69e645ac7 100644
> >> --- a/include/linux/libnvdimm.h
> >> +++ b/include/linux/libnvdimm.h
> >> @@ -141,7 +141,6 @@ static inline void __iomem *devm_nvdimm_ioremap(struct device *dev,
> >>
> >>  struct nvdimm_bus;
> >>  struct module;
> >> -struct device;
> >>  struct nd_blk_region;
> >
> > What is the coding style preference for pre-declarations like this?  Should
> > they be placed at the top of the file?
> >
> > The patch is reasonable but if the intent is to declare right before use for
> > clarity, both devm_nvdimm_memremap() and nd_blk_region_desc() use struct
> > device.  So perhaps this duplicate is on purpose?
>
> There are other struct device usage much later in the file, which doesn't have
> any pre-declarations for struct device. So I assume this might not be on
> purpose :-)

Yeah, I believe it was just code movement and the duplicate was
inadvertently introduced. Patch looks ok to me.

>
> On a side note, types.h can also be removed, since it's already included in
> kernel.h.

That I don't necessarily agree with, it just makes future header
reworks more fraught for not much benefit.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

end of thread, other threads:[~2021-04-20 19:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 11:27 [PATCH] libnvdimm.h: Remove duplicate struct declaration Wan Jiabing
2021-04-19 16:04 ` Ira Weiny
2021-04-20  1:54   ` Jiabing Wan
2021-04-20 13:39   ` Santosh Sivaraj
2021-04-20 19:32     ` Dan Williams

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