Received: by 10.223.164.202 with SMTP id h10csp4700020wrb; Wed, 29 Nov 2017 10:22:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMbe5xe0Xep8GrAKtUNcGm/mLvHYdSnEOeZnX3iqpdLHPIBGeUdQAjk4jd4UOkD6WN/nA6eZ X-Received: by 10.98.141.26 with SMTP id z26mr3797878pfd.85.1511979763559; Wed, 29 Nov 2017 10:22:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511979763; cv=none; d=google.com; s=arc-20160816; b=rNXXsXEVsNLnFYz8jfYEpQE7CB+1LSUm6BTal4JG43GBI00AAT62u0mo36iqHQu8n3 N2qx3hEi1f3ClmviraKq6MjzJ3cqM/XtGlmWQVjC3gUnlhvSTtnEJorWy8G9BamU4R3l CnBe/i7rLgZb1UM2vE5MwqLBtH+P8V653VyUKMXjr4lVVn/I6ZJYlar4v/111zkS+dSZ Dqkf+XKX7aFRhpEXN2ouO6L+eLBA8zg35xxKDnUxGWw2NBJ0GIENIhWugVaKYtNvF1bL 3S/QIK43U9X1TQkjwgtkceAfid3Fbgx58eFABafaRxYG8WMLWBV6fudNtCezWKX6QPkF rFNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=BKmKuv0pePWT1EIGtXAiPUgmJbhLdQrWnY9bKfmxtEc=; b=HzmM3ttWNB2k+zJqRuXE23WqLRk2au5VgWnan0SIn/hin+xZ2wZcEanuAzDPN1xwp5 UsfDvWZFu6J9d/OUrtNkXPU0aZ6HbZ82zCI302QQwHYLODajzaeUCx+hCXlwLa8ZDZeN /gc/JwaL/0yhIhJVu/NyGM+pUmIOm3YcGc4CLu/9TvOW20p+PHocCbGRamahKhmp+s9I tSqQFkvShQ9gwhB7cjN7C1fMoZM1VVirc6KqROxEWOH9hoba3hQ9F9YaLHuYjQeIGfaA OQowCcAuiY34wnbRcZAef5Hznc70MeP7ttpPTQVpvl0I3CI8g9QtMY0BwJrInXTTrtyA SQHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si1664079pli.472.2017.11.29.10.22.33; Wed, 29 Nov 2017 10:22:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933484AbdK2Pmu (ORCPT + 69 others); Wed, 29 Nov 2017 10:42:50 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:39468 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753781AbdK2Pms (ORCPT ); Wed, 29 Nov 2017 10:42:48 -0500 Received: (qmail 2710 invoked by uid 2102); 29 Nov 2017 10:42:46 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 29 Nov 2017 10:42:46 -0500 Date: Wed, 29 Nov 2017 10:42:46 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Mikhail Zaytsev cc: Greg Kroah-Hartman , , , Subject: Re: [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device. In-Reply-To: <20171129124646.65a3692e@zaitsev.tver.pg> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 */ > -- > > From 1585404912485663017@xxx Wed Nov 29 12:52:26 +0000 2017 X-GM-THRID: 1585404912485663017 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread