linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] lightnvm: Use u64 instead of __le64 for CPU visible side
@ 2019-01-24 14:22 Andy Shevchenko
  2019-01-24 14:46 ` Javier González
  2019-01-24 18:18 ` Matias Bjørling
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-01-24 14:22 UTC (permalink / raw)
  To: Matias Bjorling, Jens Axboe, Javier González, linux-block
  Cc: Andy Shevchenko

Sparse complains about using strict data types:

drivers/lightnvm/pblk-read.c:254:43: warning: incorrect type in assignment (different base types)
drivers/lightnvm/pblk-read.c:254:43:    expected restricted __le64 <noident>
drivers/lightnvm/pblk-read.c:254:43:    got unsigned long long [unsigned] [usertype] <noident>
drivers/lightnvm/pblk-read.c:255:29: warning: cast from restricted __le64
drivers/lightnvm/pblk-read.c:268:29: warning: cast from restricted __le64
drivers/lightnvm/pblk-read.c:328:41: warning: incorrect type in assignment (different base types)
drivers/lightnvm/pblk-read.c:328:41:    expected restricted __le64 <noident>
drivers/lightnvm/pblk-read.c:328:41:    got unsigned long long [unsigned] [usertype] <noident>

In the code it seems explicit that lba_list_mem and lba_list_media members of
struct pblk_pr_ctx are used on CPU side, which means they should not be of
strict types.

Change types of lba_list_mem and lba_list_media members to be u64.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/lightnvm/pblk.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 12bf02df4204..72ae8755764e 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -131,8 +131,8 @@ struct pblk_pr_ctx {
 	unsigned int bio_init_idx;
 	void *ppa_ptr;
 	dma_addr_t dma_ppa_list;
-	__le64 lba_list_mem[NVM_MAX_VLBA];
-	__le64 lba_list_media[NVM_MAX_VLBA];
+	u64 lba_list_mem[NVM_MAX_VLBA];
+	u64 lba_list_media[NVM_MAX_VLBA];
 };
 
 /* Pad context */
-- 
2.20.1


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

* Re: [PATCH v1] lightnvm: Use u64 instead of __le64 for CPU visible side
  2019-01-24 14:22 [PATCH v1] lightnvm: Use u64 instead of __le64 for CPU visible side Andy Shevchenko
@ 2019-01-24 14:46 ` Javier González
  2019-01-24 18:18 ` Matias Bjørling
  1 sibling, 0 replies; 3+ messages in thread
From: Javier González @ 2019-01-24 14:46 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Matias Bjørling, Jens Axboe, linux-block

[-- Attachment #1: Type: text/plain, Size: 1984 bytes --]

> On 24 Jan 2019, at 15.22, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> Sparse complains about using strict data types:
> 
> drivers/lightnvm/pblk-read.c:254:43: warning: incorrect type in assignment (different base types)
> drivers/lightnvm/pblk-read.c:254:43:    expected restricted __le64 <noident>
> drivers/lightnvm/pblk-read.c:254:43:    got unsigned long long [unsigned] [usertype] <noident>
> drivers/lightnvm/pblk-read.c:255:29: warning: cast from restricted __le64
> drivers/lightnvm/pblk-read.c:268:29: warning: cast from restricted __le64
> drivers/lightnvm/pblk-read.c:328:41: warning: incorrect type in assignment (different base types)
> drivers/lightnvm/pblk-read.c:328:41:    expected restricted __le64 <noident>
> drivers/lightnvm/pblk-read.c:328:41:    got unsigned long long [unsigned] [usertype] <noident>
> 
> In the code it seems explicit that lba_list_mem and lba_list_media members of
> struct pblk_pr_ctx are used on CPU side, which means they should not be of
> strict types.
> 
> Change types of lba_list_mem and lba_list_media members to be u64.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/lightnvm/pblk.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
> index 12bf02df4204..72ae8755764e 100644
> --- a/drivers/lightnvm/pblk.h
> +++ b/drivers/lightnvm/pblk.h
> @@ -131,8 +131,8 @@ struct pblk_pr_ctx {
> 	unsigned int bio_init_idx;
> 	void *ppa_ptr;
> 	dma_addr_t dma_ppa_list;
> -	__le64 lba_list_mem[NVM_MAX_VLBA];
> -	__le64 lba_list_media[NVM_MAX_VLBA];
> +	u64 lba_list_mem[NVM_MAX_VLBA];
> +	u64 lba_list_media[NVM_MAX_VLBA];
> };
> 
> /* Pad context */
> --
> 2.20.1

Looks good to me. At some point these mapped directly to the metadata
stored in the device and the type remained when we change it.


Reviewed-by: Javier González <javier@javigon.com>



[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v1] lightnvm: Use u64 instead of __le64 for CPU visible side
  2019-01-24 14:22 [PATCH v1] lightnvm: Use u64 instead of __le64 for CPU visible side Andy Shevchenko
  2019-01-24 14:46 ` Javier González
@ 2019-01-24 18:18 ` Matias Bjørling
  1 sibling, 0 replies; 3+ messages in thread
From: Matias Bjørling @ 2019-01-24 18:18 UTC (permalink / raw)
  To: Andy Shevchenko, Jens Axboe, Javier González, linux-block

On 1/24/19 3:22 PM, Andy Shevchenko wrote:
> Sparse complains about using strict data types:
> 
> drivers/lightnvm/pblk-read.c:254:43: warning: incorrect type in assignment (different base types)
> drivers/lightnvm/pblk-read.c:254:43:    expected restricted __le64 <noident>
> drivers/lightnvm/pblk-read.c:254:43:    got unsigned long long [unsigned] [usertype] <noident>
> drivers/lightnvm/pblk-read.c:255:29: warning: cast from restricted __le64
> drivers/lightnvm/pblk-read.c:268:29: warning: cast from restricted __le64
> drivers/lightnvm/pblk-read.c:328:41: warning: incorrect type in assignment (different base types)
> drivers/lightnvm/pblk-read.c:328:41:    expected restricted __le64 <noident>
> drivers/lightnvm/pblk-read.c:328:41:    got unsigned long long [unsigned] [usertype] <noident>
> 
> In the code it seems explicit that lba_list_mem and lba_list_media members of
> struct pblk_pr_ctx are used on CPU side, which means they should not be of
> strict types.
> 
> Change types of lba_list_mem and lba_list_media members to be u64.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/lightnvm/pblk.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
> index 12bf02df4204..72ae8755764e 100644
> --- a/drivers/lightnvm/pblk.h
> +++ b/drivers/lightnvm/pblk.h
> @@ -131,8 +131,8 @@ struct pblk_pr_ctx {
>   	unsigned int bio_init_idx;
>   	void *ppa_ptr;
>   	dma_addr_t dma_ppa_list;
> -	__le64 lba_list_mem[NVM_MAX_VLBA];
> -	__le64 lba_list_media[NVM_MAX_VLBA];
> +	u64 lba_list_mem[NVM_MAX_VLBA];
> +	u64 lba_list_media[NVM_MAX_VLBA];
>   };
>   
>   /* Pad context */
> 

Thanks Andy. I've applied it for 5.1.


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

end of thread, other threads:[~2019-01-24 18:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 14:22 [PATCH v1] lightnvm: Use u64 instead of __le64 for CPU visible side Andy Shevchenko
2019-01-24 14:46 ` Javier González
2019-01-24 18:18 ` Matias Bjørling

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