* [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device.
@ 2017-11-29 9:46 Mikhail Zaytsev
2017-11-29 15:42 ` Alan Stern
0 siblings, 1 reply; 6+ messages in thread
From: Mikhail Zaytsev @ 2017-11-29 9:46 UTC (permalink / raw)
To: Alan Stern, Greg Kroah-Hartman; +Cc: linux-usb, usb-storage, linux-kernel
This patch adds the device_reinit function into the us_data structure.
The usb-storage driver uses this function for notify the subdrivers that
they need to reinitialize the device.
Signed-off-by: Mikhail Zaytsev <flashed@mail.ru>
---
drivers/usb/storage/usb.c | 16 ++++++++--------
drivers/usb/storage/usb.h | 8 +++++---
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index a0c07e05a8f1..60c47b2e877d 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -210,10 +210,10 @@ int usb_stor_reset_resume(struct usb_interface *iface)
/* Report the reset to the SCSI core */
usb_stor_report_bus_reset(us);
- /*
- * FIXME: Notify the subdrivers that they need to reinitialize
- * the device
- */
+ if (us->device_reinit) {
+ usb_stor_dbg(us, "-- calling device_reinit()\n");
+ us->device_reinit(us);
+ }
return 0;
}
EXPORT_SYMBOL_GPL(usb_stor_reset_resume);
@@ -242,10 +242,10 @@ int usb_stor_post_reset(struct usb_interface *iface)
/* Report the reset to the SCSI core */
usb_stor_report_bus_reset(us);
- /*
- * FIXME: Notify the subdrivers that they need to reinitialize
- * the device
- */
+ if (us->device_reinit) {
+ usb_stor_dbg(us, "-- calling device_reinit()\n");
+ us->device_reinit(us);
+ }
mutex_unlock(&us->dev_mutex);
return 0;
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 90133e16bec5..c646a0464a51 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -77,9 +77,10 @@ struct us_unusual_dev {
#define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */
#define US_SENSE_SIZE 18 /* Size of the autosense data buffer */
-typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*);
-typedef int (*trans_reset)(struct us_data*);
-typedef void (*proto_cmnd)(struct scsi_cmnd*, struct us_data*);
+typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data *);
+typedef int (*trans_reset)(struct us_data *);
+typedef int (*dev_reinit)(struct us_data *);
+typedef void (*proto_cmnd)(struct scsi_cmnd *, struct us_data *);
typedef void (*extra_data_destructor)(void *); /* extra data destructor */
typedef void (*pm_hook)(struct us_data *, int); /* power management hook */
@@ -119,6 +120,7 @@ struct us_data {
/* function pointers for this device */
trans_cmnd transport; /* transport function */
trans_reset transport_reset; /* transport device reset */
+ dev_reinit device_reinit; /* device reinitialize */
proto_cmnd proto_handler; /* protocol handler */
/* SCSI interfaces */
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device.
2017-11-29 9:46 [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device Mikhail Zaytsev
@ 2017-11-29 15:42 ` Alan Stern
2017-11-29 21:03 ` Mikhail Zaytsev
0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2017-11-29 15:42 UTC (permalink / raw)
To: Mikhail Zaytsev; +Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel
On Wed, 29 Nov 2017, Mikhail Zaytsev wrote:
> This patch adds the device_reinit function into the us_data structure.
> The usb-storage driver uses this function for notify the subdrivers that
> they need to reinitialize the device.
>
> Signed-off-by: Mikhail Zaytsev <flashed@mail.ru>
I'd feel more inclined to accept this patch if the new code got used
somewhere. As it is, it fixes a "problem" that doesn't actually have
any real effect.
Alan Stern
> ---
> drivers/usb/storage/usb.c | 16 ++++++++--------
> drivers/usb/storage/usb.h | 8 +++++---
> 2 files changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index a0c07e05a8f1..60c47b2e877d 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -210,10 +210,10 @@ int usb_stor_reset_resume(struct usb_interface *iface)
> /* Report the reset to the SCSI core */
> usb_stor_report_bus_reset(us);
>
> - /*
> - * FIXME: Notify the subdrivers that they need to reinitialize
> - * the device
> - */
> + if (us->device_reinit) {
> + usb_stor_dbg(us, "-- calling device_reinit()\n");
> + us->device_reinit(us);
> + }
> return 0;
> }
> EXPORT_SYMBOL_GPL(usb_stor_reset_resume);
> @@ -242,10 +242,10 @@ int usb_stor_post_reset(struct usb_interface *iface)
> /* Report the reset to the SCSI core */
> usb_stor_report_bus_reset(us);
>
> - /*
> - * FIXME: Notify the subdrivers that they need to reinitialize
> - * the device
> - */
> + if (us->device_reinit) {
> + usb_stor_dbg(us, "-- calling device_reinit()\n");
> + us->device_reinit(us);
> + }
>
> mutex_unlock(&us->dev_mutex);
> return 0;
> diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
> index 90133e16bec5..c646a0464a51 100644
> --- a/drivers/usb/storage/usb.h
> +++ b/drivers/usb/storage/usb.h
> @@ -77,9 +77,10 @@ struct us_unusual_dev {
> #define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */
> #define US_SENSE_SIZE 18 /* Size of the autosense data buffer */
>
> -typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*);
> -typedef int (*trans_reset)(struct us_data*);
> -typedef void (*proto_cmnd)(struct scsi_cmnd*, struct us_data*);
> +typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data *);
> +typedef int (*trans_reset)(struct us_data *);
> +typedef int (*dev_reinit)(struct us_data *);
> +typedef void (*proto_cmnd)(struct scsi_cmnd *, struct us_data *);
> typedef void (*extra_data_destructor)(void *); /* extra data destructor */
> typedef void (*pm_hook)(struct us_data *, int); /* power management hook */
>
> @@ -119,6 +120,7 @@ struct us_data {
> /* function pointers for this device */
> trans_cmnd transport; /* transport function */
> trans_reset transport_reset; /* transport device reset */
> + dev_reinit device_reinit; /* device reinitialize */
> proto_cmnd proto_handler; /* protocol handler */
>
> /* SCSI interfaces */
> --
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device.
2017-11-29 15:42 ` Alan Stern
@ 2017-11-29 21:03 ` Mikhail Zaytsev
2017-11-29 21:11 ` Alan Stern
0 siblings, 1 reply; 6+ messages in thread
From: Mikhail Zaytsev @ 2017-11-29 21:03 UTC (permalink / raw)
To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel
On Wed, 29 Nov 2017 Alan Stern <stern@rowland.harvard.edu> wrote:
> On Wed, 29 Nov 2017, Mikhail Zaytsev wrote:
>
> > This patch adds the device_reinit function into the us_data
> > structure. The usb-storage driver uses this function for notify the
> > subdrivers that they need to reinitialize the device.
> >
> > Signed-off-by: Mikhail Zaytsev <flashed@mail.ru>
>
> I'd feel more inclined to accept this patch if the new code got used
> somewhere. As it is, it fixes a "problem" that doesn't actually have
> any real effect.
>
> Alan Stern
I propose to delete this FIXME comments without any code changes.
Regards, Mikhail
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device.
2017-11-29 21:03 ` Mikhail Zaytsev
@ 2017-11-29 21:11 ` Alan Stern
2017-11-30 8:54 ` [PATCH v1] USB: storage: Remove obsolete "FIXME" Mikhail Zaytsev
0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2017-11-29 21:11 UTC (permalink / raw)
To: Mikhail Zaytsev; +Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel
On Thu, 30 Nov 2017, Mikhail Zaytsev wrote:
> On Wed, 29 Nov 2017 Alan Stern <stern@rowland.harvard.edu> wrote:
>
> > On Wed, 29 Nov 2017, Mikhail Zaytsev wrote:
> >
> > > This patch adds the device_reinit function into the us_data
> > > structure. The usb-storage driver uses this function for notify the
> > > subdrivers that they need to reinitialize the device.
> > >
> > > Signed-off-by: Mikhail Zaytsev <flashed@mail.ru>
> >
> > I'd feel more inclined to accept this patch if the new code got used
> > somewhere. As it is, it fixes a "problem" that doesn't actually have
> > any real effect.
> >
> > Alan Stern
>
> I propose to delete this FIXME comments without any code changes.
Okay. You could leave a comment saying that if any of the subdrivers
implemented a reinitialization scheme, this is where the callback would
be invoked.
Alan Stern
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1] USB: storage: Remove obsolete "FIXME"
2017-11-29 21:11 ` Alan Stern
@ 2017-11-30 8:54 ` Mikhail Zaytsev
2017-11-30 15:57 ` Alan Stern
0 siblings, 1 reply; 6+ messages in thread
From: Mikhail Zaytsev @ 2017-11-30 8:54 UTC (permalink / raw)
To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel
The fix of "FIXME: Notify the subdrivers..." doesn't actually have any
real effect. The "FIXME" changed to simple comment.
Signed-off-by: Mikhail Zaytsev <flashed@mail.ru>
---
drivers/usb/storage/usb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index a0c07e0..3eb9347 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -211,8 +211,8 @@ int usb_stor_reset_resume(struct usb_interface *iface)
usb_stor_report_bus_reset(us);
/*
- * FIXME: Notify the subdrivers that they need to reinitialize
- * the device
+ * If any of the subdrivers implemented a reinitialization scheme,
+ * this is where the callback would be invoked.
*/
return 0;
}
@@ -243,8 +243,8 @@ int usb_stor_post_reset(struct usb_interface *iface)
usb_stor_report_bus_reset(us);
/*
- * FIXME: Notify the subdrivers that they need to reinitialize
- * the device
+ * If any of the subdrivers implemented a reinitialization scheme,
+ * this is where the callback would be invoked.
*/
mutex_unlock(&us->dev_mutex);
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] USB: storage: Remove obsolete "FIXME"
2017-11-30 8:54 ` [PATCH v1] USB: storage: Remove obsolete "FIXME" Mikhail Zaytsev
@ 2017-11-30 15:57 ` Alan Stern
0 siblings, 0 replies; 6+ messages in thread
From: Alan Stern @ 2017-11-30 15:57 UTC (permalink / raw)
To: Mikhail Zaytsev; +Cc: Greg Kroah-Hartman, linux-usb, usb-storage, linux-kernel
On Thu, 30 Nov 2017, Mikhail Zaytsev wrote:
> The fix of "FIXME: Notify the subdrivers..." doesn't actually have any
> real effect. The "FIXME" changed to simple comment.
>
> Signed-off-by: Mikhail Zaytsev <flashed@mail.ru>
> ---
> drivers/usb/storage/usb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index a0c07e0..3eb9347 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -211,8 +211,8 @@ int usb_stor_reset_resume(struct usb_interface *iface)
> usb_stor_report_bus_reset(us);
>
> /*
> - * FIXME: Notify the subdrivers that they need to reinitialize
> - * the device
> + * If any of the subdrivers implemented a reinitialization scheme,
> + * this is where the callback would be invoked.
> */
> return 0;
> }
> @@ -243,8 +243,8 @@ int usb_stor_post_reset(struct usb_interface *iface)
> usb_stor_report_bus_reset(us);
>
> /*
> - * FIXME: Notify the subdrivers that they need to reinitialize
> - * the device
> + * If any of the subdrivers implemented a reinitialization scheme,
> + * this is where the callback would be invoked.
> */
>
> mutex_unlock(&us->dev_mutex);
Acked-by: Alan Stern <stern@rowland.harvard.edu>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-30 15:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 9:46 [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device Mikhail Zaytsev
2017-11-29 15:42 ` Alan Stern
2017-11-29 21:03 ` Mikhail Zaytsev
2017-11-29 21:11 ` Alan Stern
2017-11-30 8:54 ` [PATCH v1] USB: storage: Remove obsolete "FIXME" Mikhail Zaytsev
2017-11-30 15:57 ` Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).