* [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
@ 2022-07-26 15:45 Andy Shevchenko
2022-07-26 17:55 ` Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Andy Shevchenko @ 2022-07-26 15:45 UTC (permalink / raw)
To: Damien Le Moal, linux-ide, linux-kernel; +Cc: Andy Shevchenko
Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it
consistent with other similar helper implementations.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/ata/libata-scsi.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 29e2f55c6faa..857996add897 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1318,17 +1318,8 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
*/
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
- u64 lba = 0;
- u32 len;
-
- lba |= ((u64)(cdb[1] & 0x1f)) << 16;
- lba |= ((u64)cdb[2]) << 8;
- lba |= ((u64)cdb[3]);
-
- len = cdb[4];
-
- *plba = lba;
- *plen = len;
+ *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
+ *plen = cdb[4];
}
/**
--
2.35.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
2022-07-26 15:45 [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() Andy Shevchenko
@ 2022-07-26 17:55 ` Christoph Hellwig
2022-07-29 3:25 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2022-07-26 17:55 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Damien Le Moal, linux-ide, linux-kernel
On Tue, Jul 26, 2022 at 06:45:18PM +0300, Andy Shevchenko wrote:
> static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
> {
> + *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
> + *plen = cdb[4];
I think just pen coding this in the caller would be a lot cleaner.
Same for scsi_10_lba_len and scsi_16_lba_len in their two callers each.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
2022-07-26 15:45 [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() Andy Shevchenko
2022-07-26 17:55 ` Christoph Hellwig
@ 2022-07-29 3:25 ` kernel test robot
2022-07-29 3:25 ` kernel test robot
2022-07-29 3:36 ` kernel test robot
3 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-07-29 3:25 UTC (permalink / raw)
To: Andy Shevchenko, Damien Le Moal, linux-ide, linux-kernel
Cc: llvm, kbuild-all, Andy Shevchenko
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.19-rc8 next-20220728]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ata-libata-scsi-Refactor-scsi_6_lba_len-with-use-of-get_unaligned_be24/20220726-234746
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e0dccc3b76fb35bb257b4118367a883073d7390e
config: mips-randconfig-r011-20220724 (https://download.01.org/0day-ci/archive/20220729/202207291151.npmUhv4C-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 83882606dbd7ffb0bdd3460356202d97705809c8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/ae9a00d0e0375aa2aea7a61dc2894d9d06005f8e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/ata-libata-scsi-Refactor-scsi_6_lba_len-with-use-of-get_unaligned_be24/20220726-234746
git checkout ae9a00d0e0375aa2aea7a61dc2894d9d06005f8e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/ata/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/ata/libata-scsi.c:1320:29: error: incompatible integer to pointer conversion passing 'const u8' (aka 'const unsigned char') to parameter of type 'const void *' [-Wint-conversion]
*plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
^~~~~~
include/asm-generic/unaligned.h:90:50: note: passing argument to parameter 'p' here
static inline u32 get_unaligned_be24(const void *p)
^
1 error generated.
vim +1320 drivers/ata/libata-scsi.c
1307
1308 /**
1309 * scsi_6_lba_len - Get LBA and transfer length
1310 * @cdb: SCSI command to translate
1311 *
1312 * Calculate LBA and transfer length for 6-byte commands.
1313 *
1314 * RETURNS:
1315 * @plba: the LBA
1316 * @plen: the transfer length
1317 */
1318 static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
1319 {
> 1320 *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
1321 *plen = cdb[4];
1322 }
1323
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
2022-07-26 15:45 [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() Andy Shevchenko
2022-07-26 17:55 ` Christoph Hellwig
2022-07-29 3:25 ` kernel test robot
@ 2022-07-29 3:25 ` kernel test robot
2022-07-29 3:36 ` kernel test robot
3 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-07-29 3:25 UTC (permalink / raw)
To: Andy Shevchenko, Damien Le Moal, linux-ide, linux-kernel
Cc: kbuild-all, Andy Shevchenko
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.19-rc8 next-20220728]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ata-libata-scsi-Refactor-scsi_6_lba_len-with-use-of-get_unaligned_be24/20220726-234746
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e0dccc3b76fb35bb257b4118367a883073d7390e
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20220729/202207291116.SWCwVbB1-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ae9a00d0e0375aa2aea7a61dc2894d9d06005f8e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/ata-libata-scsi-Refactor-scsi_6_lba_len-with-use-of-get_unaligned_be24/20220726-234746
git checkout ae9a00d0e0375aa2aea7a61dc2894d9d06005f8e
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/ata/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/ata/libata-scsi.c: In function 'scsi_6_lba_len':
>> drivers/ata/libata-scsi.c:1320:39: warning: passing argument 1 of 'get_unaligned_be24' makes pointer from integer without a cast [-Wint-conversion]
1320 | *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
| ~~~^~~
| |
| u8 {aka unsigned char}
In file included from ./arch/x86/include/generated/asm/unaligned.h:1,
from drivers/ata/libata-scsi.c:33:
include/asm-generic/unaligned.h:90:50: note: expected 'const void *' but argument is of type 'u8' {aka 'unsigned char'}
90 | static inline u32 get_unaligned_be24(const void *p)
| ~~~~~~~~~~~~^
vim +/get_unaligned_be24 +1320 drivers/ata/libata-scsi.c
1307
1308 /**
1309 * scsi_6_lba_len - Get LBA and transfer length
1310 * @cdb: SCSI command to translate
1311 *
1312 * Calculate LBA and transfer length for 6-byte commands.
1313 *
1314 * RETURNS:
1315 * @plba: the LBA
1316 * @plen: the transfer length
1317 */
1318 static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
1319 {
> 1320 *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
1321 *plen = cdb[4];
1322 }
1323
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
2022-07-26 15:45 [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() Andy Shevchenko
` (2 preceding siblings ...)
2022-07-29 3:25 ` kernel test robot
@ 2022-07-29 3:36 ` kernel test robot
3 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-07-29 3:36 UTC (permalink / raw)
To: Andy Shevchenko, Damien Le Moal, linux-ide, linux-kernel
Cc: kbuild-all, Andy Shevchenko
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.19-rc8 next-20220728]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ata-libata-scsi-Refactor-scsi_6_lba_len-with-use-of-get_unaligned_be24/20220726-234746
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e0dccc3b76fb35bb257b4118367a883073d7390e
config: i386-randconfig-a003 (https://download.01.org/0day-ci/archive/20220729/202207291100.qslmQQl1-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ae9a00d0e0375aa2aea7a61dc2894d9d06005f8e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/ata-libata-scsi-Refactor-scsi_6_lba_len-with-use-of-get_unaligned_be24/20220726-234746
git checkout ae9a00d0e0375aa2aea7a61dc2894d9d06005f8e
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/ata/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/ata/libata-scsi.c: In function 'scsi_6_lba_len':
>> drivers/ata/libata-scsi.c:1320:39: warning: passing argument 1 of 'get_unaligned_be24' makes pointer from integer without a cast [-Wint-conversion]
1320 | *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
| ~~~^~~
| |
| u8 {aka unsigned char}
In file included from ./arch/x86/include/generated/asm/unaligned.h:1,
from drivers/ata/libata-scsi.c:33:
include/asm-generic/unaligned.h:90:50: note: expected 'const void *' but argument is of type 'u8' {aka 'unsigned char'}
90 | static inline u32 get_unaligned_be24(const void *p)
| ~~~~~~~~~~~~^
vim +/get_unaligned_be24 +1320 drivers/ata/libata-scsi.c
1307
1308 /**
1309 * scsi_6_lba_len - Get LBA and transfer length
1310 * @cdb: SCSI command to translate
1311 *
1312 * Calculate LBA and transfer length for 6-byte commands.
1313 *
1314 * RETURNS:
1315 * @plba: the LBA
1316 * @plen: the transfer length
1317 */
1318 static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
1319 {
> 1320 *plba = get_unaligned_be24(cdb[1]) & 0x1fffff;
1321 *plen = cdb[4];
1322 }
1323
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
@ 2024-10-16 13:18 Andy Shevchenko
2024-10-17 0:32 ` Damien Le Moal
2024-10-17 8:14 ` Niklas Cassel
0 siblings, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2024-10-16 13:18 UTC (permalink / raw)
To: Niklas Cassel, Damien Le Moal, linux-ide, linux-kernel; +Cc: Andy Shevchenko
Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it
consistent with other similar helper implementations.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/ata/libata-scsi.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f915e3df57a9..4cef824cbafa 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1334,17 +1334,8 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
*/
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
- u64 lba = 0;
- u32 len;
-
- lba |= ((u64)(cdb[1] & 0x1f)) << 16;
- lba |= ((u64)cdb[2]) << 8;
- lba |= ((u64)cdb[3]);
-
- len = cdb[4];
-
- *plba = lba;
- *plen = len;
+ *plba = get_unaligned_be24(&cdb[1]) & 0x1fffff;
+ *plen = cdb[4];
}
/**
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
2024-10-16 13:18 Andy Shevchenko
@ 2024-10-17 0:32 ` Damien Le Moal
2024-10-17 8:14 ` Niklas Cassel
1 sibling, 0 replies; 8+ messages in thread
From: Damien Le Moal @ 2024-10-17 0:32 UTC (permalink / raw)
To: Andy Shevchenko, Niklas Cassel, linux-ide, linux-kernel
On 10/16/24 22:18, Andy Shevchenko wrote:
> Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it
> consistent with other similar helper implementations.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
2024-10-16 13:18 Andy Shevchenko
2024-10-17 0:32 ` Damien Le Moal
@ 2024-10-17 8:14 ` Niklas Cassel
1 sibling, 0 replies; 8+ messages in thread
From: Niklas Cassel @ 2024-10-17 8:14 UTC (permalink / raw)
To: Damien Le Moal, linux-ide, linux-kernel, Andy Shevchenko
On Wed, 16 Oct 2024 16:18:44 +0300, Andy Shevchenko wrote:
> Refactor scsi_6_lba_len() with use of get_unaligned_be24() to make it
> consistent with other similar helper implementations.
>
>
Applied to libata/linux.git (for-6.13), thanks!
[1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24()
https://git.kernel.org/libata/linux/c/08b64eee
Kind regards,
Niklas
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-10-17 8:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26 15:45 [PATCH v1 1/1] ata: libata-scsi: Refactor scsi_6_lba_len() with use of get_unaligned_be24() Andy Shevchenko
2022-07-26 17:55 ` Christoph Hellwig
2022-07-29 3:25 ` kernel test robot
2022-07-29 3:25 ` kernel test robot
2022-07-29 3:36 ` kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2024-10-16 13:18 Andy Shevchenko
2024-10-17 0:32 ` Damien Le Moal
2024-10-17 8:14 ` Niklas Cassel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox