linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: hch <hch@lst.de>
Cc: anton ivanov <anton.ivanov@cambridgegreys.com>,
	 Johannes Berg <johannes@sipsolutions.net>,
	 Jens Axboe <axboe@kernel.dk>,
	 linux-um <linux-um@lists.infradead.org>,
	 linux-block <linux-block@vger.kernel.org>
Subject: Re: [PATCH 2/7] ubd: remove ubd_disk_register
Date: Tue, 27 Feb 2024 21:56:26 +0100 (CET)	[thread overview]
Message-ID: <306297747.106429.1709067386425.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20240222072417.3773131-3-hch@lst.de>

----- Ursprüngliche Mail -----
> Von: "hch" <hch@lst.de>
> An: "richard" <richard@nod.at>, "anton ivanov" <anton.ivanov@cambridgegreys.com>, "Johannes Berg"
> <johannes@sipsolutions.net>, "Jens Axboe" <axboe@kernel.dk>
> CC: "linux-um" <linux-um@lists.infradead.org>, "linux-block" <linux-block@vger.kernel.org>
> Gesendet: Donnerstag, 22. Februar 2024 08:24:12
> Betreff: [PATCH 2/7] ubd: remove ubd_disk_register

> Fold it into the only caller to remove lots of references to the
> global ubd_devs array.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/um/drivers/ubd_kern.c | 37 +++++++++++++++----------------------
> 1 file changed, 15 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index b203ebb1785125..ef05157acd6b02 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -849,27 +849,6 @@ static const struct attribute_group *ubd_attr_groups[] = {
> 	NULL,
> };
> 
> -static int ubd_disk_register(int major, u64 size, int unit,
> -			     struct gendisk *disk)
> -{
> -	disk->major = major;
> -	disk->first_minor = unit << UBD_SHIFT;
> -	disk->minors = 1 << UBD_SHIFT;
> -	disk->fops = &ubd_blops;
> -	set_capacity(disk, size / 512);
> -	sprintf(disk->disk_name, "ubd%c", 'a' + unit);
> -
> -	ubd_devs[unit].pdev.id   = unit;
> -	ubd_devs[unit].pdev.name = DRIVER_NAME;
> -	ubd_devs[unit].pdev.dev.release = ubd_device_release;
> -	dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);
> -	platform_device_register(&ubd_devs[unit].pdev);
> -
> -	disk->private_data = &ubd_devs[unit];
> -	disk->queue = ubd_devs[unit].queue;
> -	return device_add_disk(&ubd_devs[unit].pdev.dev, disk, ubd_attr_groups);
> -}
> -
> #define ROUND_BLOCK(n) ((n + (SECTOR_SIZE - 1)) & (-SECTOR_SIZE))
> 
> static const struct blk_mq_ops ubd_mq_ops = {
> @@ -916,7 +895,21 @@ static int ubd_add(int n, char **error_out)
> 	ubd_dev->queue = disk->queue;
> 
> 	blk_queue_write_cache(ubd_dev->queue, true, false);
> -	err = ubd_disk_register(UBD_MAJOR, ubd_dev->size, n, disk);
> +	disk->major = UBD_MAJOR;
> +	disk->first_minor = n << UBD_SHIFT;
> +	disk->minors = 1 << UBD_SHIFT;
> +	disk->fops = &ubd_blops;
> +	set_capacity(disk, ubd_dev->size / 512);
> +	sprintf(disk->disk_name, "ubd%c", 'a' + n);
> +	disk->private_data = ubd_dev;
> +
> +	ubd_dev->pdev.id = n;
> +	ubd_dev->pdev.name = DRIVER_NAME;
> +	ubd_dev->pdev.dev.release = ubd_device_release;
> +	dev_set_drvdata(&ubd_dev->pdev.dev, ubd_dev);
> +	platform_device_register(&ubd_dev->pdev);
> +
> +	err = device_add_disk(&ubd_dev->pdev.dev, disk, ubd_attr_groups);
> 	if (err)
> 		goto out_cleanup_disk;
> 
> --
> 2.39.2

Reviewed-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard

  reply	other threads:[~2024-02-27 20:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  7:24 ubd cleanups Christoph Hellwig
2024-02-22  7:24 ` [PATCH 1/7] ubd: remove the ubd_gendisk array Christoph Hellwig
2024-02-27 20:52   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 2/7] ubd: remove ubd_disk_register Christoph Hellwig
2024-02-27 20:56   ` Richard Weinberger [this message]
2024-02-22  7:24 ` [PATCH 3/7] ubd: move setting the nonrot flag to ubd_add Christoph Hellwig
2024-02-27 20:56   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 4/7] ubd: move setting the variable queue limits " Christoph Hellwig
2024-02-27 21:00   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 5/7] ubd: move set_disk_ro " Christoph Hellwig
2024-02-27 21:00   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 6/7] ubd: remove the queue pointer in struct ubd Christoph Hellwig
2024-02-27 21:01   ` Richard Weinberger
2024-02-22  7:24 ` [PATCH 7/7] ubd: open the backing files in ubd_add Christoph Hellwig
2024-02-27 21:05   ` Richard Weinberger
2024-02-27 21:21 ` ubd cleanups Jens Axboe

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=306297747.106429.1709067386425.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).