From patchwork Wed Oct 17 23:40:06 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: 10646609 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 EAF601057 for ; Wed, 17 Oct 2018 23:40:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE6892887D for ; Wed, 17 Oct 2018 23:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2264288CF; Wed, 17 Oct 2018 23:40:56 +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 573582887D for ; Wed, 17 Oct 2018 23:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727262AbeJRHjA (ORCPT ); Thu, 18 Oct 2018 03:39:00 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:37709 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727175AbeJRHjA (ORCPT ); Thu, 18 Oct 2018 03:39:00 -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=G/eY6OZeEgvRdz/ecentW+Z2nu11rFSTllpakFNV9ok=; b=lg0K7gGiC3Yf joGhsn8gB/L7cPOP9pmECqCTMCNnlQU5r38Vdv6xg3SVeH3jFngLKaf05amIjR8ieCw1n7FKUEMH0 imxmyRj1708nPIvwhK0St6jyXhVU+MTQfwR9uz3Q4J3TH4sUvaFeQ7Kki2cETK7FEoah7UIaWVHS0 dSHO4AGW3zvwRlqvsDmRKcs/CcWpWKEdJ9f5bmgkkuPBkZ5hLyz1Bwfcevrb87paEf/ApAqAn0/ka WMHCAw8Kg8rn7WWnhu/vytR0HThu+ldtnh9WRUUIqk3qVFo6mF91/LmK6avLIMKdzpx1qswVGHEsn +JIM0FygEpZwxmQ7ECB1wQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gCvQk-000D3m-2u; Thu, 18 Oct 2018 01:40:46 +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 6DF64C06CF; Thu, 18 Oct 2018 01:40:31 +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 Chamberlain , Johannes Thumshirn , Christoph Hellwig Subject: [PATCH v2 7/7] sd: Inline sd_probe_part2() Date: Wed, 17 Oct 2018 16:40:06 -0700 Message-Id: <20181017234006.124251-8-bvanassche@acm.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog In-Reply-To: <20181017234006.124251-1-bvanassche@acm.org> References: <20181017234006.124251-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 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: EX5BVjFpneJeBchSMxfU5op48jggOTN4oc6RjW2SFAN602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTbYPg/zpkSiMTw4RmnfxRCXFU82axTVwUv6v8rWwOPbn8ST Ksl9SxC91yR06AZxhKQie9+9sv+uW/xhFRf3rOAhFEAZ5tLgtxeh4W43PRo1gyVBZhJdB8oBIQVB HyeF+GyojOI3mdswqRrDTMbSijPikzUjpLbYv+k6wc7gZffRufoNd/18byQB0A6J7qtkYo2nkoP/ 7uxT5ANOZNNW1Q/z0yLvsMb+uiAAjdbSeQ5TrAFR//DqOZ7gBtaFV3NEPd9B3ylJDm+BpEBBclKF yxopgN4JfSdG4+vA3R3fKJCA/m/fDy/eqb5U4J5qWPtxGNS+AWt3mmLC0hoFR40CPAMQyrccvRl7 LodRnoQ8/VwOaw+gz/ZKpG7S9PROnRo5n5USQWn9OYmU74xfbcEYge/f7INkM1D8D0wcffXFPtzu Go+eFJImtabaGYRoWdcAtjCcAuDIQf0tklPcA7SYKMcZaFryuM28yfNoRiP4LXR95v/77cCko/EG 7+7uLxBlLaVvfCJf9c87raNJ3rEEAH2+T1zD59o8cPYKs494BBiYWZDfGiqYJbsV6Bia58mKB6GP R9UyIYODc1wVguED8Bfu31/E3ahF5MMcDI7KdpjQKcwi9Jk69TnSHoh9VM4qIjsvP92yJqFDUMWg YkYfhC80sNoIrLcCnn2MFoRBwXu4i9adXN8QoJkCGUT+/nq62lQ14TiNHZBO9dkjkpbpFG8w6J1f hOzjF0b4LXcjJZ5loquFk+pkh+w6U8HrQHUPSWrvc2Dse4DtQMNd1OJpSyWygIcekAmy8mRS31yf rk4trEcV0wEj9itRcd7KH+nVDjFllXn2maRqR4xJOvVleQ85XMfPU/A6Zs85EHjl8kedTQDBddgS itHw/K1calPLDDrKATDDBZ7fFc0FDw0l2bg+z2YoA4glpLgakSw0zRVimP9j4HqbpkLxG/QtLNqg hpj18S1LhMKeGT5NnT/bTxLbyB2oVjwpD0SDGnhQZ7XpT35mKiWY4qyAovTKsLgKiJqTF6ymUAav ae3aV27dM5QN3KVLwP/pKIIHQBh4yd/8+tEyvDkN3AfUBddcu9g0Uhw/YHGGdt5eD9ya81kvI1of 3IOsrfnTjx5M5ZqkPpQBrM2wWVbjHO/cpJpsYlvFhM+mW297Uqw0ZsTjLTJBUO9GfzrLxVhP0uel tSacMfCNTlvBloR44kmvlvy5XDsjxS0= 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. Cc: Lee Duncan Cc: Hannes Reinecke Cc: Luis Chamberlain Cc: Johannes Thumshirn Cc: Christoph Hellwig Cc: Greg Kroah-Hartman Signed-off-by: Bart Van Assche --- 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 52eee36d13fb..2a96c2ed1b52 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3228,63 +3228,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 @@ -3374,7 +3317,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;