lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141022235614.GF1193@ld-irv-0074>
Date:	Wed, 22 Oct 2014 16:56:14 -0700
From:	Brian Norris <computersforpeace@...il.com>
To:	w.danford@...ctronics-software.com
Cc:	linux-kernel@...r.kernel.org
Subject: Re: source file /drivers/base/platform.c

On Wed, Oct 22, 2014 at 04:09:55PM -0700, w.danford@...ctronics-software.com wrote:
> /**
>  * platform_get_resource - get a resource for a device
>  * @dev: platform device
>  * @type: resource type
>  * @num: resource index
>  */
> struct resource *platform_get_resource(struct platform_device *dev,
> 				       unsigned int type, unsigned int num)
[...]
> As a result I now suggest a more specific definition is desirable.
> The definition of the 'num' is the offset index for the specific
> resource 'type' to be searched for ignoring all others not of this
> 'type'. ... still convoluted.  By example, first resource of 'type'
> is num=0, second resource of 'type' is num=1 even though say they
> may be [1] and [3] in the complete resource array of resource structs.
> 
> Note my example has type IORESOURCE_MEM as members [0] and [2] in the
> arrya.  So to look for [2] it is the second, num = 1, of type
> IORESOURCE_MEM.
> 
> In conclusion this is a documentation issue!

You spent a lot of words to get to this point! Yes, the problem is with
the assumptions you were making, not with the implementation of
platform_get_resource().

AIUI, your latest interpretation is correct. The indexing of resources
is on a per-resource-type basis. So you're requesting the Nth resource
of type M when type=M and num=N.

Feel free to send a proper patch to improve the comments above
platform_get_resource(), if you think that will help the next person to
come across this API.

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ