asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
Subsystems (6)
PATCH 1/1 asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
--- drivers/nvme/host/rdma.c | 8 ------- drivers/nvme/target/rdma.c | 6 ----- drivers/usb/gadget/function/storage_common.h | 5 ---- include/asm-generic/unaligned.h | 25 ++++++++++++++++++++ include/target/target_core_backend.h | 6 ----- 5 files changed, 25 insertions(+), 25 deletions(-)
drivers/nvme/host/rdma.c +0 -8
@@ -142,14 +142,6 @@ static void nvme_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc);static const struct blk_mq_ops nvme_rdma_mq_ops;static const struct blk_mq_ops nvme_rdma_admin_mq_ops; -/* XXX: really should move to a generic header sooner or later.. */ -static inline void put_unaligned_le24 (u32 val,u8 *p) -{ - *p++ = val; - *p++ = val >>8 ; - *p++ = val >>16 ; -} -static inline int nvme_rdma_queue_idx (struct nvme_rdma_queue *queue) {return queue - queue->ctrl->queues;
drivers/nvme/target/rdma.c +0 -6
@@ -143,12 +143,6 @@ static int num_pages(int len)return 1 + (((len -1 ) &PAGE_MASK ) >>PAGE_SHIFT ); } -/* XXX: really should move to a generic header sooner or later.. */ -static inline u32 get_unaligned_le24 (const u8 *p) -{ -return (u32 )p[0 ] | (u32 )p[1 ] <<8 | (u32 )p[2 ] <<16 ; -} -static inline bool nvmet_rdma_need_data_in (struct nvmet_rdma_rsp *rsp) { return nvme_is_write(rsp->req.cmd) &&
drivers/usb/gadget/function/storage_common.h +0 -5
@@ -172,11 +172,6 @@ enum data_direction {DATA_DIR_NONE }; -static inline u32 get_unaligned_be24 (u8 *buf) -{ -return 0xffffff & (u32 )get_unaligned_be32 (buf -1 ); -} -static inline struct fsg_lun *fsg_lun_from_dev (struct device *dev) { return container_of(dev, struct fsg_lun, dev);
include/asm-generic/unaligned.h +25 -0
@@ -33,4 +33,29 @@# error need to define endianess#endif +/* 24-bit unaligned access is special for now, that's why explicitly here */ +static inline u32 get_unaligned_le24 (const u8 *p) +{ +return (u32 )p[0 ] | (u32 )p[1 ] <<8 | (u32 )p[2 ] <<16 ; +} + +static inline void put_unaligned_le24 (const u32 val,u8 *p) +{ + *p++ = val; + *p++ = val >>8 ; + *p++ = val >>16 ; +} + +static inline u32 get_unaligned_be24 (const u8 *buf) +{ +return (u32 )p[0 ] <<16 | (u32 )p[1 ] <<8 | (u32 )p[2 ]; +} + +static inline void put_unaligned_be24 (const u32 val,u8 *p) +{ + *p++ = val >>16 ; + *p++ = val >>8 ; + *p++ = val; +} +#endif /* __ASM_GENERIC_UNALIGNED_H */
include/target/target_core_backend.h +0 -6
@@ -116,10 +116,4 @@ static inline bool target_dev_configured(struct se_device *se_dev) return !!(se_dev->dev_flags & DF_CONFIGURED); } -/* Only use get_unaligned_be24() if reading p - 1 is allowed. */ -static inline uint32_t get_unaligned_be24 (const uint8_t *const p) -{ -return get_unaligned_be32 (p -1 ) &0xffffffU ; -} -#endif /* TARGET_CORE_BACKEND_H */
Signature · 1 line
2.25.1
A message that is not in the archive (sent off-list or not yet received): 20200312113941.81162-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]
Greg Kroah-Hartman
Reviewed-byQuoted 8 lines · Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
--- drivers/nvme/host/rdma.c | 8 ------- drivers/nvme/target/rdma.c | 6 ----- drivers/usb/gadget/function/storage_common.h | 5 ----
For usb:
Quoted 2 lines · Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
I have a vague memory of Bart sending a patch like this a while ago, adding him to verify my theory.
Also is there any good to have this in asm-generic/ vs linux/?
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
I have a vague memory of Bart sending a patch like this a while ago, adding him to verify my theory.
Thanks!
Quoted 1 line
Also is there any good to have this in asm-generic/ vs linux/?
For now on it is least invasive. asm-generic/unaligned is a cross point for all unaligned accessor helpers, since we here do byteshift approach for all possible variants, I don't see any other header suitable. Or are you talking about something like linux/unaligned/24bit.h -> #include <...> here?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to a message not in the archiveinclude/asm-generic/unaligned.h line 52
Quoted 4 lines · Andy Shevchenko
include/asm-generic/unaligned.h +4
-0+static inline u32 get_unaligned_be24 (const u8 *buf) +{ +return (u32 )p[0 ] <<16 | (u32 )p[1 ] <<8 | (u32 )p[2 ]; +}
The argument is called 'buf' and the function body dereferences a pointer called 'p'. Does this even compile?
Bart.
Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to Andy ShevchenkoQuoted 2 lines · Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
Hi Andy,
Thanks for having done this work. In case you would not yet have noticed the patch series that I posted some time ago but for which I did not have the time to continue working on it, please take a look at
https://lore.kernel.org/lkml/[email protected]/.
Thanks,
Bart.
Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
Quoted 10 lines · Bart Van Assche
Quoted 2 lines · Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
Hi Andy,
Thanks for having done this work. In case you would not yet have noticed the patch series that I posted some time ago but for which I did not have the time to continue working on it, please take a look at
https://lore.kernel.org/lkml/[email protected]/.
Can you send a new version?
Also, consider to use byteshift to avoid this limitation:
"Only use get_unaligned_be24() if reading p - 1 is allowed."
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Bart Van Assche
Quoted 2 lines · Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24() implementation. Provide generic helpers once for all.
Hi Andy,
Thanks for having done this work. In case you would not yet have noticed the patch series that I posted some time ago but for which I did not have the time to continue working on it, please take a look at
https://lore.kernel.org/lkml/[email protected]/.
Quoted 4 lines
Can you send a new version?
Also, consider to use byteshift to avoid this limitation:
"Only useget_unaligned_be24()if reading p - 1 is allowed."
Sure, I will do that and I will also add you to the Cc-list of the patch series.
Thanks,
Bart.
A message that is not in the archive (sent off-list or not yet received): CAO+b5-rXUU9r-SrCWq2cYbBr5xFqyx4CUMb8xHZv2xYzEP6CyA@mail.gmail.com
Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
Bart,
Quoted 3 lines
Martin, can I send the second version of my patch series to you or do you perhaps prefer that I send it to another kernel maintainer? I'm considering to include the following patches:
Happy to take it.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
kbuild test robot
build botRe: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on balbi-usb/next]
[also build test ERROR on mkp-scsi/for-next linus/master asm-generic/master v5.6-rc5 next-20200312] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/asm-generic-Provide-generic-get-put-_unaligned_-l-b-e24/20200313-041815 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: microblaze-allmodconfig (attached as .config) compiler: microblaze-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
drivers/usb/gadget/function/f_mass_storage.c: In function 'do_read':
>> drivers/usb/gadget/function/f_mass_storage.c:635:9: error: implicit declaration of function 'get_unaligned_be24'; did you mean 'get_unaligned_be64'? [-Werror=implicit-function-declaration]
635 | lba = get_unaligned_be24(&common->cmnd[1]);
| ^~~~~~~~~~~~~~~~~~
| get_unaligned_be64cc1: some warnings being treated as errors
vim +635 drivers/usb/gadget/function/f_mass_storage.c
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 618
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 619 static int do_read(struct fsg_common *common)
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 620 {
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 621 struct fsg_lun *curlun = common->curlun;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 622 u32 lba;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 623 struct fsg_buffhd *bh;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 624 int rc;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 625 u32 amount_left;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 626 loff_t file_offset, file_offset_tmp;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 627 unsigned int amount;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 628 ssize_t nread;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 629
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 630 /*
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 631 * Get the starting Logical Block Address and check that it's
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 632 * not too big.
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 633 */
0a6a717ceff67f drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-07 634 if (common->cmnd[0] == READ_6)
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 @635 lba = get_unaligned_be24(&common->cmnd[1]);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 636 else {
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 637 lba = get_unaligned_be32(&common->cmnd[2]);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 638
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 639 /*
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 640 * We allow DPO (Disable Page Out = don't save data in the
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 641 * cache) and FUA (Force Unit Access = don't read from the
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 642 * cache), but we don't implement them.
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 643 */
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 644 if ((common->cmnd[1] & ~0x18) != 0) {
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 645 curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 646 return -EINVAL;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 647 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 648 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 649 if (lba >= curlun->num_sectors) {
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 650 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 651 return -EINVAL;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 652 }
3f565a363cee14 drivers/usb/gadget/f_mass_storage.c Peiyu Li 2011-08-17 653 file_offset = ((loff_t) lba) << curlun->blkbits;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 654
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 655 /* Carry out the file reads */
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 656 amount_left = common->data_size_from_cmnd;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 657 if (unlikely(amount_left == 0))
d26a6aa08b9f12 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 658 return -EIO; /* No default reply */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 659
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 660 for (;;) {
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 661 /*
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 662 * Figure out how much we need to read:
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 663 * Try to read the remaining amount.
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 664 * But don't read more than the buffer size.
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 665 * And don't try to read past the end of the file.
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 666 */
93bcf12e7123f2 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 667 amount = min(amount_left, FSG_BUFLEN);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 668 amount = min((loff_t)amount,
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 669 curlun->file_length - file_offset);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 670
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 671 /* Wait for the next buffer to become available */
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 672 bh = common->next_buffhd_to_fill;
225785aec726f3 drivers/usb/gadget/function/f_mass_storage.c Alan Stern 2017-04-13 673 rc = sleep_thread(common, false, bh);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 674 if (rc)
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 675 return rc;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 676
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 677 /*
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 678 * If we were asked to read past the end of file,
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 679 * end with an empty buffer.
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 680 */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 681 if (amount == 0) {
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 682 curlun->sense_data =
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 683 SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;
3f565a363cee14 drivers/usb/gadget/f_mass_storage.c Peiyu Li 2011-08-17 684 curlun->sense_data_info =
3f565a363cee14 drivers/usb/gadget/f_mass_storage.c Peiyu Li 2011-08-17 685 file_offset >> curlun->blkbits;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 686 curlun->info_valid = 1;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 687 bh->inreq->length = 0;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 688 bh->state = BUF_STATE_FULL;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 689 break;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 690 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 691
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 692 /* Perform the read */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 693 file_offset_tmp = file_offset;
05a4a33b6d82bc drivers/usb/gadget/function/f_mass_storage.c Christoph Hellwig 2017-09-01 694 nread = kernel_read(curlun->filp, bh->buf, amount,
05a4a33b6d82bc drivers/usb/gadget/function/f_mass_storage.c Christoph Hellwig 2017-09-01 695 &file_offset_tmp);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 696 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount,
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 697 (unsigned long long)file_offset, (int)nread);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 698 if (signal_pending(current))
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 699 return -EINTR;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 700
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 701 if (nread < 0) {
b73af61e328306 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 702 LDBG(curlun, "error in file read: %d\n", (int)nread);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 703 nread = 0;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 704 } else if (nread < amount) {
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 705 LDBG(curlun, "partial file read: %d/%u\n",
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 706 (int)nread, amount);
3f565a363cee14 drivers/usb/gadget/f_mass_storage.c Peiyu Li 2011-08-17 707 nread = round_down(nread, curlun->blksize);
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 708 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 709 file_offset += nread;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 710 amount_left -= nread;
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 711 common->residue -= nread;
04eee25b1d754a drivers/usb/gadget/f_mass_storage.c Alan Stern 2011-08-18 712
04eee25b1d754a drivers/usb/gadget/f_mass_storage.c Alan Stern 2011-08-18 713 /*
04eee25b1d754a drivers/usb/gadget/f_mass_storage.c Alan Stern 2011-08-18 714 * Except at the end of the transfer, nread will be
04eee25b1d754a drivers/usb/gadget/f_mass_storage.c Alan Stern 2011-08-18 715 * equal to the buffer size, which is divisible by the
04eee25b1d754a drivers/usb/gadget/f_mass_storage.c Alan Stern 2011-08-18 716 * bulk-in maxpacket size.
04eee25b1d754a drivers/usb/gadget/f_mass_storage.c Alan Stern 2011-08-18 717 */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 718 bh->inreq->length = nread;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 719 bh->state = BUF_STATE_FULL;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 720
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 721 /* If an error occurred, report it and its position */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 722 if (nread < amount) {
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 723 curlun->sense_data = SS_UNRECOVERED_READ_ERROR;
3f565a363cee14 drivers/usb/gadget/f_mass_storage.c Peiyu Li 2011-08-17 724 curlun->sense_data_info =
3f565a363cee14 drivers/usb/gadget/f_mass_storage.c Peiyu Li 2011-08-17 725 file_offset >> curlun->blkbits;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 726 curlun->info_valid = 1;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 727 break;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 728 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 729
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 730 if (amount_left == 0)
d26a6aa08b9f12 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 731 break; /* No more left to read */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 732
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 733 /* Send this buffer and go read some more */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 734 bh->inreq->zero = 0;
fe52f7922c446b drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 735 if (!start_in_transfer(common, bh))
fe52f7922c446b drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2010-10-28 736 /* Don't know what to do if common->fsg is NULL */
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 737 return -EIO;
8ea864cffdfd32 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 738 common->next_buffhd_to_fill = bh->next;
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 739 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 740
d26a6aa08b9f12 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-11-09 741 return -EIO; /* No default reply */
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 742 }
d5e2b67aae79f0 drivers/usb/gadget/f_mass_storage.c Michal Nazarewicz 2009-10-28 743 :::::: The code at line 635 was first introduced by commit
:::::: 8ea864cffdfd327117d4b7829935974b3f47ff31 USB: g_mass_storage: most data moved to fsg_common
:::::: TO: Michal Nazarewicz <[email protected]> :::::: CC: Greg Kroah-Hartman <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botRe: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on balbi-usb/next]
[also build test ERROR on mkp-scsi/for-next linus/master asm-generic/master v5.6-rc5 next-20200312] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/asm-generic-Provide-generic-get-put-_unaligned_-l-b-e24/20200313-041815 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: s390-randconfig-a001-20200312 (attached as .config) compiler: s390-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
In file included from ./arch/s390/include/generated/asm/unaligned.h:1,
from lib/decompress_unlz4.c:19:
include/asm-generic/unaligned.h: In function 'get_unaligned_be24':
>> include/asm-generic/unaligned.h:51:14: error: 'p' undeclared (first use in this function); did you mean 'up'?
51 | return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
| ^
| up
include/asm-generic/unaligned.h:51:14: note: each undeclared identifier is reported only once for each function it appears in
--
In file included from ./arch/s390/include/generated/asm/unaligned.h:1,
from lib/sha1.c:13:
include/asm-generic/unaligned.h: In function 'get_unaligned_be24':
>> include/asm-generic/unaligned.h:51:14: error: 'p' undeclared (first use in this function)
51 | return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
| ^ include/asm-generic/unaligned.h:51:14: note: each undeclared identifier is reported only once for each function it appears in
vim +/p +51 include/asm-generic/unaligned.h
48
49 static inline u32 get_unaligned_be24(const u8 *buf)
50 {
> 51 return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
52 }
53 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
kbuild test robot
build botRe: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on balbi-usb/next]
[also build test ERROR on mkp-scsi/for-next linus/master v5.6-rc5 next-20200312] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/asm-generic-Provide-generic-get-put-_unaligned_-l-b-e24/20200313-041815 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: arc-randconfig-a001-20200312 (attached as .config) compiler: arc-elf-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
In file included from arch/arc/include/asm/unaligned.h:11,
from arch/arc/include/asm/io.h:12,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:13,
from ./arch/arc/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:9,
from include/linux/interrupt.h:11,
from arch/arc/kernel/asm-offsets.c:8:
include/asm-generic/unaligned.h: In function 'get_unaligned_be24':
>> include/asm-generic/unaligned.h:51:14: error: 'p' undeclared (first use in this function); did you mean 'up'?
51 | return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
| ^
| up include/asm-generic/unaligned.h:51:14: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [scripts/Makefile.build:101: arch/arc/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1112: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:179: sub-make] Error 2
14 real 3 user 7 sys 75.72% cpu make prepare
vim +51 include/asm-generic/unaligned.h
48
49 static inline u32 get_unaligned_be24(const u8 *buf)
50 {
> 51 return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
52 }
53 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
kbuild test robot
build botRe: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to Andy ShevchenkoI love your patch! Perhaps something to improve:
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on balbi-usb/next]
[also build test WARNING on mkp-scsi/for-next linus/master v5.6-rc5 next-20200312] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/asm-generic-Provide-generic-get-put-_unaligned_-l-b-e24/20200313-041815 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: nios2-randconfig-a001-20200312 (attached as .config) compiler: nios2-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
In file included from ./arch/nios2/include/generated/asm/unaligned.h:1,
from drivers/target/target_core_pscsi.c:24:
include/asm-generic/unaligned.h: In function 'get_unaligned_be24':
include/asm-generic/unaligned.h:51:14: error: 'p' undeclared (first use in this function); did you mean 'up'?
51 | return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
| ^
| up
include/asm-generic/unaligned.h:51:14: note: each undeclared identifier is reported only once for each function it appears in
>> include/asm-generic/unaligned.h:52:1: warning: control reaches end of non-void function [-Wreturn-type]
52 | }
| ^--
In file included from ./arch/nios2/include/generated/asm/unaligned.h:1,
from drivers/target/target_core_xcopy.c:21:
include/asm-generic/unaligned.h: In function 'get_unaligned_be24':
include/asm-generic/unaligned.h:51:14: error: 'p' undeclared (first use in this function)
51 | return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
| ^
include/asm-generic/unaligned.h:51:14: note: each undeclared identifier is reported only once for each function it appears in
>> include/asm-generic/unaligned.h:52:1: warning: control reaches end of non-void function [-Wreturn-type]
52 | }
| ^vim +52 include/asm-generic/unaligned.h
48
49 static inline u32 get_unaligned_be24(const u8 *buf)
50 {
51 return (u32)p[0] << 16 | (u32)p[1] << 8 | (u32)p[2];
> 52 }
53 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botRe: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on balbi-usb/next]
[also build test ERROR on mkp-scsi/for-next linus/master v5.6-rc5 next-20200312] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/asm-generic-Provide-generic-get-put-_unaligned_-l-b-e24/20200313-041815 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: openrisc-randconfig-a001-20200312 (attached as .config) compiler: or1k-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
drivers//target/target_core_sbc.c: In function 'transport_lba_21':
>> drivers//target/target_core_sbc.c:260:9: error: implicit declaration of function 'get_unaligned_be24'; did you mean 'get_unaligned_be64'? [-Werror=implicit-function-declaration]
260 | return get_unaligned_be24(&cdb[1]) & 0x1fffff;
| ^~~~~~~~~~~~~~~~~~
| get_unaligned_be64
cc1: some warnings being treated as errors
--
drivers//target/target_core_spc.c: In function 'spc_parse_cdb':
>> drivers//target/target_core_spc.c:1375:11: error: implicit declaration of function 'get_unaligned_be24'; did you mean 'get_unaligned_be64'? [-Werror=implicit-function-declaration]
1375 | *size = get_unaligned_be24(&cdb[6]);
| ^~~~~~~~~~~~~~~~~~
| get_unaligned_be64
cc1: some warnings being treated as errors
--
drivers//target/target_core_xcopy.c: In function 'target_xcopy_parse_segdesc_02':
>> drivers//target/target_core_xcopy.c:319:14: error: implicit declaration of function 'get_unaligned_be24'; did you mean 'get_unaligned_be64'? [-Werror=implicit-function-declaration]
319 | xop->dbl = get_unaligned_be24(&desc[29]);
| ^~~~~~~~~~~~~~~~~~
| get_unaligned_be64
cc1: some warnings being treated as errors
--
drivers//target/target_core_pscsi.c: In function 'pscsi_tape_read_blocksize':
>> drivers//target/target_core_pscsi.c:158:22: error: implicit declaration of function 'get_unaligned_be24'; did you mean 'get_unaligned_be64'? [-Werror=implicit-function-declaration]
158 | sdev->sector_size = get_unaligned_be24(&buf[9]);
| ^~~~~~~~~~~~~~~~~~
| get_unaligned_be64cc1: some warnings being treated as errors
vim +260 drivers//target/target_core_sbc.c
d6e0175cf3f973 Christoph Hellwig 2012-05-20 257
d6e0175cf3f973 Christoph Hellwig 2012-05-20 258 static inline u32 transport_lba_21(unsigned char *cdb)
d6e0175cf3f973 Christoph Hellwig 2012-05-20 259 {a85d667e58bddf Bart Van Assche 2017-05-23 @260 return get_unaligned_be24(&cdb[1]) & 0x1fffff;d6e0175cf3f973 Christoph Hellwig 2012-05-20 261 } d6e0175cf3f973 Christoph Hellwig 2012-05-20 262
:::::: The code at line 260 was first introduced by commit
:::::: a85d667e58bddf73be84d1981b41eaac985ed216 target: Use {get,put}_unaligned_be*() instead of open coding these functions
:::::: TO: Bart Van Assche <[email protected]> :::::: CC: Nicholas Bellinger <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org