<div dir="ltr">Is it somehow possible to say to kernel user in probe function that when parsing from device tree such entry:<div>reg = <0 0xffff0000 0 0x4>;</div><div>red-names = "some_name";</div><div><br></div><div>inform user that he can set in device tree only 32 bits of address?</div><div>probe(</div><div>....</div><div>struct resource *res;<br><div><div> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "some_name");<br></div><div> if(res!) </div><div> return -EINVAL;</div><div><br></div><div>if(res->start > 0xFFFFFFFF) //this doesn't make sense</div><div>{</div><div> //pr_error("%s, only max 32 bits are supported\n", __func__);</div><div> return -EINVAL;</div><div>}<br><div><br></div><div><br></div><div>start variable in struct resource is type of resource_size_t.</div><div>On 32 bit arch this type is u32 and on 64 bit arch it is 64. Nevertheless on each architecture I want my driver supports only 32 bits.</div><div>I wonder if driver has to be such perfect and robust for everything user set in device tree or just information in kernel driver doc would be enough that user cannot set more than 32 bits.</div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 3, 2020 at 2:39 PM Tomek The Messenger <<a href="mailto:tomekthemessenger@gmail.com">tomekthemessenger@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">ok, for me strange was this ranges[0] declaration. I found other way to get to know mmio regmap size, just to remember pointer to struct resource* in private data in probe when parsing from device tree reg=<address, size></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 2, 2020 at 2:15 PM Greg KH <<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Apr 02, 2020 at 01:48:23PM +0200, Tomek The Messenger wrote:<br>
> Hi<br>
> Let's see how it looks:<br>
> <a href="https://github.com/u-boot/u-boot/blob/master/include/regmap.h" rel="noreferrer" target="_blank">https://github.com/u-boot/u-boot/blob/master/include/regmap.h</a><br>
> <br>
> I first time ever see such thing like this:<br>
> struct regmap_range {<br>
> ulong start;<br>
> ulong size;<br>
> };<br>
> struct regmap {<br>
> enum regmap_endianness_t endianness;<br>
> int range_count;<br>
> struct regmap_range ranges[0];<br>
> };<br>
> <br>
> How I can get access to variable ranges it if is 0 size? Who develops this<br>
> one and who reviewed:)<br>
<br>
It is very common and standard C coding style. It happens all the time<br>
when you have a variable of unknown length at declaration time.<br>
<br>
> Anyway If I have pointer to regmap can I check what is start variable in<br>
> some other way?<br>
<br>
What other way do you need to check it?<br>
<br>
Why do you think the above code is incorrect? What do you think it<br>
should look like?<br>
<br>
thanks,<br>
<br>
greg k-h<br>
</blockquote></div>
</blockquote></div>