All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 3/8] disk: introduce get_device()
Date: Tue, 18 Sep 2012 20:25:31 -0500	[thread overview]
Message-ID: <50591F0B.7060504@gmail.com> (raw)
In-Reply-To: <50591E2E.3070208@gmail.com>

On 09/18/2012 08:21 PM, 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().
> 
> Then shouldn't get_device_and_partition just call get_device. Perhaps
> create get_partition() and then get_device_and_partition is just a wrapper.
> 

I should read all the way through the series before replying...

Anyway, I would squash it all unless you want to have restructuring with
current functionality and then enhancements.

Rob

> Rob
> 
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> v3: New patch.
>> ---
>>  disk/part.c    |   22 ++++++++++++++++++++++
>>  include/part.h |    5 +++++
>>  2 files changed, 27 insertions(+), 0 deletions(-)
>>
>> diff --git a/disk/part.c b/disk/part.c
>> index 277a243..9920d48 100644
>> --- a/disk/part.c
>> +++ b/disk/part.c
>> @@ -435,6 +435,28 @@ void print_part (block_dev_desc_t * dev_desc)
>>  
>>  #endif
>>  
>> +int get_device(const char *ifname, const char *dev_str,
>> +	       block_dev_desc_t **dev_desc)
>> +{
>> +	char *ep;
>> +	int dev;
>> +
>> +	dev = simple_strtoul(dev_str, &ep, 16);
>> +	if (*ep) {
>> +		printf("** Bad device specification %s %s **\n",
>> +		       ifname, dev_str);
>> +		return -1;
>> +	}
>> +
>> +	*dev_desc = get_dev(ifname, dev);
>> +	if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
>> +		printf("** Bad device %s %s **\n", ifname, dev_str);
>> +		return -1;
>> +	}
>> +
>> +	return dev;
>> +}
>> +
>>  #define MAX_SEARCH_PARTITIONS 16
>>  int get_device_and_partition(const char *ifname, const char *dev_str,
>>  			     block_dev_desc_t **dev_desc,
>> diff --git a/include/part.h b/include/part.h
>> index a6d06f3..144df4e 100644
>> --- a/include/part.h
>> +++ b/include/part.h
>> @@ -112,6 +112,8 @@ int get_partition_info (block_dev_desc_t * dev_desc, int part, disk_partition_t
>>  void print_part (block_dev_desc_t *dev_desc);
>>  void  init_part (block_dev_desc_t *dev_desc);
>>  void dev_print(block_dev_desc_t *dev_desc);
>> +int get_device(const char *ifname, const char *dev_str,
>> +	       block_dev_desc_t **dev_desc);
>>  int get_device_and_partition(const char *ifname, const char *dev_str,
>>  			     block_dev_desc_t **dev_desc,
>>  			     disk_partition_t *info);
>> @@ -131,6 +133,9 @@ static inline int get_partition_info (block_dev_desc_t * dev_desc, int part,
>>  static inline void print_part (block_dev_desc_t *dev_desc) {}
>>  static inline void  init_part (block_dev_desc_t *dev_desc) {}
>>  static inline void dev_print(block_dev_desc_t *dev_desc) {}
>> +static inline int get_device(const char *ifname, const char *dev_str,
>> +	       block_dev_desc_t **dev_desc)
>> +{ return -1; }
>>  static inline int get_device_and_partition(const char *ifname,
>>  					   const char *dev_str,
>>  					   block_dev_desc_t **dev_desc,
>>
> 

  reply	other threads:[~2012-09-19  1:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 22:37 [U-Boot] [PATCH V3 0/8] disk: "part" command and dependencies Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 1/8] disk: parameterize get_device_and_partition's loop count Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 2/8] disk: fix get_device_and_partition() bootable search Stephen Warren
2012-09-19  1:18   ` Rob Herring
2012-09-18 22:37 ` [U-Boot] [PATCH V3 3/8] disk: introduce get_device() Stephen Warren
2012-09-19  1:21   ` Rob Herring
2012-09-19  1:25     ` Rob Herring [this message]
2012-09-19 17:18       ` Stephen Warren
2012-09-19 18:17       ` Tom Rini
2012-09-21 12:53   ` Rob Herring
2012-09-21 16:09     ` Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 4/8] disk: get_device_and_partition() enhancements Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 5/8] disk: part_efi: range-check partition number Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 6/8] disk: part_efi: parse and store partition UUID Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 7/8] disk: part_msdos: " Stephen Warren
2012-09-18 22:37 ` [U-Boot] [PATCH V3 8/8] cmd_part: add partition-related command Stephen Warren

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=50591F0B.7060504@gmail.com \
    --to=robherring2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.