* [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 11:39 ` Andy Shevchenko
0 siblings, 0 replies; 27+ messages in thread
From: Andy Shevchenko @ 2020-03-12 11:39 UTC (permalink / raw)
To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme, Felipe Balbi, Greg Kroah-Hartman,
linux-usb, Martin K. Petersen, linux-scsi, Arnd Bergmann,
linux-arch
Cc: Andy Shevchenko
There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24()
implementation. Provide generic helpers once for all.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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(-)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 3e85c5cacefd..2845118e6e40 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -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;
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 37d262a65877..8fcede75e02a 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -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) &&
diff --git a/drivers/usb/gadget/function/storage_common.h b/drivers/usb/gadget/function/storage_common.h
index e5e3a2553aaa..bdeb1e233fc9 100644
--- a/drivers/usb/gadget/function/storage_common.h
+++ b/drivers/usb/gadget/function/storage_common.h
@@ -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);
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 374c940e9be1..dd9f9695d1ba 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -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 */
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 51b6f50eabee..1b752d8ea529 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -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 */
--
2.25.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 27+ messages in thread[parent not found: <20200312113941.81162-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>]
* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 12:06 ` Greg Kroah-Hartman
0 siblings, 0 replies; 27+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-12 12:06 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
Felipe Balbi, linux-usb-u79uwXL29TY76Z2rM5mHXA,
Martin K. Petersen, linux-scsi-u79uwXL29TY76Z2rM5mHXA,
Arnd Bergmann, linux-arch-u79uwXL29TY76Z2rM5mHXA
On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24()
> implementation. Provide generic helpers once for all.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> drivers/nvme/host/rdma.c | 8 -------
> drivers/nvme/target/rdma.c | 6 -----
> drivers/usb/gadget/function/storage_common.h | 5 ----
For usb:
Reviewed-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 12:06 ` Greg Kroah-Hartman
0 siblings, 0 replies; 27+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-12 12:06 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-arch, Felipe Balbi, Sagi Grimberg, Chaitanya Kulkarni,
linux-usb, linux-nvme, Jens Axboe, Arnd Bergmann,
Martin K. Petersen, Keith Busch, linux-scsi, Christoph Hellwig
On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24()
> implementation. Provide generic helpers once for all.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/nvme/host/rdma.c | 8 -------
> drivers/nvme/target/rdma.c | 6 -----
> drivers/usb/gadget/function/storage_common.h | 5 ----
For usb:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 12:06 ` Greg Kroah-Hartman
0 siblings, 0 replies; 27+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-12 12:06 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme, Felipe Balbi, linux-usb,
Martin K. Petersen, linux-scsi, Arnd Bergmann, linux-arch
On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> There are users in kernel that duplicate {get,put}_unaligned_{l,b}e24()
> implementation. Provide generic helpers once for all.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/nvme/host/rdma.c | 8 -------
> drivers/nvme/target/rdma.c | 6 -----
> drivers/usb/gadget/function/storage_common.h | 5 ----
For usb:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 14:05 ` Christoph Hellwig
0 siblings, 0 replies; 27+ messages in thread
From: Christoph Hellwig @ 2020-03-12 14:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
Felipe Balbi, Greg Kroah-Hartman,
linux-usb-u79uwXL29TY76Z2rM5mHXA, Martin K. Petersen,
linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
linux-arch-u79uwXL29TY76Z2rM5mHXA, bvanassche-HInyCGIudOg
On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> 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/?
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 14:05 ` Christoph Hellwig
0 siblings, 0 replies; 27+ messages in thread
From: Christoph Hellwig @ 2020-03-12 14:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-arch, Felipe Balbi, Sagi Grimberg, Chaitanya Kulkarni,
Greg Kroah-Hartman, linux-usb, linux-nvme, Jens Axboe,
Arnd Bergmann, Martin K. Petersen, Keith Busch, linux-scsi,
Christoph Hellwig, bvanassche
On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> 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/?
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 14:05 ` Christoph Hellwig
0 siblings, 0 replies; 27+ messages in thread
From: Christoph Hellwig @ 2020-03-12 14:05 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme, Felipe Balbi, Greg Kroah-Hartman,
linux-usb, Martin K. Petersen, linux-scsi, Arnd Bergmann,
linux-arch, bvanassche
On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> 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/?
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
2020-03-12 14:05 ` Christoph Hellwig
@ 2020-03-12 14:43 ` Andy Shevchenko
-1 siblings, 0 replies; 27+ messages in thread
From: Andy Shevchenko @ 2020-03-12 14:43 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Keith Busch, Jens Axboe, Sagi Grimberg, Chaitanya Kulkarni,
linux-nvme, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
Martin K. Petersen, linux-scsi, Arnd Bergmann, linux-arch,
bvanassche
On Thu, Mar 12, 2020 at 03:05:42PM +0100, Christoph Hellwig wrote:
> On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> > 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!
> 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?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get,put}_unaligned_{l,b}e24()
@ 2020-03-12 14:43 ` Andy Shevchenko
0 siblings, 0 replies; 27+ messages in thread
From: Andy Shevchenko @ 2020-03-12 14:43 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-arch, Felipe Balbi, Sagi Grimberg, Chaitanya Kulkarni,
Greg Kroah-Hartman, linux-usb, linux-nvme, Jens Axboe,
Arnd Bergmann, Martin K. Petersen, Keith Busch, linux-scsi,
bvanassche
On Thu, Mar 12, 2020 at 03:05:42PM +0100, Christoph Hellwig wrote:
> On Thu, Mar 12, 2020 at 01:39:41PM +0200, Andy Shevchenko wrote:
> > 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!
> 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?
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 15:21 ` Bart Van Assche
0 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 15:21 UTC (permalink / raw)
To: Andy Shevchenko, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni,
linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Felipe Balbi,
Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
Martin K. Petersen, linux-scsi-u79uwXL29TY76Z2rM5mHXA,
Arnd Bergmann, linux-arch-u79uwXL29TY76Z2rM5mHXA
On 2020-03-12 04:39, Andy Shevchenko wrote:
> +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.
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 15:21 ` Bart Van Assche
0 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 15:21 UTC (permalink / raw)
To: Andy Shevchenko, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, Felipe Balbi,
Greg Kroah-Hartman, linux-usb, Martin K. Petersen, linux-scsi,
Arnd Bergmann, linux-arch
On 2020-03-12 04:39, Andy Shevchenko wrote:
> +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.
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 15:21 ` Bart Van Assche
0 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 15:21 UTC (permalink / raw)
To: Andy Shevchenko, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, Felipe Balbi,
Greg Kroah-Hartman, linux-usb, Martin K. Petersen, linux-scsi,
Arnd Bergmann, linux-arch
On 2020-03-12 04:39, Andy Shevchenko wrote:
> +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.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 11:39 ` [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24() Andy Shevchenko
@ 2020-03-12 15:18 ` Bart Van Assche
-1 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 15:18 UTC (permalink / raw)
To: Andy Shevchenko, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, Felipe Balbi,
Greg Kroah-Hartman, linux-usb, Martin K. Petersen, linux-scsi,
Arnd Bergmann, linux-arch
On 2020-03-12 04:39, Andy Shevchenko wrote:
> 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/20191028200700.213753-1-bvanassche@acm.org/.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 15:18 ` Bart Van Assche
0 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 15:18 UTC (permalink / raw)
To: Andy Shevchenko, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni, linux-nvme, Felipe Balbi,
Greg Kroah-Hartman, linux-usb, Martin K. Petersen, linux-scsi,
Arnd Bergmann, linux-arch
On 2020-03-12 04:39, Andy Shevchenko wrote:
> 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/20191028200700.213753-1-bvanassche@acm.org/.
Thanks,
Bart.
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 15:18 ` Bart Van Assche
@ 2020-03-12 16:25 ` Andy Shevchenko
-1 siblings, 0 replies; 27+ messages in thread
From: Andy Shevchenko @ 2020-03-12 16:25 UTC (permalink / raw)
To: Bart Van Assche
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme, Felipe Balbi, Greg Kroah-Hartman,
linux-usb, Martin K. Petersen, linux-scsi, Arnd Bergmann,
linux-arch
On Thu, Mar 12, 2020 at 08:18:07AM -0700, Bart Van Assche wrote:
> On 2020-03-12 04:39, Andy Shevchenko wrote:
> > 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/20191028200700.213753-1-bvanassche@acm.org/.
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."
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 16:25 ` Andy Shevchenko
0 siblings, 0 replies; 27+ messages in thread
From: Andy Shevchenko @ 2020-03-12 16:25 UTC (permalink / raw)
To: Bart Van Assche
Cc: linux-arch, Felipe Balbi, Sagi Grimberg, Chaitanya Kulkarni,
Greg Kroah-Hartman, linux-usb, linux-nvme, Jens Axboe,
Arnd Bergmann, Martin K. Petersen, Keith Busch, linux-scsi,
Christoph Hellwig
On Thu, Mar 12, 2020 at 08:18:07AM -0700, Bart Van Assche wrote:
> On 2020-03-12 04:39, Andy Shevchenko wrote:
> > 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/20191028200700.213753-1-bvanassche@acm.org/.
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."
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 16:25 ` Andy Shevchenko
@ 2020-03-12 18:50 ` Bart Van Assche
-1 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 18:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
Chaitanya Kulkarni, linux-nvme, Felipe Balbi, Greg Kroah-Hartman,
linux-usb, Martin K. Petersen, linux-scsi, Arnd Bergmann,
linux-arch
On 3/12/20 9:25 AM, Andy Shevchenko wrote:
> On Thu, Mar 12, 2020 at 08:18:07AM -0700, Bart Van Assche wrote:
>> On 2020-03-12 04:39, Andy Shevchenko wrote:
>>> 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/20191028200700.213753-1-bvanassche@acm.org/.
>
> 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."
Sure, I will do that and I will also add you to the Cc-list of the patch
series.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-12 18:50 ` Bart Van Assche
0 siblings, 0 replies; 27+ messages in thread
From: Bart Van Assche @ 2020-03-12 18:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-arch, Felipe Balbi, Sagi Grimberg, Chaitanya Kulkarni,
Greg Kroah-Hartman, linux-usb, linux-nvme, Jens Axboe,
Arnd Bergmann, Martin K. Petersen, Keith Busch, linux-scsi,
Christoph Hellwig
On 3/12/20 9:25 AM, Andy Shevchenko wrote:
> On Thu, Mar 12, 2020 at 08:18:07AM -0700, Bart Van Assche wrote:
>> On 2020-03-12 04:39, Andy Shevchenko wrote:
>>> 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/20191028200700.213753-1-bvanassche@acm.org/.
>
> 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."
Sure, I will do that and I will also add you to the Cc-list of the patch
series.
Thanks,
Bart.
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread[parent not found: <CAO+b5-rXUU9r-SrCWq2cYbBr5xFqyx4CUMb8xHZv2xYzEP6CyA@mail.gmail.com>]
* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
[not found] ` <CAO+b5-rXUU9r-SrCWq2cYbBr5xFqyx4CUMb8xHZv2xYzEP6CyA@mail.gmail.com>
2020-03-13 0:38 ` Martin K. Petersen
@ 2020-03-13 0:38 ` Martin K. Petersen
0 siblings, 0 replies; 27+ messages in thread
From: Martin K. Petersen @ 2020-03-13 0:38 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K. Petersen, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni,
linux-nvme @ lists . infradead . org, Felipe Balbi,
Greg Kroah-Hartman, USB list, Linux SCSI Mailinglist,
Arnd Bergmann, linux-arch, Andy Shevchenko
Bart,
> 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.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-13 0:38 ` Martin K. Petersen
0 siblings, 0 replies; 27+ messages in thread
From: Martin K. Petersen @ 2020-03-13 0:38 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K. Petersen, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg, Chaitanya Kulkarni,
linux-nvme @ lists . infradead . org, Felipe Balbi,
Greg Kroah-Hartman, USB list, Linux SCSI Mailinglist,
Arnd Bergmann, linux-arch, Andy Shevchenko
Bart,
> 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.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
@ 2020-03-13 0:38 ` Martin K. Petersen
0 siblings, 0 replies; 27+ messages in thread
From: Martin K. Petersen @ 2020-03-13 0:38 UTC (permalink / raw)
To: Bart Van Assche
Cc: linux-arch, Felipe Balbi, Martin K. Petersen, Chaitanya Kulkarni,
Greg Kroah-Hartman, USB list,
linux-nvme @ lists . infradead . org, Jens Axboe, Arnd Bergmann,
Linux SCSI Mailinglist, Keith Busch, Andy Shevchenko,
Christoph Hellwig, Sagi Grimberg
Bart,
> 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.
--
Martin K. Petersen Oracle Linux Engineering
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 11:39 ` [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24() Andy Shevchenko
` (2 preceding siblings ...)
(?)
@ 2020-03-12 22:11 ` kbuild test robot
-1 siblings, 0 replies; 27+ messages in thread
From: kbuild test robot @ 2020-03-12 22:11 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 17452 bytes --]
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
Reported-by: kbuild test robot <lkp@intel.com>
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_be64
cc1: 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 <m.nazarewicz@samsung.com>
:::::: CC: Greg Kroah-Hartman <gregkh@suse.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 61322 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 11:39 ` [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24() Andy Shevchenko
` (3 preceding siblings ...)
(?)
@ 2020-03-12 22:41 ` kbuild test robot
-1 siblings, 0 replies; 27+ messages in thread
From: kbuild test robot @ 2020-03-12 22:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2560 bytes --]
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
Reported-by: kbuild test robot <lkp@intel.com>
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/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23695 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 11:39 ` [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24() Andy Shevchenko
` (4 preceding siblings ...)
(?)
@ 2020-03-12 23:07 ` kbuild test robot
-1 siblings, 0 replies; 27+ messages in thread
From: kbuild test robot @ 2020-03-12 23:07 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2770 bytes --]
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
Reported-by: kbuild test robot <lkp@intel.com>
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/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25842 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 11:39 ` [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24() Andy Shevchenko
` (5 preceding siblings ...)
(?)
@ 2020-03-12 23:10 ` kbuild test robot
-1 siblings, 0 replies; 27+ messages in thread
From: kbuild test robot @ 2020-03-12 23:10 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2862 bytes --]
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
Reported-by: kbuild test robot <lkp@intel.com>
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
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25674 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread* Re: [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24()
2020-03-12 11:39 ` [PATCH v1] asm-generic: Provide generic {get, put}_unaligned_{l, b}e24() Andy Shevchenko
` (6 preceding siblings ...)
(?)
@ 2020-03-12 23:49 ` kbuild test robot
-1 siblings, 0 replies; 27+ messages in thread
From: kbuild test robot @ 2020-03-12 23:49 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3857 bytes --]
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
Reported-by: kbuild test robot <lkp@intel.com>
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_be64
cc1: 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 <bart.vanassche@sandisk.com>
:::::: CC: Nicholas Bellinger <nab@linux-iscsi.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26570 bytes --]
^ permalink raw reply [flat|nested] 27+ messages in thread