Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp359058pxk; Thu, 3 Sep 2020 01:17:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCCo5CMXLdSqGADTefyXiTonjcodbsqeGHK3wx8EMTpFrrEj9yxkag6cF8pfA+f1dSJU7m X-Received: by 2002:a17:906:719a:: with SMTP id h26mr976424ejk.336.1599121055740; Thu, 03 Sep 2020 01:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599121055; cv=none; d=google.com; s=arc-20160816; b=YrMseK5Qx8u60NAqlsBV5MueGKDnvuvwNzB38pQzrtYsFXAgILQHlDH+b8lMf551yb aDlFi+pR1NYy8kjJcKEu7m38Xc1LcAn6ItUl9VsCOwDojK6CSTplFKzGzzLoH9moyrFv IIgBXkpHJ3CRIHV3whJNQc3FFkq0JPDaLYsTI1kVYjvJVl1x0XRWtAWrvYvabLmUYtAW geHam5LiDOyh8NYqF1SGxxQEHw2XeGtr6F/nGHlC/xJS4N6svXFaGO+zzV4W1sqBdOut FMniMsBIg9bNdIqyGKl1BzIrzaVIrAS2dW+lCpNYGp/rmdpBBreQ8EMuyDFJXWtsLJ5L 0QcA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=34hr4y/kC5XT7kH5TAn/CeLpg6Bsmo1oeMdH990fres=; b=tZZeTOPm7h6FCJizL3u307qk2EBsLxoSu+DlM4EmSxtbwSNQ5BIyymy4UWdG822NzR NOpRIjTAst2+CqvJ6VXRv031GzybbdRwKtLMYuP6L7wwkj4Jr+B4Zbz2uHRC4xFta3j1 fLjBgRpbpOG55oybC1xoEtUHUbcrgbS9zSB6wZlgM0cbNdHiDHs6WLCNQK8mT3mTZJZG fiP5VEXqj+yzWulhpHI4GKiDc/9kpiT188/i9CsGf2I+VnaXSwyUaTVj03YBHjtbRKLa cK0bUKo8HgVH7kE7ZaZccMdkx2xZfW2vNXbMoLkrU3p0LiXEU5icwVmUj406uv7TrBzk 0Qkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ahPAenJU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si1362989eja.354.2020.09.03.01.17.12; Thu, 03 Sep 2020 01:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ahPAenJU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729017AbgICINr (ORCPT + 99 others); Thu, 3 Sep 2020 04:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728298AbgICIBq (ORCPT ); Thu, 3 Sep 2020 04:01:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA02C061245; Thu, 3 Sep 2020 01:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=34hr4y/kC5XT7kH5TAn/CeLpg6Bsmo1oeMdH990fres=; b=ahPAenJUsY4BCJkSHA+WEPIwvB /qh1bsK8LoF0p506rH3LLAuN6vyzhMeBcDVppeceCf1BAbgr4RhcrwLgHk4+caVnKlVwxc+QbKuCS ioutF+vwlXD6ERhrFDvQh/cPinB5cpcsswOr6MUMgzPw24CXlPG1Xe3CDhNbxxYm1GVFrJKfjDtTS YhyTdDFvzUrcAniHpc8AWsbcTDJFvRp8+Og5RE1YTdx4946T9phaAwiBuBDKPlMudRYbbONR1H4PS NjYkpvsxOTJuAfXYGZI7Vm/Q3MR75BdwVR67mu5O8zeG/Ppom3t8tnc9OzmGlNqLlLtg30YRFy7TW 6hGYUO1g==; Received: from [2001:4bb8:184:af1:c70:4a89:bc61:2] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDkBf-0006ci-Er; Thu, 03 Sep 2020 08:01:39 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Denis Efremov , "David S. Miller" , Song Liu , Al Viro , Finn Thain , Michael Schmitz , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org Subject: [PATCH 13/19] ide: switch to __register_blkdev for command set probing Date: Thu, 3 Sep 2020 10:01:13 +0200 Message-Id: <20200903080119.441674-14-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903080119.441674-1-hch@lst.de> References: <20200903080119.441674-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ide is the last user of the blk_register_region framework except for the tracking of allocated gendisk. Switch to __register_blkdev, even if that doesn't allow us to trivially find out which command set to probe for. That means we now always request all modules when a user tries to access an unclaimed ide device node, but except for a few potentially loaded modules for a fringe use case of a deprecated and soon to be removed driver that doesn't make a difference. Signed-off-by: Christoph Hellwig --- drivers/ide/ide-probe.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 076d34b381720f..1c1567bb519429 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -902,31 +902,12 @@ static int init_irq (ide_hwif_t *hwif) return 1; } -static int ata_lock(dev_t dev, void *data) +static void ata_probe(dev_t dev) { - /* FIXME: we want to pin hwif down */ - return 0; -} - -static struct kobject *ata_probe(dev_t dev, int *part, void *data) -{ - ide_hwif_t *hwif = data; - int unit = *part >> PARTN_BITS; - ide_drive_t *drive = hwif->devices[unit]; - - if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) - return NULL; - - if (drive->media == ide_disk) - request_module("ide-disk"); - if (drive->media == ide_cdrom || drive->media == ide_optical) - request_module("ide-cd"); - if (drive->media == ide_tape) - request_module("ide-tape"); - if (drive->media == ide_floppy) - request_module("ide-floppy"); - - return NULL; + request_module("ide-disk"); + request_module("ide-cd"); + request_module("ide-tape"); + request_module("ide-floppy"); } void ide_init_disk(struct gendisk *disk, ide_drive_t *drive) @@ -967,7 +948,7 @@ static int hwif_init(ide_hwif_t *hwif) return 0; } - if (register_blkdev(hwif->major, hwif->name)) + if (__register_blkdev(hwif->major, hwif->name, ata_probe)) return 0; if (!hwif->sg_max_nents) @@ -989,8 +970,6 @@ static int hwif_init(ide_hwif_t *hwif) goto out; } - blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, - THIS_MODULE, ata_probe, ata_lock, hwif); return 1; out: @@ -1582,7 +1561,6 @@ static void ide_unregister(ide_hwif_t *hwif) /* * Remove us from the kernel's knowledge */ - blk_unregister_region(MKDEV(hwif->major, 0), MAX_DRIVES<sg_table); unregister_blkdev(hwif->major, hwif->name); -- 2.28.0