Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4009409pxk; Tue, 8 Sep 2020 08:24:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOda116WA2DLIfUGBKMM7q7pRZdBFUoc+axkGLKuvqsntnb7+5eloP/MQTwLQAnVDy/pix X-Received: by 2002:a17:906:8c1:: with SMTP id o1mr27564770eje.478.1599578644784; Tue, 08 Sep 2020 08:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599578644; cv=none; d=google.com; s=arc-20160816; b=iFhv8x/5ADzqCbZGCQ3jmGScEC8fM8gvHirWHjDemPjdOi2pR+Pm9Hz8PGwFN9on3R TM0lD/cJnbiiHtJguoZLvofNyjKZOEkobClYxvez5FYdSJaLylucKiRbInnSSHJb2VgF wJJGzGS4Ma+GiqY2YpzJmK7NQQDF+xwquU/gBi3dB3d+aWVOD2WjM+u0avQMl18gvbnO NVOcturxc9J4RLdclHy/LheaTbFVgsMt1sNMZJMOuFtNR9aYgBQLpGKi55ZDCk82g/tf Lmscg5Sta80J4meTlSDjDrDsNCPiazq8DsjO3QdwuCq+3iUevuwY6sTuoW3um/qdGwf+ +tOQ== 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=T3DAd20WTb1Hb/Ra/a3WLrHCAUox9jbNIuydKc6Zwq0=; b=jw3HjZ2mJ/IijV7ijSsiefl4QqZLmfvwyvDX6umXh3+Yb5v0PUPE44QUbtTHRTO/aG 7HsdztxQlYqGceJev3Vv9fLxX7kdN2lVLr+MqdQvib+qW7s1ZC950hHqiIh2uGJYUfg+ bj4l66OoMCYowK5RQIj3R6yiOqsfvc+h4PXzqTVRRm/B3l2blF8f9WXTbYCfXwqxhJkq VEZp06lB2NTd7nXw1gHYEMGjltjQfqzZaIYn0pqvsnMcqP//XLzXY9VuTJCxpltJBJ1t WizWrmanItBhoNz5ud9fdr+RTox5kTKFVnZxzjbwTzHA/HIiKik5Xkf9raLNXPWicCpJ cn8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=noebgbDT; 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 i11si15090582edb.127.2020.09.08.08.23.42; Tue, 08 Sep 2020 08:24:04 -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=noebgbDT; 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 S1728936AbgIHPVy (ORCPT + 99 others); Tue, 8 Sep 2020 11:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730203AbgIHPSl (ORCPT ); Tue, 8 Sep 2020 11:18:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3DB2C0A3BE7; Tue, 8 Sep 2020 07:54:59 -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=T3DAd20WTb1Hb/Ra/a3WLrHCAUox9jbNIuydKc6Zwq0=; b=noebgbDTM393jBZuz8b4XPDreU 6wJ3DmWW4agGQj7UfprYVx8eF3+AFoEFftZqarIzWu1hxbmosigPQIHqlIZ+66W/uJmVFP9aXLjZU ozaQ3eGcPyvoxsu6KMF/k7jX4EtE8YMhn+xwUfisrE85z2VvUQrm96lE97H1eWdMW5nW46FosdncC WceOuD/7NyEZ1vcGW/fA8pqZJLAJPpx5RteD/YTpmudBbWS8uFR+8XbK3yMUgtijSWHPXig9zmArD 1UrJLeuY2m/E2QToGMBRKZ0HOsckIhOVNmyDTakcOz5VMW2zg9DQkub5G140UKeFW3ehh0juqUcC9 mf9Q+lNQ==; Received: from [2001:4bb8:184:af1:3dc3:9c83:fc6c:e0f] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFf0n-0002xK-0m; Tue, 08 Sep 2020 14:54:22 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Denis Efremov , Tim Waugh , Michal Simek , Borislav Petkov , "David S. Miller" , Song Liu , "Martin K. Petersen" , Finn Thain , Michael Schmitz , linux-m68k@lists.linux-m68k.org, 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-fsdevel@vger.kernel.org, Johannes Thumshirn Subject: [PATCH 06/19] swim: simplify media change handling Date: Tue, 8 Sep 2020 16:53:34 +0200 Message-Id: <20200908145347.2992670-7-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908145347.2992670-1-hch@lst.de> References: <20200908145347.2992670-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 floppy_revalidate mostly duplicates work already done in floppy_open despite only beeing called from floppy_open. Remove the function and just clear the ->ejected flag directly under the right condition. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- drivers/block/swim.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/block/swim.c b/drivers/block/swim.c index d4565c555b289f..52dd1efa00f9c5 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -217,8 +217,6 @@ extern int swim_read_sector_header(struct swim __iomem *base, extern int swim_read_sector_data(struct swim __iomem *base, unsigned char *data); -static int floppy_revalidate(struct gendisk *disk); - static DEFINE_MUTEX(swim_mutex); static inline void set_swim_mode(struct swim __iomem *base, int enable) { @@ -640,8 +638,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) return 0; if (mode & (FMODE_READ|FMODE_WRITE)) { - if (bdev_check_media_change(bdev)) - floppy_revalidate(bdev->bd_disk); + if (bdev_check_media_change(bdev) && fs->disk_in) + fs->ejected = 0; if ((mode & FMODE_WRITE) && fs->write_protected) { err = -EROFS; goto out; @@ -738,24 +736,6 @@ static unsigned int floppy_check_events(struct gendisk *disk, return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0; } -static int floppy_revalidate(struct gendisk *disk) -{ - struct floppy_state *fs = disk->private_data; - struct swim __iomem *base = fs->swd->base; - - swim_drive(base, fs->location); - - if (fs->ejected) - setup_medium(fs); - - if (!fs->disk_in) - swim_motor(base, OFF); - else - fs->ejected = 0; - - return !fs->disk_in; -} - static const struct block_device_operations floppy_fops = { .owner = THIS_MODULE, .open = floppy_unlocked_open, -- 2.28.0