
On 09/21/2012 06:53 AM, Rob Herring wrote:
On 09/18/2012 05:37 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
This patch introduces function get_device(). This looks up a block_dev_desc_t from an interface name (e.g. mmc) and device number (e.g. 0). This function is essentially the non-partition-specific prefix of get_device_and_partition().
+int get_device(const char *ifname, const char *dev_str,
block_dev_desc_t **dev_desc)
+{
- char *ep;
- int dev;
Why don't you look up bootdevice here? That would be more consistent behavior.
bootdevice names a partition (or can name a partition), whereas this function is about retrieving a device handle and never a partition handle.
I'm not sure it makes semantic sense to always fall back to bootdevice for commands that call get_device() directly. I'd far prefer people to always just pass the device they want to a command rather than relying implicitly on environment variables.
If we did read bootdevice here, we'd end up having to read/parse it in both get_device() and get_device_and_partition(), here to extract just the device portion and in get_device_and_partition() to extract just the partition portion. And we'd have to make sure the code here only allowed the user to specify a partition /if/ this function was called from get_device_and_partition() and not if a command called it directly. That all seems a bit complex.