From patchwork Tue Oct 2 21:52:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10624113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A75CD112B for ; Tue, 2 Oct 2018 21:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AC32284C3 for ; Tue, 2 Oct 2018 21:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D618284C4; Tue, 2 Oct 2018 21:53:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17EA02842E for ; Tue, 2 Oct 2018 21:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727511AbeJCEic (ORCPT ); Wed, 3 Oct 2018 00:38:32 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:43975 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbeJCEib (ORCPT ); Wed, 3 Oct 2018 00:38:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=yCNwRnTUU+PXWQqeKlOoBbFWVIkG5hvD+CeEOa/+AME=; b=RZqGkfEznVvw JGWRZRCc78B0Tta1odLAcxm4f+ScGXfMLYjQmxlHVj8Pcm6eb2SsVv+V7B//ol92q9Q6BkYCLo9pu STrDWaTWycXU4xfPz0709gQHTBx6MzPpRnKPOeLrRMZSBKZmCqGMnAsZunpWn8YuQMx8mxgrtP5Xx BTPYquWH9GMgnsgrnh+0poKP4/tKUBH/wAEiY4PIIq/Ojk8IZUmVrvn0RLjmG1j9buI4q+jOSXtb+ 4hC12bvs/NN/AQj5pg1wvFSDXGfQWFaE0UuYJ4eaqFCbkI2E4mu3fRMBCkCf7ntZewhffmRu/to9D WN3mK3R+u8WBB/bhwnomQQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g7Sb9-0005s2-MZ; Tue, 02 Oct 2018 23:52:56 +0200 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 55768C08FC; Tue, 2 Oct 2018 23:52:40 +0200 (CEST) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: Greg Kroah-Hartman , linux-scsi@vger.kernel.org, Bart Van Assche , Lee Duncan , Hannes Reinecke , "Luis R . Rodriguez" , Johannes Thumshirn , Christoph Hellwig Subject: [PATCH 2/3] sd: Inline sd_probe_part2() Date: Tue, 2 Oct 2018 14:52:22 -0700 Message-Id: <20181002215223.20453-3-bvanassche@acm.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181002215223.20453-1-bvanassche@acm.org> References: <20181002215223.20453-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.159 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5ieSNIzJlEVl14BTMaMXkpt602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTbBu5YFz4Jx0uq4149LpZwrkOR4/HajlzkVhakIw7Ig6cwd ucx0/hy6ghJki+KFMutdPFg736Hj4qCv9Wq9HmRLo3CYqeHmXS+8iJmp2wA0RYr53oorwUmj6U9o RHQGd3MYhv5ncN4aXTpV27LuhaKEJ0WYXEkavZ0SiS9W+onrEQcSH5+zf0CUeH8og9mFu6jSI9i6 mVSi/9/XpXGW1ju2Hp2CPzwbIONgnB65PTfUbNabA83L2bxWgLDcSJYE06EO+9AvCULu7v2wEBQm NVUBhVQzrifUJXmdKLiwkyJfcpzptsBSygmEGxdKaV71syZaa40DxZPJuLUk3zkVKd8pPJaf7i3w vxgaUQ1edo9GTkTpqUvIflo8smhAh+RmL8DQrQo5+sEgxwQHvcyA2kX0ycfPn82Vg1/La2h31XFV jHGsgWpTMzYkIviGj+iKd5fvZYYFy7zBFkwpn1jw15t9+3q8ix/gk0ncNNOp8G0HNaJBMNnyTIeK fUmiVfXF6aSshIp2TVapwrpjl0CBfPzmiSrlgXUe2FRrt3Q/saIuuxKN1jTioj2Vkh+jtBHn5QkU VgCEoGhSx+dc5wLN1Ls2Dm68l5/yZWpvNsat32R+M/xcb3XRuJkRyiZZ6HPi7yzMODodi5MLJiAv rVIiQFNhcJkH/XIBVIHRSdAUlc73GeHsTCU1tXES7goCkbhuJrdzIbhVr9Z3LIDH3wGQUZ4UlBHd 2wJ53rPs265wcrWXIr60yLzVihg3Po1XDUMMxmDEHaQQyEsw7lw15KLqrrJUZ9ZL+s9v8wLkvp69 3LknIAtAJHHBwuXpxJpVcXL1FXhDe2D6nYjUPvBPULo52BbY9qSf4fy7RZrSss1TmRNP+df05hmP GRjPPkl/w9cp3+jBRBZgCikvOAMF/4pY8933J6oZFkdmboZrJXcGZFXRxBmEWxN7wSYQOZhJUXhp E7Fh+eWLxUNB2EvXpmRb3Nspc/1r1ahBSpNG7qxOQB127abziDTOtQTjAmzp739EHWrDqcigOvSx dRnthmhn8Zn6IHsUgbZnPaZbS7o/lw0U/vv85zryNFx6XnviEN9buaDeNHk15VolAGHS5rCXQKDy V6n3MjFcR0EJCsIWrcCYM7I0q854skGDr1SFWz9TrEb+t+0tXG/ZiXpkIVPnC3hDyTcjq8HMRYhm G6FDb9wWn+NvPKHiEjTsbQQc4NYDfB8= X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Lee Duncan Cc: Hannes Reinecke Cc: Luis R. Rodriguez Cc: Johannes Thumshirn Cc: Christoph Hellwig Cc: Greg Kroah-Hartman --- drivers/scsi/sd.c | 101 ++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 58 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 48a133a3aab8..93732f1fb551 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3232,63 +3232,6 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) return 0; } -static void sd_probe_part2(struct scsi_disk *sdkp) -{ - struct scsi_device *sdp; - struct gendisk *gd; - u32 index; - struct device *dev; - - sdp = sdkp->device; - gd = sdkp->disk; - index = sdkp->index; - dev = &sdp->sdev_gendev; - - gd->major = sd_major((index & 0xf0) >> 4); - gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); - - gd->fops = &sd_fops; - gd->private_data = &sdkp->driver; - gd->queue = sdkp->device->request_queue; - - /* defaults, until the device tells us otherwise */ - sdp->sector_size = 512; - sdkp->capacity = 0; - sdkp->media_present = 1; - sdkp->write_prot = 0; - sdkp->cache_override = 0; - sdkp->WCE = 0; - sdkp->RCD = 0; - sdkp->ATO = 0; - sdkp->first_scan = 1; - sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; - - sd_revalidate_disk(gd); - - gd->flags = GENHD_FL_EXT_DEVT; - if (sdp->removable) { - gd->flags |= GENHD_FL_REMOVABLE; - gd->events |= DISK_EVENT_MEDIA_CHANGE; - } - - blk_pm_runtime_init(sdp->request_queue, dev); - device_add_disk(dev, gd); - if (sdkp->capacity) - sd_dif_config_host(sdkp); - - sd_revalidate_disk(gd); - - if (sdkp->security) { - sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit); - if (sdkp->opal_dev) - sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); - } - - sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", - sdp->removable ? "removable " : ""); - scsi_autopm_put_device(sdp); -} - /** * sd_probe - called during driver initialization and whenever a * new scsi device is attached to the system. It is called once @@ -3378,7 +3321,49 @@ static int sd_probe(struct device *dev) get_device(dev); dev_set_drvdata(dev, sdkp); - sd_probe_part2(sdkp); + gd->major = sd_major((index & 0xf0) >> 4); + gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); + + gd->fops = &sd_fops; + gd->private_data = &sdkp->driver; + gd->queue = sdkp->device->request_queue; + + /* defaults, until the device tells us otherwise */ + sdp->sector_size = 512; + sdkp->capacity = 0; + sdkp->media_present = 1; + sdkp->write_prot = 0; + sdkp->cache_override = 0; + sdkp->WCE = 0; + sdkp->RCD = 0; + sdkp->ATO = 0; + sdkp->first_scan = 1; + sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS; + + sd_revalidate_disk(gd); + + gd->flags = GENHD_FL_EXT_DEVT; + if (sdp->removable) { + gd->flags |= GENHD_FL_REMOVABLE; + gd->events |= DISK_EVENT_MEDIA_CHANGE; + } + + blk_pm_runtime_init(sdp->request_queue, dev); + device_add_disk(dev, gd); + if (sdkp->capacity) + sd_dif_config_host(sdkp); + + sd_revalidate_disk(gd); + + if (sdkp->security) { + sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit); + if (sdkp->opal_dev) + sd_printk(KERN_NOTICE, sdkp, "supports TCG Opal\n"); + } + + sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", + sdp->removable ? "removable " : ""); + scsi_autopm_put_device(sdp); return 0;