From: Christoph Hellwig <hch@lst.de>
To: Dan Williams <dan.j.williams@intel.com>
Cc: axboe@fb.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH 1/3] block: introduce device_add_disk()
Date: Thu, 10 Mar 2016 09:09:41 +0100 [thread overview]
Message-ID: <20160310080940.GA773@lst.de> (raw)
In-Reply-To: <20160225200443.21975.77561.stgit@dwillia2-desk3.amr.corp.intel.com>
> /**
> - * add_disk - add partitioning information to kernel list
> + * device_add_disk - add partitioning information to kernel list
> + * @parent: parent device for the disk
> * @disk: per-device partitioning information
> *
> * This function registers the partitioning information in @disk
> @@ -581,7 +582,7 @@ exit:
> *
> * FIXME: error handling
> */
> -void add_disk(struct gendisk *disk)
> +int device_add_disk(struct device *parent, struct gendisk *disk)
> {
> struct backing_dev_info *bdi;
> dev_t devt;
> @@ -597,10 +598,8 @@ void add_disk(struct gendisk *disk)
> disk->flags |= GENHD_FL_UP;
>
> retval = blk_alloc_devt(&disk->part0, &devt);
> - if (retval) {
> - WARN_ON(1);
> - return;
> - }
> + if (retval)
> + return retval;
> disk_to_dev(disk)->devt = devt;
>
> /* ->major and ->first_minor aren't supposed to be
> @@ -617,7 +616,7 @@ void add_disk(struct gendisk *disk)
>
> blk_register_region(disk_devt(disk), disk->minors, NULL,
> exact_match, exact_lock, disk);
> - register_disk(disk);
> + register_disk(parent, disk);
> blk_register_queue(disk);
>
> /*
> @@ -628,12 +627,11 @@ void add_disk(struct gendisk *disk)
>
> retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj,
> "bdi");
> - WARN_ON(retval);
> -
> disk_add_events(disk);
> blk_integrity_add(disk);
> + return retval;
How are the callers expected to unwind after already having added the
disk?
next prev parent reply other threads:[~2016-03-10 8:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 20:04 [PATCH 0/3] Introduce device_add_disk() to kill gendisk.driverfs_dev Dan Williams
2016-02-25 20:04 ` [PATCH 1/3] block: introduce device_add_disk() Dan Williams
2016-03-10 8:09 ` Christoph Hellwig [this message]
2016-03-10 15:15 ` Dan Williams
2016-03-10 15:18 ` Christoph Hellwig
2016-03-10 15:27 ` Dan Williams
2016-02-25 20:04 ` [PATCH 2/3] block: convert to device_add_disk() Dan Williams
2016-02-25 20:04 ` [PATCH 3/3] block: remove ->driverfs_dev Dan Williams
2016-03-09 17:38 ` [PATCH 0/3] Introduce device_add_disk() to kill gendisk.driverfs_dev Dan Williams
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=20160310080940.GA773@lst.de \
--to=hch@lst.de \
--cc=axboe@fb.com \
--cc=dan.j.williams@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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