Re: [RFC 05/10] resource: add create_resource() helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 15, 2014 at 11:38:29AM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>
> ---
>  common/resource.c      | 15 +++++++++++++++
>  include/linux/ioport.h |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/common/resource.c b/common/resource.c
> index fe4680e..b6c7c87 100644
> --- a/common/resource.c
> +++ b/common/resource.c
> @@ -143,3 +143,18 @@ struct resource *request_ioport_region(const char *name,
>  {
>  	return __request_region(&ioport_resource, name, start, end);
>  }
> +
> +struct resource *create_resource(const char *name,
> +	resource_size_t start, resource_size_t end)
> +{
> +	struct resource *t;
> +
> +	t = xzalloc(sizeof *t);
> +	INIT_LIST_HEAD(&t->children);
> +	t->parent = NULL;
> +	t->name = xstrdup(name);
> +	t->start = start;
> +	t->end = end;

How about calling init_resource() and skip the fields already initialized
there from this function? This makes sure new fields in struct resource
can be initialized in a single place.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux