Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp520189pxk; Wed, 2 Sep 2020 07:52:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyptlRI0JtFq/WVCPy/UwDpnp0/lnsWiezjVaqyHHLlT3bNfLo1ySZGA2sRDIqerDVKEwQg X-Received: by 2002:a17:906:68cd:: with SMTP id y13mr407528ejr.132.1599058328387; Wed, 02 Sep 2020 07:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599058328; cv=none; d=google.com; s=arc-20160816; b=n+xJjb5odbXY+g/UxB7yQ6gyHw1aAUpwbNAyEsSlKeQv11UuipMmO//ij9Q0/R23Z9 Dy5iIZeTirT0bIumvudbS+2eIk92+iJWtX2l98iF7DF7Dr+iA/eM9iMijfMtz2gaaTQd kuO5snArsdU59UbMCHL+d0OO14hCd64w9CEaD4MdIKapEEeL4HEEyt+E1g5FH17Ty2Pw AfJAheBbt5HTSqa5nIEeZUF8vF4viHIfQxT8PAb063eMpHK1YqroR+fmS9sYPfRDs9R0 SpILOCK7yfdFPQrry5K/9yaLqBg2ReYsIZQWaPGxdC/HJYzHQn4D0yoohvaG9p4OTpoP PuBQ== 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=IOBdZmqfub+9TrAGeUEaXu5Vz5gp+vrz6f+ooFKXHwY=; b=IlPAbJFhbiKHRFbvHlGSoZYhnEeqIP6XQdgxr5vDivJjXHWE5eEqq8vllA3Jfx5zKK 2wCT0ZNYhDTPVk1e4DAMFAq9p183/Ys9gh23ZCHSR8hoyybluBrIGLPMK2V2sOo+Pmbu wVA/9UTa4CQSnF+vGJVtn9EjU8dxeOLAB6lm3HZ3E/vLqTeu204VzyqSk2BKOE9JSkO6 ljPSemO1mNqVyY+H1Bnt0MXLoSFwIqFdaHP6+uSq7l3Mc5Hn5+W2iSzDTI6ROD9TWm1F rvD3QM6fSP2Frq9Loix2W2munzON3GWkCWMywUiYqJv5Y8WBwDgWiYZq0bLhipMcPvox cY4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b="ZuN/Dmn2"; 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 r12si2687742edq.93.2020.09.02.07.51.36; Wed, 02 Sep 2020 07:52:08 -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="ZuN/Dmn2"; 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 S1728039AbgIBOsK (ORCPT + 99 others); Wed, 2 Sep 2020 10:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727957AbgIBOMy (ORCPT ); Wed, 2 Sep 2020 10:12:54 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76268C061249; Wed, 2 Sep 2020 07:12:53 -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=IOBdZmqfub+9TrAGeUEaXu5Vz5gp+vrz6f+ooFKXHwY=; b=ZuN/Dmn2J8IDS9piakhRmsdkpI 7vWOwaizTLkjNJZxYBailM2+9Gl+YeAVFkiiwel78wa+j0YAag1iY7m8xJoMJzrMEi9g5hRbd/mX4 96CJBtGZJ690xEt7ffFH5Bq3HC9aTfTPlVKUzp5n4Pyuu51JrEvzAxLAhvbwg1D6SASNJKuwilp4f 5cPWKtsThdhLGWnV4ifqgx6HPdP8bp1+SIo/LtGnRAVWFIZgBr44DEPpeweTkKFy+8o8V3slYgBtu J9XmHaFEinAi5UwsSHm7hKaBR1cAkO67N5oCJLbNexpnDyC9UkVHw9cXaHLhCzF5YWsQHRqLyAAov 9uuRmeHQ==; Received: from [2001:4bb8:184:af1:6a63:7fdb:a80e:3b0b] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDTUy-0005dM-96; Wed, 02 Sep 2020 14:12:28 +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 Subject: [PATCH 06/19] swim: simplify media change handling Date: Wed, 2 Sep 2020 16:12:05 +0200 Message-Id: <20200902141218.212614-7-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200902141218.212614-1-hch@lst.de> References: <20200902141218.212614-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 --- 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