linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: comedi: Fix incorrect type assignment
@ 2017-02-07 19:06 Karthik Nayak
  2017-02-08 13:13 ` Ian Abbott
  2017-02-08 16:55 ` [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private' Karthik Nayak
  0 siblings, 2 replies; 13+ messages in thread
From: Karthik Nayak @ 2017-02-07 19:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: devel, abbotti, hsweeten, kastolom, gregkh, Karthik Nayak

This patch fixes the following sparse error:
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int

This is done by introducing a temporary variable which is of type
'__be32' and converting the existing variable to type 'unsigned int'.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
 drivers/staging/comedi/drivers/ni_pcimio.c | 5 +++--
 drivers/staging/comedi/drivers/ni_stc.h    | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index cdb66eab1292..4f45a5c230ad 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1207,6 +1207,7 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
 	unsigned int old_iodwbsr_bits;
 	unsigned int old_iodwbsr1_bits;
 	unsigned int old_iodwcr1_bits;
+	__be32 serial_number;
 	int i;
 
 	/* IO Window 1 needs to be temporarily mapped to read the eeprom */
@@ -1223,10 +1224,10 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
 
 	BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number));
 	for (i = 0; i < serial_number_eeprom_length; ++i) {
-		char *byte_ptr = (char *)&devpriv->serial_number + i;
+		char *byte_ptr = (char *)&serial_number + i;
 		*byte_ptr = ni_readb(dev, serial_number_eeprom_offset + i);
 	}
-	devpriv->serial_number = be32_to_cpu(devpriv->serial_number);
+	devpriv->serial_number = be32_to_cpu(serial_number);
 
 	for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
 		devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index f27b545f83eb..b5eca0da71eb 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1031,7 +1031,7 @@ struct ni_private {
 
 	unsigned short ai_fifo_buffer[0x2000];
 	u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
-	__be32 serial_number;
+	unsigned int serial_number;
 
 	struct mite *mite;
 	struct mite_channel *ai_mite_chan;
-- 
2.11.0

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-07 19:06 [PATCH] staging: comedi: Fix incorrect type assignment Karthik Nayak
@ 2017-02-08 13:13 ` Ian Abbott
  2017-02-08 13:26   ` Karthik Nayak
  2017-02-08 16:55 ` [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private' Karthik Nayak
  1 sibling, 1 reply; 13+ messages in thread
From: Ian Abbott @ 2017-02-08 13:13 UTC (permalink / raw)
  To: Karthik Nayak, linux-kernel; +Cc: devel, hsweeten, kastolom, gregkh

On 07/02/17 19:06, Karthik Nayak wrote:
> This patch fixes the following sparse error:
> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
>
> This is done by introducing a temporary variable which is of type
> '__be32' and converting the existing variable to type 'unsigned int'.
>
> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
> ---
>  drivers/staging/comedi/drivers/ni_pcimio.c | 5 +++--
>  drivers/staging/comedi/drivers/ni_stc.h    | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
> index cdb66eab1292..4f45a5c230ad 100644
> --- a/drivers/staging/comedi/drivers/ni_pcimio.c
> +++ b/drivers/staging/comedi/drivers/ni_pcimio.c
> @@ -1207,6 +1207,7 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
>  	unsigned int old_iodwbsr_bits;
>  	unsigned int old_iodwbsr1_bits;
>  	unsigned int old_iodwcr1_bits;
> +	__be32 serial_number;
>  	int i;
>
>  	/* IO Window 1 needs to be temporarily mapped to read the eeprom */
> @@ -1223,10 +1224,10 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
>
>  	BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number));
>  	for (i = 0; i < serial_number_eeprom_length; ++i) {
> -		char *byte_ptr = (char *)&devpriv->serial_number + i;
> +		char *byte_ptr = (char *)&serial_number + i;
>  		*byte_ptr = ni_readb(dev, serial_number_eeprom_offset + i);
>  	}
> -	devpriv->serial_number = be32_to_cpu(devpriv->serial_number);
> +	devpriv->serial_number = be32_to_cpu(serial_number);
>
>  	for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
>  		devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
> diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
> index f27b545f83eb..b5eca0da71eb 100644
> --- a/drivers/staging/comedi/drivers/ni_stc.h
> +++ b/drivers/staging/comedi/drivers/ni_stc.h
> @@ -1031,7 +1031,7 @@ struct ni_private {
>
>  	unsigned short ai_fifo_buffer[0x2000];
>  	u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
> -	__be32 serial_number;
> +	unsigned int serial_number;
>
>  	struct mite *mite;
>  	struct mite_channel *ai_mite_chan;
>

That looks fine, thanks!

(On a side note, nothing actually uses serial number, so the code that 
reads it from the EEPROM could just be ripped out.)

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-08 13:13 ` Ian Abbott
@ 2017-02-08 13:26   ` Karthik Nayak
  2017-02-08 13:48     ` Ian Abbott
  0 siblings, 1 reply; 13+ messages in thread
From: Karthik Nayak @ 2017-02-08 13:26 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-kernel, devel, hsweeten, Nikita Eshkeev, Greg KH

Hello,

On Wed, Feb 8, 2017 at 6:43 PM, Ian Abbott <abbotti@mev.co.uk> wrote:
> On 07/02/17 19:06, Karthik Nayak wrote:
>>
>> This patch fixes the following sparse error:
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect
>> type in assignment (different base types)
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected
>> restricted __be32 [usertype] serial_number
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
>>
>> This is done by introducing a temporary variable which is of type
>> '__be32' and converting the existing variable to type 'unsigned int'.
>>
>> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
>> ---
>>  drivers/staging/comedi/drivers/ni_pcimio.c | 5 +++--
>>  drivers/staging/comedi/drivers/ni_stc.h    | 2 +-
>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c
>> b/drivers/staging/comedi/drivers/ni_pcimio.c
>> index cdb66eab1292..4f45a5c230ad 100644
>> --- a/drivers/staging/comedi/drivers/ni_pcimio.c
>> +++ b/drivers/staging/comedi/drivers/ni_pcimio.c
>> @@ -1207,6 +1207,7 @@ static void m_series_init_eeprom_buffer(struct
>> comedi_device *dev)
>>         unsigned int old_iodwbsr_bits;
>>         unsigned int old_iodwbsr1_bits;
>>         unsigned int old_iodwcr1_bits;
>> +       __be32 serial_number;
>>         int i;
>>
>>         /* IO Window 1 needs to be temporarily mapped to read the eeprom
>> */
>> @@ -1223,10 +1224,10 @@ static void m_series_init_eeprom_buffer(struct
>> comedi_device *dev)
>>
>>         BUG_ON(serial_number_eeprom_length >
>> sizeof(devpriv->serial_number));
>>         for (i = 0; i < serial_number_eeprom_length; ++i) {
>> -               char *byte_ptr = (char *)&devpriv->serial_number + i;
>> +               char *byte_ptr = (char *)&serial_number + i;
>>                 *byte_ptr = ni_readb(dev, serial_number_eeprom_offset +
>> i);
>>         }
>> -       devpriv->serial_number = be32_to_cpu(devpriv->serial_number);
>> +       devpriv->serial_number = be32_to_cpu(serial_number);
>>
>>         for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
>>                 devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM
>> + i);
>> diff --git a/drivers/staging/comedi/drivers/ni_stc.h
>> b/drivers/staging/comedi/drivers/ni_stc.h
>> index f27b545f83eb..b5eca0da71eb 100644
>> --- a/drivers/staging/comedi/drivers/ni_stc.h
>> +++ b/drivers/staging/comedi/drivers/ni_stc.h
>> @@ -1031,7 +1031,7 @@ struct ni_private {
>>
>>         unsigned short ai_fifo_buffer[0x2000];
>>         u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
>> -       __be32 serial_number;
>> +       unsigned int serial_number;
>>
>>         struct mite *mite;
>>         struct mite_channel *ai_mite_chan;
>>
>
> That looks fine, thanks!
>
> (On a side note, nothing actually uses serial number, so the code that reads
> it from the EEPROM could just be ripped out.)
>
> Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
>

Yea, I saw that, was assuming there might be a purposed use case scenario.

Do you want me to send another patch?

-- 
Regards,
Karthik Nayak

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-08 13:26   ` Karthik Nayak
@ 2017-02-08 13:48     ` Ian Abbott
  2017-02-08 15:30       ` Karthik Nayak
  0 siblings, 1 reply; 13+ messages in thread
From: Ian Abbott @ 2017-02-08 13:48 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: linux-kernel, devel, hsweeten, Nikita Eshkeev, Greg KH

On 08/02/17 13:26, Karthik Nayak wrote:
> Hello,
>
> On Wed, Feb 8, 2017 at 6:43 PM, Ian Abbott <abbotti@mev.co.uk> wrote:
>> On 07/02/17 19:06, Karthik Nayak wrote:
>>>
>>> This patch fixes the following sparse error:
>>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect
>>> type in assignment (different base types)
>>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected
>>> restricted __be32 [usertype] serial_number
>>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
>>>
>>> This is done by introducing a temporary variable which is of type
>>> '__be32' and converting the existing variable to type 'unsigned int'.
>>>
>>> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
>>> ---
>>>  drivers/staging/comedi/drivers/ni_pcimio.c | 5 +++--
>>>  drivers/staging/comedi/drivers/ni_stc.h    | 2 +-
>>>  2 files changed, 4 insertions(+), 3 deletions(-)
[snip]

>> (On a side note, nothing actually uses serial number, so the code that reads
>> it from the EEPROM could just be ripped out.)
>>
>> Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
>>
>
> Yea, I saw that, was assuming there might be a purposed use case scenario.

AFAICT it's never been used - not even to print a kernel log message or 
anything.

> Do you want me to send another patch?

If you want.  If you plan to do so, could you indicate whether you are 
going to base the patch on top of this one, or whether this patch should 
be discarded.  Thanks!

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-08 13:48     ` Ian Abbott
@ 2017-02-08 15:30       ` Karthik Nayak
  0 siblings, 0 replies; 13+ messages in thread
From: Karthik Nayak @ 2017-02-08 15:30 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-kernel, devel, hsweeten, Nikita Eshkeev, Greg KH

Hi,

On Wed, Feb 8, 2017 at 7:18 PM, Ian Abbott <abbotti@mev.co.uk> wrote:
> On 08/02/17 13:26, Karthik Nayak wrote:
>>
>> Hello,
>>
>> On Wed, Feb 8, 2017 at 6:43 PM, Ian Abbott <abbotti@mev.co.uk> wrote:
>>>
>>> On 07/02/17 19:06, Karthik Nayak wrote:
>>>>
>>>>
>>>> This patch fixes the following sparse error:
>>>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect
>>>> type in assignment (different base types)
>>>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected
>>>> restricted __be32 [usertype] serial_number
>>>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
>>>>
>>>> This is done by introducing a temporary variable which is of type
>>>> '__be32' and converting the existing variable to type 'unsigned int'.
>>>>
>>>> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
>>>> ---
>>>>  drivers/staging/comedi/drivers/ni_pcimio.c | 5 +++--
>>>>  drivers/staging/comedi/drivers/ni_stc.h    | 2 +-
>>>>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> [snip]
>
>>> (On a side note, nothing actually uses serial number, so the code that
>>> reads
>>> it from the EEPROM could just be ripped out.)
>>>
>>> Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
>>>
>>
>> Yea, I saw that, was assuming there might be a purposed use case scenario.
>
>
> AFAICT it's never been used - not even to print a kernel log message or
> anything.
>
>> Do you want me to send another patch?
>
>
> If you want.  If you plan to do so, could you indicate whether you are going
> to base the patch on top of this one, or whether this patch should be
> discarded.  Thanks!
>

Sure, I'll base it on top of the existing patch. I'll reply to the
first patch with the second one.

-- 
Regards,
Karthik Nayak

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

* [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private'
  2017-02-07 19:06 [PATCH] staging: comedi: Fix incorrect type assignment Karthik Nayak
  2017-02-08 13:13 ` Ian Abbott
@ 2017-02-08 16:55 ` Karthik Nayak
  2017-02-08 17:40   ` Ian Abbott
  1 sibling, 1 reply; 13+ messages in thread
From: Karthik Nayak @ 2017-02-08 16:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: devel, abbotti, hsweeten, kastolom, gregkh, Karthik Nayak

Drop the 'serial_number' variable from the struct 'ni_private' since
its never used after assignment.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---

This is to be based on top of "staging: comedi: Fix incorrect type assignment"
to which this is replied to. 

 drivers/staging/comedi/drivers/ni_pcimio.c | 3 +--
 drivers/staging/comedi/drivers/ni_stc.h    | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index 4f45a5c230ad..da4d3da071eb 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1222,12 +1222,11 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
 	writel(0x1 | old_iodwcr1_bits, mite->mmio + MITE_IODWCR_1);
 	writel(0xf, mite->mmio + 0x30);
 
-	BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number));
+	BUG_ON(serial_number_eeprom_length > sizeof(serial_number));
 	for (i = 0; i < serial_number_eeprom_length; ++i) {
 		char *byte_ptr = (char *)&serial_number + i;
 		*byte_ptr = ni_readb(dev, serial_number_eeprom_offset + i);
 	}
-	devpriv->serial_number = be32_to_cpu(serial_number);
 
 	for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
 		devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index b5eca0da71eb..61138e86a455 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1031,7 +1031,6 @@ struct ni_private {
 
 	unsigned short ai_fifo_buffer[0x2000];
 	u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
-	unsigned int serial_number;
 
 	struct mite *mite;
 	struct mite_channel *ai_mite_chan;
-- 
2.11.1

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

* Re: [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private'
  2017-02-08 16:55 ` [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private' Karthik Nayak
@ 2017-02-08 17:40   ` Ian Abbott
  2017-02-08 20:05     ` Karthik Nayak
  0 siblings, 1 reply; 13+ messages in thread
From: Ian Abbott @ 2017-02-08 17:40 UTC (permalink / raw)
  To: Karthik Nayak, linux-kernel; +Cc: devel, hsweeten, kastolom, gregkh

On 08/02/2017 16:55, Karthik Nayak wrote:
> Drop the 'serial_number' variable from the struct 'ni_private' since
> its never used after assignment.
>
> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
> ---
>
> This is to be based on top of "staging: comedi: Fix incorrect type assignment"
> to which this is replied to.
>
>  drivers/staging/comedi/drivers/ni_pcimio.c | 3 +--
>  drivers/staging/comedi/drivers/ni_stc.h    | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
> index 4f45a5c230ad..da4d3da071eb 100644
> --- a/drivers/staging/comedi/drivers/ni_pcimio.c
> +++ b/drivers/staging/comedi/drivers/ni_pcimio.c
> @@ -1222,12 +1222,11 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
>  	writel(0x1 | old_iodwcr1_bits, mite->mmio + MITE_IODWCR_1);
>  	writel(0xf, mite->mmio + 0x30);
>

I think it would be preferable to remove the code from here ...

> -	BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number));
> +	BUG_ON(serial_number_eeprom_length > sizeof(serial_number));
>  	for (i = 0; i < serial_number_eeprom_length; ++i) {
>  		char *byte_ptr = (char *)&serial_number + i;
>  		*byte_ptr = ni_readb(dev, serial_number_eeprom_offset + i);
>  	}
> -	devpriv->serial_number = be32_to_cpu(serial_number);

... to here.  And remove the serial_number_eeprom_length, 
serial_number_eeprom_offset, and serial_number variables too.  There is 
no need to continue reading the serial number bytes from the EEPROM.

>
>  	for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
>  		devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
> diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
> index b5eca0da71eb..61138e86a455 100644
> --- a/drivers/staging/comedi/drivers/ni_stc.h
> +++ b/drivers/staging/comedi/drivers/ni_stc.h
> @@ -1031,7 +1031,6 @@ struct ni_private {
>
>  	unsigned short ai_fifo_buffer[0x2000];
>  	u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
> -	unsigned int serial_number;
>
>  	struct mite *mite;
>  	struct mite_channel *ai_mite_chan;
>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

* Re: [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private'
  2017-02-08 17:40   ` Ian Abbott
@ 2017-02-08 20:05     ` Karthik Nayak
  2017-02-08 20:18       ` Karthik Nayak
  0 siblings, 1 reply; 13+ messages in thread
From: Karthik Nayak @ 2017-02-08 20:05 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-kernel, devel, hsweeten, Nikita Eshkeev, Greg KH

Hey,

On Wed, Feb 8, 2017 at 11:10 PM, Ian Abbott <abbotti@mev.co.uk> wrote:
> On 08/02/2017 16:55, Karthik Nayak wrote:
>>
>> Drop the 'serial_number' variable from the struct 'ni_private' since
>> its never used after assignment.
>>
>> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
>> ---
>>
>> This is to be based on top of "staging: comedi: Fix incorrect type
>> assignment"
>> to which this is replied to.
>>
>>  drivers/staging/comedi/drivers/ni_pcimio.c | 3 +--
>>  drivers/staging/comedi/drivers/ni_stc.h    | 1 -
>>  2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c
>> b/drivers/staging/comedi/drivers/ni_pcimio.c
>> index 4f45a5c230ad..da4d3da071eb 100644
>> --- a/drivers/staging/comedi/drivers/ni_pcimio.c
>> +++ b/drivers/staging/comedi/drivers/ni_pcimio.c
>> @@ -1222,12 +1222,11 @@ static void m_series_init_eeprom_buffer(struct
>> comedi_device *dev)
>>         writel(0x1 | old_iodwcr1_bits, mite->mmio + MITE_IODWCR_1);
>>         writel(0xf, mite->mmio + 0x30);
>>
>
> I think it would be preferable to remove the code from here ...
>
>> -       BUG_ON(serial_number_eeprom_length >
>> sizeof(devpriv->serial_number));
>> +       BUG_ON(serial_number_eeprom_length > sizeof(serial_number));
>>         for (i = 0; i < serial_number_eeprom_length; ++i) {
>>                 char *byte_ptr = (char *)&serial_number + i;
>>                 *byte_ptr = ni_readb(dev, serial_number_eeprom_offset +
>> i);
>>         }
>> -       devpriv->serial_number = be32_to_cpu(serial_number);
>
>
> ... to here.  And remove the serial_number_eeprom_length,
> serial_number_eeprom_offset, and serial_number variables too.  There is no
> need to continue reading the serial number bytes from the EEPROM.
>

Ah! I'll do that and send a patch, thanks :)

>>
>>         for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
>>                 devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM
>> + i);
>> diff --git a/drivers/staging/comedi/drivers/ni_stc.h
>> b/drivers/staging/comedi/drivers/ni_stc.h
>> index b5eca0da71eb..61138e86a455 100644
>> --- a/drivers/staging/comedi/drivers/ni_stc.h
>> +++ b/drivers/staging/comedi/drivers/ni_stc.h
>> @@ -1031,7 +1031,6 @@ struct ni_private {
>>
>>         unsigned short ai_fifo_buffer[0x2000];
>>         u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
>> -       unsigned int serial_number;
>>
>>         struct mite *mite;
>>         struct mite_channel *ai_mite_chan;
>>
>
> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
> -=(                          Web: http://www.mev.co.uk/  )=-



-- 
Regards,
Karthik Nayak

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

* Re: [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private'
  2017-02-08 20:05     ` Karthik Nayak
@ 2017-02-08 20:18       ` Karthik Nayak
  2017-02-08 20:23         ` [PATCH] staging: comedi: Fix incorrect type assignment Karthik Nayak
  0 siblings, 1 reply; 13+ messages in thread
From: Karthik Nayak @ 2017-02-08 20:18 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-kernel, devel, hsweeten, Nikita Eshkeev, Greg KH

Hello,

>>
>> ... to here.  And remove the serial_number_eeprom_length,
>> serial_number_eeprom_offset, and serial_number variables too.  There is no
>> need to continue reading the serial number bytes from the EEPROM.
>>
>
> Ah! I'll do that and send a patch, thanks :)
>

Sorry for the multiple messages, now that we're deleting the whole
block, I think it makes sense to
squash the commits, so I'll send one single patch.

-- 
Regards,
Karthik Nayak

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

* [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-08 20:18       ` Karthik Nayak
@ 2017-02-08 20:23         ` Karthik Nayak
  2017-02-09 11:04           ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Karthik Nayak @ 2017-02-08 20:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: devel, abbotti, hsweeten, kastolom, gregkh, Karthik Nayak

This patch fixes the following sparse error:
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int

This is done by removing the whole code block, since the variable
'serial_number' is only assigned but never used.

Helped-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
---
 drivers/staging/comedi/drivers/ni_pcimio.c | 9 ---------
 drivers/staging/comedi/drivers/ni_stc.h    | 1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index cdb66eab1292..3a96913c025e 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1202,8 +1202,6 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
 	resource_size_t daq_phys_addr;
 	static const int Start_Cal_EEPROM = 0x400;
 	static const unsigned int window_size = 10;
-	static const int serial_number_eeprom_offset = 0x4;
-	static const int serial_number_eeprom_length = 0x4;
 	unsigned int old_iodwbsr_bits;
 	unsigned int old_iodwbsr1_bits;
 	unsigned int old_iodwcr1_bits;
@@ -1221,13 +1219,6 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev)
 	writel(0x1 | old_iodwcr1_bits, mite->mmio + MITE_IODWCR_1);
 	writel(0xf, mite->mmio + 0x30);
 
-	BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number));
-	for (i = 0; i < serial_number_eeprom_length; ++i) {
-		char *byte_ptr = (char *)&devpriv->serial_number + i;
-		*byte_ptr = ni_readb(dev, serial_number_eeprom_offset + i);
-	}
-	devpriv->serial_number = be32_to_cpu(devpriv->serial_number);
-
 	for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
 		devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
 
diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index f27b545f83eb..61138e86a455 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1031,7 +1031,6 @@ struct ni_private {
 
 	unsigned short ai_fifo_buffer[0x2000];
 	u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
-	__be32 serial_number;
 
 	struct mite *mite;
 	struct mite_channel *ai_mite_chan;
-- 
2.11.1

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-08 20:23         ` [PATCH] staging: comedi: Fix incorrect type assignment Karthik Nayak
@ 2017-02-09 11:04           ` Greg KH
  2017-02-09 11:22             ` Ian Abbott
  2017-02-09 11:34             ` Karthik Nayak
  0 siblings, 2 replies; 13+ messages in thread
From: Greg KH @ 2017-02-09 11:04 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: linux-kernel, devel, kastolom, abbotti

On Thu, Feb 09, 2017 at 01:53:56AM +0530, Karthik Nayak wrote:
> This patch fixes the following sparse error:
> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
> 
> This is done by removing the whole code block, since the variable
> 'serial_number' is only assigned but never used.
> 
> Helped-by: Ian Abbott <abbotti@mev.co.uk>

There's no such tag, sorry :(

And does this obsolete all of your other ones?  Please make it obvious
what I am supposed to do here.

I've now dropped all of these patches from my queue.  please resend the
proper one.

thanks,

greg k-h

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-09 11:04           ` Greg KH
@ 2017-02-09 11:22             ` Ian Abbott
  2017-02-09 11:34             ` Karthik Nayak
  1 sibling, 0 replies; 13+ messages in thread
From: Ian Abbott @ 2017-02-09 11:22 UTC (permalink / raw)
  To: Greg KH, Karthik Nayak; +Cc: linux-kernel, devel, kastolom

On 09/02/2017 11:04, Greg KH wrote:
> On Thu, Feb 09, 2017 at 01:53:56AM +0530, Karthik Nayak wrote:
>> This patch fixes the following sparse error:
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
>>
>> This is done by removing the whole code block, since the variable
>> 'serial_number' is only assigned but never used.
>>
>> Helped-by: Ian Abbott <abbotti@mev.co.uk>
>
> There's no such tag, sorry :(
>
> And does this obsolete all of your other ones?  Please make it obvious
> what I am supposed to do here.
>
> I've now dropped all of these patches from my queue.  please resend the
> proper one.
>
> thanks,
>
> greg k-h
>

To add to that, I think the emphasis of the patch title and description 
should now be on the removal of serial_number, with fixing the sparse 
error as a useful side-effect/inspiration.  The patch title should also 
mention ni_pcimio.

Thanks,
Ian.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

* Re: [PATCH] staging: comedi: Fix incorrect type assignment
  2017-02-09 11:04           ` Greg KH
  2017-02-09 11:22             ` Ian Abbott
@ 2017-02-09 11:34             ` Karthik Nayak
  1 sibling, 0 replies; 13+ messages in thread
From: Karthik Nayak @ 2017-02-09 11:34 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, devel, Nikita Eshkeev, Ian Abbott

Hello,

On Thu, Feb 9, 2017 at 4:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Thu, Feb 09, 2017 at 01:53:56AM +0530, Karthik Nayak wrote:
>> This patch fixes the following sparse error:
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
>> drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int
>>
>> This is done by removing the whole code block, since the variable
>> 'serial_number' is only assigned but never used.
>>
>> Helped-by: Ian Abbott <abbotti@mev.co.uk>
>
> There's no such tag, sorry :(
>

Ah! This is common back in the Git community, I shall drop it :)

> And does this obsolete all of your other ones?  Please make it obvious
> what I am supposed to do here.
>
> I've now dropped all of these patches from my queue.  please resend the
> proper one.
>

That works! I'll send the patch again, lets ignore the previous patches.


On Thu, Feb 9, 2017 at 4:52 PM, Ian Abbott <abbotti@mev.co.uk> wrote:
> To add to that, I think the emphasis of the patch title and description
> should now be on the removal of serial_number, with fixing the sparse error
> as a useful side-effect/inspiration.  The patch title should also mention
> ni_pcimio.
>
> Thanks,
> Ian.

Makes sense, will make the necessary changes.


-- 
Regards,
Karthik Nayak

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

end of thread, other threads:[~2017-02-09 11:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 19:06 [PATCH] staging: comedi: Fix incorrect type assignment Karthik Nayak
2017-02-08 13:13 ` Ian Abbott
2017-02-08 13:26   ` Karthik Nayak
2017-02-08 13:48     ` Ian Abbott
2017-02-08 15:30       ` Karthik Nayak
2017-02-08 16:55 ` [PATCH 2/2] staging: comedi: drop unused variable from struct 'ni_private' Karthik Nayak
2017-02-08 17:40   ` Ian Abbott
2017-02-08 20:05     ` Karthik Nayak
2017-02-08 20:18       ` Karthik Nayak
2017-02-08 20:23         ` [PATCH] staging: comedi: Fix incorrect type assignment Karthik Nayak
2017-02-09 11:04           ` Greg KH
2017-02-09 11:22             ` Ian Abbott
2017-02-09 11:34             ` Karthik Nayak

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