USB: storage: Notify the subdrivers that they need to reinitialize the device.
Subsystems (2)
PATCH 1/1 USB: storage: Notify the subdrivers that they need to reinitialize the device.
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.
--- drivers/usb/storage/usb.c | 16 ++++++++-------- drivers/usb/storage/usb.h | 8 +++++--- 2 files changed, 13 insertions(+), 11 deletions(-)
drivers/usb/storage/usb.c +8 -8
@@ -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 ;
drivers/usb/storage/usb.h +5 -3
@@ -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 */
--
Alan Stern
maintainerQuoted 5 lines · Mikhail Zaytsev
This patch adds the
device_reinitfunction into theus_datastructure. The usb-storage driver uses this function for notify the subdrivers that
they need to reinitialize the device.Signed-off-by Mikhail Zaytsev <[email protected]>
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
Quoted 68 lines
--- drivers/usb/storage/usb.c | 16 ++++++++-------- drivers/usb/storage/usb.h | 8 +++++--- 2 files changed, 13 insertions(+), 11 deletions(-)drivers/usb/storage/usb.c +8
-8@@ -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 ;drivers/usb/storage/usb.h +5
-4@@ -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 */ --
Quoted 6 lines · On Wed, 29 Nov 2017 Alan Stern <[email protected]> wrote:
Quoted 4 lines · Mikhail Zaytsev
This patch adds the
device_reinitfunction into theus_datastructure. The usb-storage driver uses this function for notify the subdrivers that they need to reinitialize the device.
Quoted 7 lines
Quoted 1 line
Signed-off-by Mikhail Zaytsev <[email protected]>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
Alan Stern
maintainerQuoted 10 lines · Mikhail Zaytsev
Quoted 8 lines · On Wed, 29 Nov 2017 Alan Stern <[email protected]> wrote:
Quoted 5 lines · Mikhail Zaytsev
This patch adds the
device_reinitfunction into theus_datastructure. The usb-storage driver uses this function for notify the subdrivers that they need to reinitialize the device.Signed-off-by Mikhail Zaytsev <[email protected]>
Quoted 7 lines
Quoted 5 lines
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
PATCH 1/1 USB: storage: Remove obsolete "FIXME"
The fix of "FIXME: Notify the subdrivers..." doesn't actually have any
real effect. The "FIXME" changed to simple comment.
--- drivers/usb/storage/usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/storage/usb.c +4 -4
@@ -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);
Signature · 1 line
2.1.4
Re: [PATCH v1] USB: storage: Remove obsolete "FIXME"
Quoted 24 lines · Mikhail Zaytsev
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 <[email protected]>--- drivers/usb/storage/usb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/usb/storage/usb.c +2
-2@@ -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 ; }
drivers/usb/storage/usb.c int usb_stor_post_reset(struct usb_interface *iface) · line 250
Quoted 10 lines
drivers/usb/storage/usb.c +2
-2@@ -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);