From: Chaitanya Kulkarni <kch@nvidia.com> To: <ogeert@linux-m68k.org>, <linux-block@vger.kernel.org>, <linux-m68k@lists.linux-m68k.org>, <linux-kernel@vger.kernel.org>, <drbd-dev@lists.linbit.com>, <nbd@other.debian.org>, <linux-mtd@lists.infradead.org> Cc: <axboe@kernel.dk>, <philipp.reisner@linbit.com>, <lars.ellenberg@linbit.com>, <christoph.boehmwalder@linbit.com>, <efremov@linux.com>, <josef@toxicpanda.com>, <tim@cyberelk.net>, <haris.iqbal@ionos.com>, <jinpu.wang@ionos.com>, <richard@nod.at>, <miquel.raynal@bootlin.com>, <vigneshr@ti.com>, <kch@nvidia.com>, <mcgrof@kernel.org>, <hare@suse.de>, <damien.lemoal@opensource.wdc.com>, <johannes.thumshirn@wdc.com>, <bvanassche@acm.org>, <ming.lei@redhat.com>, <vincent.fu@samsung.com>, <shinichiro.kawasaki@wdc.com> Subject: [RFC PATCH 11/18] pd: use init disk helper Date: Tue, 4 Oct 2022 22:00:20 -0700 [thread overview] Message-ID: <20221005050027.39591-12-kch@nvidia.com> (raw) In-Reply-To: <20221005050027.39591-1-kch@nvidia.com> Add and use the helper to initialize the common fields of struct gendisk such as major, first_minor, minors, disk_name, private_data, and ops. This initialization is spread all over the block drivers. This avoids code repetation of inialization code of gendisk in current block drivers and any future ones. Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com> --- drivers/block/paride/pd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index f8a75bc90f70..9457ad0cc25f 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -919,12 +919,7 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, disk->gd = p; strcpy(p->disk_name, disk->name); - p->fops = &pd_fops; - p->major = major; - p->first_minor = (disk - pd) << PD_BITS; - p->minors = 1 << PD_BITS; p->events = DISK_EVENT_MEDIA_CHANGE; - p->private_data = disk; blk_queue_max_hw_sectors(p->queue, cluster); blk_queue_bounce_limit(p->queue, BLK_BOUNCE_HIGH); @@ -939,7 +934,8 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, } if (ret) goto put_disk; - set_capacity(disk->gd, disk->capacity); + init_disk(disk, major, (disk - pd) << PD_BITS, 1 << PD_BITS, + disk->capacity, disk, *pd_fops); ret = add_disk(disk->gd); if (ret) goto cleanup_disk; -- 2.29.0
WARNING: multiple messages have this Message-ID (diff)
From: Chaitanya Kulkarni <kch@nvidia.com> To: <ogeert@linux-m68k.org>, <linux-block@vger.kernel.org>, <linux-m68k@lists.linux-m68k.org>, <linux-kernel@vger.kernel.org>, <drbd-dev@lists.linbit.com>, <nbd@other.debian.org>, <linux-mtd@lists.infradead.org> Cc: <axboe@kernel.dk>, <philipp.reisner@linbit.com>, <lars.ellenberg@linbit.com>, <christoph.boehmwalder@linbit.com>, <efremov@linux.com>, <josef@toxicpanda.com>, <tim@cyberelk.net>, <haris.iqbal@ionos.com>, <jinpu.wang@ionos.com>, <richard@nod.at>, <miquel.raynal@bootlin.com>, <vigneshr@ti.com>, <kch@nvidia.com>, <mcgrof@kernel.org>, <hare@suse.de>, <damien.lemoal@opensource.wdc.com>, <johannes.thumshirn@wdc.com>, <bvanassche@acm.org>, <ming.lei@redhat.com>, <vincent.fu@samsung.com>, <shinichiro.kawasaki@wdc.com> Subject: [RFC PATCH 11/18] pd: use init disk helper Date: Tue, 4 Oct 2022 22:00:20 -0700 [thread overview] Message-ID: <20221005050027.39591-12-kch@nvidia.com> (raw) In-Reply-To: <20221005050027.39591-1-kch@nvidia.com> Add and use the helper to initialize the common fields of struct gendisk such as major, first_minor, minors, disk_name, private_data, and ops. This initialization is spread all over the block drivers. This avoids code repetation of inialization code of gendisk in current block drivers and any future ones. Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com> --- drivers/block/paride/pd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index f8a75bc90f70..9457ad0cc25f 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -919,12 +919,7 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, disk->gd = p; strcpy(p->disk_name, disk->name); - p->fops = &pd_fops; - p->major = major; - p->first_minor = (disk - pd) << PD_BITS; - p->minors = 1 << PD_BITS; p->events = DISK_EVENT_MEDIA_CHANGE; - p->private_data = disk; blk_queue_max_hw_sectors(p->queue, cluster); blk_queue_bounce_limit(p->queue, BLK_BOUNCE_HIGH); @@ -939,7 +934,8 @@ static int pd_probe_drive(struct pd_unit *disk, int autoprobe, int port, } if (ret) goto put_disk; - set_capacity(disk->gd, disk->capacity); + init_disk(disk, major, (disk - pd) << PD_BITS, 1 << PD_BITS, + disk->capacity, disk, *pd_fops); ret = add_disk(disk->gd); if (ret) goto cleanup_disk; -- 2.29.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2022-10-05 5:04 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-05 5:00 [RFC PATCH 00/18] block: add and use init disk helper Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 01/18] " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-10 7:59 ` Christoph Hellwig 2022-10-10 7:59 ` Christoph Hellwig 2022-10-10 16:50 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 02/18] nfblock: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 03/18] amiflop: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 04/18] brd: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 05/18] drbd: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 10:09 ` Christoph Böhmwalder 2022-10-05 10:09 ` Christoph Böhmwalder 2022-10-05 17:24 ` Chaitanya Kulkarni 2022-10-05 17:24 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 06/18] floppy: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 07/18] loop: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 08/18] n64cart: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 09/18] nbd: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 10/18] pcd: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni [this message] 2022-10-05 5:00 ` [RFC PATCH 11/18] pd: " Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 12/18] pf: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 13/18] pktcdvd: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 14/18] rnbd-clt: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 15/18] swim: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 6:54 ` Finn Thain 2022-10-05 6:54 ` Finn Thain 2022-10-05 5:00 ` [RFC PATCH 16/18] swim3: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 17/18] z2ram: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni 2022-10-05 5:00 ` [RFC PATCH 18/18] ubi: " Chaitanya Kulkarni 2022-10-05 5:00 ` Chaitanya Kulkarni
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221005050027.39591-12-kch@nvidia.com \ --to=kch@nvidia.com \ --cc=axboe@kernel.dk \ --cc=bvanassche@acm.org \ --cc=christoph.boehmwalder@linbit.com \ --cc=damien.lemoal@opensource.wdc.com \ --cc=drbd-dev@lists.linbit.com \ --cc=efremov@linux.com \ --cc=hare@suse.de \ --cc=haris.iqbal@ionos.com \ --cc=jinpu.wang@ionos.com \ --cc=johannes.thumshirn@wdc.com \ --cc=josef@toxicpanda.com \ --cc=lars.ellenberg@linbit.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-m68k@lists.linux-m68k.org \ --cc=linux-mtd@lists.infradead.org \ --cc=mcgrof@kernel.org \ --cc=ming.lei@redhat.com \ --cc=miquel.raynal@bootlin.com \ --cc=nbd@other.debian.org \ --cc=ogeert@linux-m68k.org \ --cc=philipp.reisner@linbit.com \ --cc=richard@nod.at \ --cc=shinichiro.kawasaki@wdc.com \ --cc=tim@cyberelk.net \ --cc=vigneshr@ti.com \ --cc=vincent.fu@samsung.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.