[U-Boot] [PATCH v2 3/4] block: ide: Don't bother to create BLK device if no CDROM inserted

Bin Meng bmeng.cn at gmail.com
Tue Sep 5 09:04:07 UTC 2017


Hi Simon,

On Tue, Sep 5, 2017 at 4:56 PM, Simon Glass <sjg at chromium.org> wrote:
> On 4 September 2017 at 17:08, Bin Meng <bmeng.cn at gmail.com> wrote:
>> 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 at gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>>  drivers/block/ide.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>
> Reviewed-by: Simon Glass <sjg at chromium.org>
>
>
>> diff --git a/drivers/block/ide.c b/drivers/block/ide.c
>> index 58b295e..8125ff8 100644
>> --- a/drivers/block/ide.c
>> +++ b/drivers/block/ide.c
>> @@ -1197,6 +1197,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.
>> +                        */
>
> I suppose that if you insert one, you then need to rerun the ide scan
> to find it?
>

Yes, we need call "ide reset" from the U-Boot shell, like we do for USB.

>> +                       if (!blksz)
>> +                               continue;
>>                         ret = blk_create_devicef(udev, "ide_blk", name,
>>                                                  IF_TYPE_IDE, i,
>>                                                  blksz, size, &blk_dev);
>> --

Regards,
Bin


More information about the U-Boot mailing list