linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
@ 2020-06-17 16:11 Zhixu Zhao
  2020-06-17 19:10 ` Dan Carpenter
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Zhixu Zhao @ 2020-06-17 16:11 UTC (permalink / raw)
  To: Rob Springer, Todd Poynor, Ben Chan, Richard Yeh,
	Greg Kroah-Hartman, devel, linux-kernel, Joe Perches
  Cc: Zhixu Zhao

A coding alignment issue is found by checkpatch.pl.
Fix it by using a temporary for gasket_dev->bar_data[bar_num].

Signed-off-by: Zhixu Zhao <zhixu001@126.com>
---

Please ignore the last email (if you received it) because I forgot to Cc
the mailing list. Sorry for the noise...

Changes in v2:
  - gasket_dev->bar_data[bar_num] was used everywhere. Now replace it
    with a `struct gasket_bar_data *data`, making the code more elegant.
    Thanks to Joe Perches.

 drivers/staging/gasket/gasket_core.c | 29 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 67325fbaf760..28dab302183b 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -261,6 +261,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 	const struct gasket_driver_desc *driver_desc =
 		internal_desc->driver_desc;
 	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
+	struct gasket_bar_data *data;
 	int ret;
 
 	if (desc_bytes == 0)
@@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 		/* not PCI: skip this entry */
 		return 0;
 	}
+
+	data = &gasket_dev->bar_data[bar_num];
+
 	/*
 	 * pci_resource_start and pci_resource_len return a "resource_size_t",
 	 * which is safely castable to ulong (which itself is the arg to
 	 * request_mem_region).
 	 */
-	gasket_dev->bar_data[bar_num].phys_base =
+	data->phys_base =
 		(ulong)pci_resource_start(gasket_dev->pci_dev, bar_num);
-	if (!gasket_dev->bar_data[bar_num].phys_base) {
+	if (!data->phys_base) {
 		dev_err(gasket_dev->dev, "Cannot get BAR%u base address\n",
 			bar_num);
 		return -EINVAL;
 	}
 
-	gasket_dev->bar_data[bar_num].length_bytes =
+	data->length_bytes =
 		(ulong)pci_resource_len(gasket_dev->pci_dev, bar_num);
-	if (gasket_dev->bar_data[bar_num].length_bytes < desc_bytes) {
+	if (data->length_bytes < desc_bytes) {
 		dev_err(gasket_dev->dev,
 			"PCI BAR %u space is too small: %lu; expected >= %lu\n",
-			bar_num, gasket_dev->bar_data[bar_num].length_bytes,
-			desc_bytes);
+			bar_num, data->length_bytes, desc_bytes);
 		return -ENOMEM;
 	}
 
-	if (!request_mem_region(gasket_dev->bar_data[bar_num].phys_base,
-				gasket_dev->bar_data[bar_num].length_bytes,
+	if (!request_mem_region(data->phys_base, data->length_bytes,
 				gasket_dev->dev_info.name)) {
 		dev_err(gasket_dev->dev,
 			"Cannot get BAR %d memory region %p\n",
@@ -302,10 +304,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 		return -EINVAL;
 	}
 
-	gasket_dev->bar_data[bar_num].virt_base =
-		ioremap(gasket_dev->bar_data[bar_num].phys_base,
-				gasket_dev->bar_data[bar_num].length_bytes);
-	if (!gasket_dev->bar_data[bar_num].virt_base) {
+	data->virt_base = ioremap(data->phys_base, data->length_bytes);
+	if (!data->virt_base) {
 		dev_err(gasket_dev->dev,
 			"Cannot remap BAR %d memory region %p\n",
 			bar_num, &gasket_dev->pci_dev->resource[bar_num]);
@@ -319,9 +319,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 	return 0;
 
 fail:
-	iounmap(gasket_dev->bar_data[bar_num].virt_base);
-	release_mem_region(gasket_dev->bar_data[bar_num].phys_base,
-			   gasket_dev->bar_data[bar_num].length_bytes);
+	iounmap(data->virt_base);
+	release_mem_region(data->phys_base, data->length_bytes);
 	return ret;
 }
 
-- 
2.17.1


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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-06-17 16:11 [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c Zhixu Zhao
@ 2020-06-17 19:10 ` Dan Carpenter
  2020-07-15 10:38   ` Zhao
  2020-06-18 13:44 ` Zhixu Zhao
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Dan Carpenter @ 2020-06-17 19:10 UTC (permalink / raw)
  To: Zhixu Zhao
  Cc: Rob Springer, Todd Poynor, Ben Chan, Richard Yeh,
	Greg Kroah-Hartman, devel, linux-kernel, Joe Perches

On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index 67325fbaf760..28dab302183b 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -261,6 +261,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
>  	const struct gasket_driver_desc *driver_desc =
>  		internal_desc->driver_desc;
>  	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get rid of this as well (below).

> +	struct gasket_bar_data *data;
>  	int ret;
>  
>  	if (desc_bytes == 0)
> @@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
>  		/* not PCI: skip this entry */
>  		return 0;
>  	}
> +
> +	data = &gasket_dev->bar_data[bar_num];

It would be better to do this in the declaration block so you can change
the earlier two uses in this function:

+	struct gasket_bar_data *data = &gasket_dev->bar_data[bar_num];
-	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
+	ulong desc_bytes = data->size;

...

-	if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) {
+	if (data->type != PCI_BAR) {

regards,
dan carpenter

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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-06-17 16:11 [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c Zhixu Zhao
  2020-06-17 19:10 ` Dan Carpenter
@ 2020-06-18 13:44 ` Zhixu Zhao
  2020-06-18 14:03   ` Dan Carpenter
  2020-07-14 23:44 ` Zhixu Zhao
  2020-07-15 13:33 ` [PATCH v3] " Zhixu Zhao
  3 siblings, 1 reply; 14+ messages in thread
From: Zhixu Zhao @ 2020-06-18 13:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rob Springer, Todd Poynor, Ben Chan, Richard Yeh,
	Greg Kroah-Hartman, devel, linux-kernel, Joe Perches

At 2020-06-18 03:10:02, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:
>It would be better to do this in the declaration block so you can change
>the earlier two uses in this function:
>
>+	struct gasket_bar_data *data = &gasket_dev->bar_data[bar_num];
>-	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
>+	ulong desc_bytes = data->size;
>
>...
>
>-	if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) {
>+	if (data->type != PCI_BAR) {

`struct gasket_bar_data *data` and `driver_desc->bar_descriptions[bar_num]`
are not the same thing as I see it. Besides, `struct gasket_bar_data`
doesn't have a `size` field (it does have a `length_bytes` field).
So... did I miss anything?

-- 
Zhixu Zhao
https://github.com/zhaozhixu


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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-06-18 13:44 ` Zhixu Zhao
@ 2020-06-18 14:03   ` Dan Carpenter
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2020-06-18 14:03 UTC (permalink / raw)
  To: Zhixu Zhao
  Cc: devel, Greg Kroah-Hartman, linux-kernel, Richard Yeh,
	Rob Springer, Joe Perches, Todd Poynor

On Thu, Jun 18, 2020 at 09:44:22PM +0800, Zhixu Zhao wrote:
> At 2020-06-18 03:10:02, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:
> >It would be better to do this in the declaration block so you can change
> >the earlier two uses in this function:
> >
> >+	struct gasket_bar_data *data = &gasket_dev->bar_data[bar_num];
> >-	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
> >+	ulong desc_bytes = data->size;
> >
> >...
> >
> >-	if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) {
> >+	if (data->type != PCI_BAR) {
> 
> `struct gasket_bar_data *data` and `driver_desc->bar_descriptions[bar_num]`
> are not the same thing as I see it. Besides, `struct gasket_bar_data`
> doesn't have a `size` field (it does have a `length_bytes` field).
> So... did I miss anything?
> 

Ah wow...  I'm so sorry.  You're right.  Sorry for the noise.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter

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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-06-17 16:11 [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c Zhixu Zhao
  2020-06-17 19:10 ` Dan Carpenter
  2020-06-18 13:44 ` Zhixu Zhao
@ 2020-07-14 23:44 ` Zhixu Zhao
  2020-07-15  7:17   ` Greg KH
  2020-07-15 13:33 ` [PATCH v3] " Zhixu Zhao
  3 siblings, 1 reply; 14+ messages in thread
From: Zhixu Zhao @ 2020-07-14 23:44 UTC (permalink / raw)
  To: zhixu001
  Cc: benchan, devel, gregkh, joe, linux-kernel, rcy, rspringer,
	toddpoynor, dan.carpenter

On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> A coding alignment issue is found by checkpatch.pl.
> Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> 
> Signed-off-by: Zhixu Zhao <zhixu001@126.com>

Hi, there~

Does anybody have any further comments on this?
Can it be merged?

Zhixu


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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-14 23:44 ` Zhixu Zhao
@ 2020-07-15  7:17   ` Greg KH
  2020-07-15  7:24     ` Joe Perches
  0 siblings, 1 reply; 14+ messages in thread
From: Greg KH @ 2020-07-15  7:17 UTC (permalink / raw)
  To: Zhixu Zhao
  Cc: devel, linux-kernel, rcy, rspringer, joe, toddpoynor, dan.carpenter

On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
> On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> > A coding alignment issue is found by checkpatch.pl.
> > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> > 
> > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
> 
> Hi, there~
> 
> Does anybody have any further comments on this?
> Can it be merged?

I never saw the first version of this, are you sure it got sent to the
mailing list?  It's not in any archives anywhere.

Also, 3 days is really fast for a simple coding style cleanup to be
worried about.  Give it usually at least 2 weeks.

thanks,

greg k-h

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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-15  7:17   ` Greg KH
@ 2020-07-15  7:24     ` Joe Perches
  2020-07-15  7:57       ` Greg KH
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2020-07-15  7:24 UTC (permalink / raw)
  To: Greg KH, Zhixu Zhao
  Cc: devel, linux-kernel, rcy, rspringer, toddpoynor, dan.carpenter

On Wed, 2020-07-15 at 09:17 +0200, Greg KH wrote:
> On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
> > On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> > > A coding alignment issue is found by checkpatch.pl.
> > > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> > > 
> > > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
> > 
> > Hi, there~
> > 
> > Does anybody have any further comments on this?
> > Can it be merged?
> 
> I never saw the first version of this, are you sure it got sent to the
> mailing list?  It's not in any archives anywhere.

I saw it.  It's here:
https://lore.kernel.org/lkml/20200617161127.32006-1-zhixu001@126.com/

> Also, 3 days is really fast for a simple coding style cleanup to be
> worried about.  Give it usually at least 2 weeks.

Originally sent June 17.




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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-15  7:24     ` Joe Perches
@ 2020-07-15  7:57       ` Greg KH
  2020-07-15  8:37         ` Dan Carpenter
  0 siblings, 1 reply; 14+ messages in thread
From: Greg KH @ 2020-07-15  7:57 UTC (permalink / raw)
  To: Joe Perches
  Cc: Zhixu Zhao, devel, linux-kernel, rcy, rspringer, toddpoynor,
	dan.carpenter

On Wed, Jul 15, 2020 at 12:24:22AM -0700, Joe Perches wrote:
> On Wed, 2020-07-15 at 09:17 +0200, Greg KH wrote:
> > On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
> > > On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> > > > A coding alignment issue is found by checkpatch.pl.
> > > > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> > > > 
> > > > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
> > > 
> > > Hi, there~
> > > 
> > > Does anybody have any further comments on this?
> > > Can it be merged?
> > 
> > I never saw the first version of this, are you sure it got sent to the
> > mailing list?  It's not in any archives anywhere.
> 
> I saw it.  It's here:
> https://lore.kernel.org/lkml/20200617161127.32006-1-zhixu001@126.com/

Ah, doh, sorry.

Zhixu, please address the comments given to you on the series and resend
it as a new version.

thanks,

greg k-h

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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-15  7:57       ` Greg KH
@ 2020-07-15  8:37         ` Dan Carpenter
  2020-07-15  9:04           ` Joe Perches
  0 siblings, 1 reply; 14+ messages in thread
From: Dan Carpenter @ 2020-07-15  8:37 UTC (permalink / raw)
  To: Greg KH
  Cc: Joe Perches, devel, linux-kernel, Zhixu Zhao, rcy, rspringer, toddpoynor

On Wed, Jul 15, 2020 at 09:57:55AM +0200, Greg KH wrote:
> On Wed, Jul 15, 2020 at 12:24:22AM -0700, Joe Perches wrote:
> > On Wed, 2020-07-15 at 09:17 +0200, Greg KH wrote:
> > > On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
> > > > On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> > > > > A coding alignment issue is found by checkpatch.pl.
> > > > > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> > > > > 
> > > > > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
> > > > 
> > > > Hi, there~
> > > > 
> > > > Does anybody have any further comments on this?
> > > > Can it be merged?
> > > 
> > > I never saw the first version of this, are you sure it got sent to the
> > > mailing list?  It's not in any archives anywhere.
> > 
> > I saw it.  It's here:
> > https://lore.kernel.org/lkml/20200617161127.32006-1-zhixu001@126.com/
> 
> Ah, doh, sorry.
> 
> Zhixu, please address the comments given to you on the series and resend
> it as a new version.

He responded but not as a reply to my email.  It turns out I made a
mistake.

Anyway, just resend, Zhixu.

regards,
dan carpenter


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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-15  8:37         ` Dan Carpenter
@ 2020-07-15  9:04           ` Joe Perches
  2020-07-15 10:45             ` Zhao
  0 siblings, 1 reply; 14+ messages in thread
From: Joe Perches @ 2020-07-15  9:04 UTC (permalink / raw)
  To: Dan Carpenter, Greg KH
  Cc: devel, linux-kernel, Zhixu Zhao, rcy, rspringer, toddpoynor

On Wed, 2020-07-15 at 11:37 +0300, Dan Carpenter wrote:
> On Wed, Jul 15, 2020 at 09:57:55AM +0200, Greg KH wrote:
> > On Wed, Jul 15, 2020 at 12:24:22AM -0700, Joe Perches wrote:
> > > On Wed, 2020-07-15 at 09:17 +0200, Greg KH wrote:
> > > > On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
> > > > > On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> > > > > > A coding alignment issue is found by checkpatch.pl.
> > > > > > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> > > > > > 
> > > > > > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
> > > > > 
> > > > > Hi, there~
> > > > > 
> > > > > Does anybody have any further comments on this?
> > > > > Can it be merged?
> > > > 
> > > > I never saw the first version of this, are you sure it got sent to the
> > > > mailing list?  It's not in any archives anywhere.
> > > 
> > > I saw it.  It's here:
> > > https://lore.kernel.org/lkml/20200617161127.32006-1-zhixu001@126.com/
> > 
> > Ah, doh, sorry.
> > 
> > Zhixu, please address the comments given to you on the series and resend
> > it as a new version.
> 
> He responded but not as a reply to my email.  It turns out I made a
> mistake.
> 
> Anyway, just resend, Zhixu.

It's a pity a resend is being requested.

It'd be a better process if the original patch could
be applied via the link akin to a git pull.



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

* Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-06-17 19:10 ` Dan Carpenter
@ 2020-07-15 10:38   ` Zhao
  0 siblings, 0 replies; 14+ messages in thread
From: Zhao @ 2020-07-15 10:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rob Springer, Todd Poynor, Ben Chan, Richard Yeh,
	Greg Kroah-Hartman, devel, linux-kernel, Joe Perches

At 2020-06-18 03:10:02, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:
>On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
>> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
>> index 67325fbaf760..28dab302183b 100644
>> --- a/drivers/staging/gasket/gasket_core.c
>> +++ b/drivers/staging/gasket/gasket_core.c
>> @@ -261,6 +261,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
>>  	const struct gasket_driver_desc *driver_desc =
>>  		internal_desc->driver_desc;
>>  	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
>                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Get rid of this as well (below).
>
>> +	struct gasket_bar_data *data;
>>  	int ret;
>>  
>>  	if (desc_bytes == 0)
>> @@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
>>  		/* not PCI: skip this entry */
>>  		return 0;
>>  	}
>> +
>> +	data = &gasket_dev->bar_data[bar_num];
>
>It would be better to do this in the declaration block so you can change
>the earlier two uses in this function:
>
>+	struct gasket_bar_data *data = &gasket_dev->bar_data[bar_num];
>-	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
>+	ulong desc_bytes = data->size;
>
>...
>
>-	if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) {
>+	if (data->type != PCI_BAR) {
>
>regards,
>dan carpenter

This issue has been resolved in  https://lore.kernel.org/lkml/20200618140327.GS4151@kadam/

Zhixu

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

* Re:Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-15  9:04           ` Joe Perches
@ 2020-07-15 10:45             ` Zhao
  2020-07-15 11:06               ` Dan Carpenter
  0 siblings, 1 reply; 14+ messages in thread
From: Zhao @ 2020-07-15 10:45 UTC (permalink / raw)
  To: Joe Perches, Dan Carpenter, Greg KH
  Cc: devel, linux-kernel, rcy, rspringer, toddpoynor

At 2020-07-15 17:04:06, "Joe Perches" <joe@perches.com> wrote:
>On Wed, 2020-07-15 at 11:37 +0300, Dan Carpenter wrote:
>> On Wed, Jul 15, 2020 at 09:57:55AM +0200, Greg KH wrote:
>> > On Wed, Jul 15, 2020 at 12:24:22AM -0700, Joe Perches wrote:
>> > > On Wed, 2020-07-15 at 09:17 +0200, Greg KH wrote:
>> > > > On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
>> > > > > On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
>> > > > > > A coding alignment issue is found by checkpatch.pl.
>> > > > > > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
>> > > > > > 
>> > > > > > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
>> > > > > 
>> > > > > Hi, there~
>> > > > > 
>> > > > > Does anybody have any further comments on this?
>> > > > > Can it be merged?
>> > > > 
>> > > > I never saw the first version of this, are you sure it got sent to the
>> > > > mailing list?  It's not in any archives anywhere.
>> > > 
>> > > I saw it.  It's here:
>> > > https://lore.kernel.org/lkml/20200617161127.32006-1-zhixu001@126.com/
>> > 
>> > Ah, doh, sorry.
>> > 
>> > Zhixu, please address the comments given to you on the series and resend
>> > it as a new version.
>> 
>> He responded but not as a reply to my email.  It turns out I made a
>> mistake.
>> 
>> Anyway, just resend, Zhixu.
>
>It's a pity a resend is being requested.
>
>It'd be a better process if the original patch could
>be applied via the link akin to a git pull.
>

Yes. All comments have been resolved by now. Patch v2 is sufficient.

As Dan said, there was a tailing thread because I mis-replied his mail.
 I just now replied that mail with a reference to the final resolution mail.

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

* Re: Re: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-07-15 10:45             ` Zhao
@ 2020-07-15 11:06               ` Dan Carpenter
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Carpenter @ 2020-07-15 11:06 UTC (permalink / raw)
  To: Zhao
  Cc: Joe Perches, Greg KH, devel, rcy, toddpoynor, rspringer, linux-kernel

On Wed, Jul 15, 2020 at 06:45:21PM +0800, Zhao wrote:
> At 2020-07-15 17:04:06, "Joe Perches" <joe@perches.com> wrote:
> >On Wed, 2020-07-15 at 11:37 +0300, Dan Carpenter wrote:
> >> On Wed, Jul 15, 2020 at 09:57:55AM +0200, Greg KH wrote:
> >> > On Wed, Jul 15, 2020 at 12:24:22AM -0700, Joe Perches wrote:
> >> > > On Wed, 2020-07-15 at 09:17 +0200, Greg KH wrote:
> >> > > > On Wed, Jul 15, 2020 at 07:44:40AM +0800, Zhixu Zhao wrote:
> >> > > > > On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> >> > > > > > A coding alignment issue is found by checkpatch.pl.
> >> > > > > > Fix it by using a temporary for gasket_dev->bar_data[bar_num].
> >> > > > > > 
> >> > > > > > Signed-off-by: Zhixu Zhao <zhixu001@126.com>
> >> > > > > 
> >> > > > > Hi, there~
> >> > > > > 
> >> > > > > Does anybody have any further comments on this?
> >> > > > > Can it be merged?
> >> > > > 
> >> > > > I never saw the first version of this, are you sure it got sent to the
> >> > > > mailing list?  It's not in any archives anywhere.
> >> > > 
> >> > > I saw it.  It's here:
> >> > > https://lore.kernel.org/lkml/20200617161127.32006-1-zhixu001@126.com/
> >> > 
> >> > Ah, doh, sorry.
> >> > 
> >> > Zhixu, please address the comments given to you on the series and resend
> >> > it as a new version.
> >> 
> >> He responded but not as a reply to my email.  It turns out I made a
> >> mistake.
> >> 
> >> Anyway, just resend, Zhixu.
> >
> >It's a pity a resend is being requested.
> >
> >It'd be a better process if the original patch could
> >be applied via the link akin to a git pull.
> >
> 
> Yes. All comments have been resolved by now. Patch v2 is sufficient.
> 
> As Dan said, there was a tailing thread because I mis-replied his mail.
>  I just now replied that mail with a reference to the final resolution mail.

Just resend.

regards,
dan carpenter


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

* [PATCH v3] staging: gasket: core: Fix a coding style issue in gasket_core.c
  2020-06-17 16:11 [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c Zhixu Zhao
                   ` (2 preceding siblings ...)
  2020-07-14 23:44 ` Zhixu Zhao
@ 2020-07-15 13:33 ` Zhixu Zhao
  3 siblings, 0 replies; 14+ messages in thread
From: Zhixu Zhao @ 2020-07-15 13:33 UTC (permalink / raw)
  To: devel, gregkh, joe, linux-kernel, rcy, rspringer, toddpoynor,
	dan.carpenter
  Cc: zhixu001

A coding alignment issue is found by checkpatch.pl.
Fix it by using a temporary for gasket_dev->bar_data[bar_num].

Signed-off-by: Zhixu Zhao <zhixu001@126.com>
---

Changes in v2:
  - gasket_dev->bar_data[bar_num] was used everywhere. Now replace it
    with a `struct gasket_bar_data *data`, making the code more elegant.
    Thanks to Joe Perches.

About v3:
  - Resolved all comments in v2. Resending it...

 drivers/staging/gasket/gasket_core.c | 29 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 67325fbaf760..28dab302183b 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -261,6 +261,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 	const struct gasket_driver_desc *driver_desc =
 		internal_desc->driver_desc;
 	ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
+	struct gasket_bar_data *data;
 	int ret;
 
 	if (desc_bytes == 0)
@@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 		/* not PCI: skip this entry */
 		return 0;
 	}
+
+	data = &gasket_dev->bar_data[bar_num];
+
 	/*
 	 * pci_resource_start and pci_resource_len return a "resource_size_t",
 	 * which is safely castable to ulong (which itself is the arg to
 	 * request_mem_region).
 	 */
-	gasket_dev->bar_data[bar_num].phys_base =
+	data->phys_base =
 		(ulong)pci_resource_start(gasket_dev->pci_dev, bar_num);
-	if (!gasket_dev->bar_data[bar_num].phys_base) {
+	if (!data->phys_base) {
 		dev_err(gasket_dev->dev, "Cannot get BAR%u base address\n",
 			bar_num);
 		return -EINVAL;
 	}
 
-	gasket_dev->bar_data[bar_num].length_bytes =
+	data->length_bytes =
 		(ulong)pci_resource_len(gasket_dev->pci_dev, bar_num);
-	if (gasket_dev->bar_data[bar_num].length_bytes < desc_bytes) {
+	if (data->length_bytes < desc_bytes) {
 		dev_err(gasket_dev->dev,
 			"PCI BAR %u space is too small: %lu; expected >= %lu\n",
-			bar_num, gasket_dev->bar_data[bar_num].length_bytes,
-			desc_bytes);
+			bar_num, data->length_bytes, desc_bytes);
 		return -ENOMEM;
 	}
 
-	if (!request_mem_region(gasket_dev->bar_data[bar_num].phys_base,
-				gasket_dev->bar_data[bar_num].length_bytes,
+	if (!request_mem_region(data->phys_base, data->length_bytes,
 				gasket_dev->dev_info.name)) {
 		dev_err(gasket_dev->dev,
 			"Cannot get BAR %d memory region %p\n",
@@ -302,10 +304,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 		return -EINVAL;
 	}
 
-	gasket_dev->bar_data[bar_num].virt_base =
-		ioremap(gasket_dev->bar_data[bar_num].phys_base,
-				gasket_dev->bar_data[bar_num].length_bytes);
-	if (!gasket_dev->bar_data[bar_num].virt_base) {
+	data->virt_base = ioremap(data->phys_base, data->length_bytes);
+	if (!data->virt_base) {
 		dev_err(gasket_dev->dev,
 			"Cannot remap BAR %d memory region %p\n",
 			bar_num, &gasket_dev->pci_dev->resource[bar_num]);
@@ -319,9 +319,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
 	return 0;
 
 fail:
-	iounmap(gasket_dev->bar_data[bar_num].virt_base);
-	release_mem_region(gasket_dev->bar_data[bar_num].phys_base,
-			   gasket_dev->bar_data[bar_num].length_bytes);
+	iounmap(data->virt_base);
+	release_mem_region(data->phys_base, data->length_bytes);
 	return ret;
 }
 
-- 
2.17.1


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

end of thread, other threads:[~2020-07-15 13:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 16:11 [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c Zhixu Zhao
2020-06-17 19:10 ` Dan Carpenter
2020-07-15 10:38   ` Zhao
2020-06-18 13:44 ` Zhixu Zhao
2020-06-18 14:03   ` Dan Carpenter
2020-07-14 23:44 ` Zhixu Zhao
2020-07-15  7:17   ` Greg KH
2020-07-15  7:24     ` Joe Perches
2020-07-15  7:57       ` Greg KH
2020-07-15  8:37         ` Dan Carpenter
2020-07-15  9:04           ` Joe Perches
2020-07-15 10:45             ` Zhao
2020-07-15 11:06               ` Dan Carpenter
2020-07-15 13:33 ` [PATCH v3] " Zhixu Zhao

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