Received: by 10.223.164.202 with SMTP id h10csp4332726wrb; Wed, 29 Nov 2017 04:52:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMaM5vjKqlRP/gktG7PtrigL2NPVYoqV0AswGIkAerVX0hB7BONatZUlDbJVoujZViVeozR+ X-Received: by 10.99.125.69 with SMTP id m5mr2666637pgn.415.1511959945909; Wed, 29 Nov 2017 04:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511959945; cv=none; d=google.com; s=arc-20160816; b=ug2FFtOuZww2NTLdWXlT97hG3XAdR0YlhHXC2VvpBGlidpV7dg3nt8NrNefMFnXVYY lU7/HERaOjVN2RvdjiYr2MKiwfLMf3Ns0BfNYm/x4zp2M3kQVykgxJz1LePWZ1vuGJd0 uSSB6rma6kUw55o1zEyY7JXLT+rcsFjXQ0HMpOsxqiwCh99XPoxnOrqdA8pWu+3RYydY 4BsovCHAEnLVTecKDRHfhitAuyEqeJSrxJkiSg//GpMUqBdg2Pf/hBimkiGrT8OScSwK /c8l7Ug43WPMKukjAGfJZ5oDhakeyE7mQ9dJN878vLmS1DaQS2u6DCg1bKiJP0Djv2kG cwtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date:dkim-signature:dkim-signature :arc-authentication-results; bh=rbBvyCPJvqGzuBMBFlwE4S3Yibd9zBZMY+jwis5k9+k=; b=Ds0lTvJg2j+Mx/uFG1KmIcShbV2ag12InCgdIyR7Qvmmk0fksHcGLovFRd/HLhnrZ1 P+TQ6Llw9fnhhKQLLVFWO3x5rZZP8VhQFXhNU0qpJo1g+Afm0Zx2wELnH5u7BowuMNHM WTTnwVu5SNNhQadzWpRn1Jq5adaZnRRbL0kFtlMJYmxcxdUZ4wkulfdLht9EqqDCjmRx CPRx1xr6q4qkcbfgRhmsjVMkR3VZgFoCFqAJs0OnXA3Qc+9kQBzvzRvyN8j8givYc57i AlUaayFq4eCKIpnkO2FM/MGs5HAipFB6wj8p2LZAJynNap2D/hnuHr47r686ZJMi+I+J sGIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ru header.s=mail2 header.b=RtK9wH03; dkim=pass header.i=@mail.ru header.s=mail2 header.b=RtK9wH03; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=mail.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g207si1317779pfb.190.2017.11.29.04.52.15; Wed, 29 Nov 2017 04:52:25 -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; dkim=pass header.i=@mail.ru header.s=mail2 header.b=RtK9wH03; dkim=pass header.i=@mail.ru header.s=mail2 header.b=RtK9wH03; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=mail.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754002AbdK2Jrb (ORCPT + 70 others); Wed, 29 Nov 2017 04:47:31 -0500 Received: from fallback4.mail.ru ([94.100.181.169]:44548 "EHLO fallback.mail.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753397AbdK2Jr3 (ORCPT ); Wed, 29 Nov 2017 04:47:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=rbBvyCPJvqGzuBMBFlwE4S3Yibd9zBZMY+jwis5k9+k=; b=RtK9wH03o4MN8+kVE40hdiQn8AiIS7DmU2uWvc+/w3b5mVsEoIH4ZEJVbtFJecgGjpiKhIPRkto6DTAsm5vNuD1vJR+wqlzB+h83V2L70Q/++IZa95K8Fd3V8gIU2dIvrTwl6HrGsVvqcWgvqtx9SZTU5iHGqd8BCGGMMCcpI24=; Received: from [10.161.64.60] (port=47208 helo=smtp52.i.mail.ru) by fallback4.mail.ru with esmtp (envelope-from ) id 1eJyxi-0000YV-B2; Wed, 29 Nov 2017 12:47:26 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=rbBvyCPJvqGzuBMBFlwE4S3Yibd9zBZMY+jwis5k9+k=; b=RtK9wH03o4MN8+kVE40hdiQn8AiIS7DmU2uWvc+/w3b5mVsEoIH4ZEJVbtFJecgGjpiKhIPRkto6DTAsm5vNuD1vJR+wqlzB+h83V2L70Q/++IZa95K8Fd3V8gIU2dIvrTwl6HrGsVvqcWgvqtx9SZTU5iHGqd8BCGGMMCcpI24=; Received: by smtp52.i.mail.ru with esmtpa (envelope-from ) id 1eJyxY-0007xs-Jo; Wed, 29 Nov 2017 12:47:17 +0300 Date: Wed, 29 Nov 2017 12:46:46 +0300 From: Mikhail Zaytsev To: Alan Stern , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org Subject: [PATCH v1] USB: storage: Notify the subdrivers that they need to reinitialize the device. Message-ID: <20171129124646.65a3692e@zaitsev.tver.pg> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-7FA49CB5: 0D63561A33F958A52EBF4753F2105E882F2FD4A535CA15470769170AC4760B85725E5C173C3A84C355CB0F2F0488E140FD751C9D353C4AED42539A7722CA490CB5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBEB6346B700B4D54FE5BFE6E7EFDEDCD789D4C264860C145E X-Mailru-Sender: DBE5340C3C7EDD8748A9F62D407CC5DB26F526BDBBADD0CA12198951266911BBDF580C3AF0510E413C8BDCE45491770B027D9DD7AE851095372E3D06A1D6CBE64DA9DA30EEEEBA7A0D4ABDE8C577C2ED X-Mras: OK X-Mras: OK Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 1585425524060682979@xxx Wed Nov 29 18:20:02 +0000 2017 X-GM-THRID: 1585425396600207095 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread