public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 3/4] block: ide: Don't bother to create BLK device if no CDROM inserted
Date: Sun, 10 Sep 2017 05:12:52 -0700	[thread overview]
Message-ID: <1505045573-11552-3-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1505045573-11552-1-git-send-email-bmeng.cn@gmail.com>

When there is no CDROM inserted, the block size is zero hence there
is no need to create a BLK device for it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/block/ide.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index ed3b27e..9ab01a9 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -1202,6 +1202,13 @@ static int ide_probe(struct udevice *udev)
 
 			blksz = ide_dev_desc[i].blksz;
 			size = blksz * ide_dev_desc[i].lba;
+
+			/*
+			 * With CDROM, if there is no CD inserted, blksz will
+			 * be zero, don't bother to create IDE block device.
+			 */
+			if (!blksz)
+				continue;
 			ret = blk_create_devicef(udev, "ide_blk", name,
 						 IF_TYPE_IDE, i,
 						 blksz, size, &blk_dev);
-- 
2.9.2

  parent reply	other threads:[~2017-09-10 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10 12:12 [U-Boot] [PATCH v4 1/4] blk: Use macros for block device vendor/product/rev string size Bin Meng
2017-09-10 12:12 ` [U-Boot] [PATCH v4 2/4] block: ide: Fix block read/write with driver model Bin Meng
2017-09-10 22:02   ` Tom Rini
2017-09-10 12:12 ` Bin Meng [this message]
2017-09-10 22:02   ` [U-Boot] [PATCH v4 3/4] block: ide: Don't bother to create BLK device if no CDROM inserted Tom Rini
2017-09-10 12:12 ` [U-Boot] [PATCH v4 4/4] cmd: ide: Make the first device the default one Bin Meng
2017-09-10 22:02   ` Tom Rini
2017-09-10 22:02 ` [U-Boot] [PATCH v4 1/4] blk: Use macros for block device vendor/product/rev string size Tom Rini

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=1505045573-11552-3-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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