Re: [patch] rapidio: use resource_size()

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

 



On Thu, Oct 28, 2010 at 10:06 PM, Dan Carpenter <error27@xxxxxxxxx> wrote:
> The size calculation is done incorrectly here because it should include
> both the start and end (end - start + 1). ÂIt's easiest to just use
> resource_size() which does the right thing.
>
> I was worried there was something non-standard going on because the
> printk() subtracts "end - 1", but the rest of the file uses the normal
> resource size calculations. ÂThis function is only called from

Looks like a non-standard hack to make the res.end equal to actual end
+ 1.  I have updated the fsl_rio.c to use standard resource semantic,
so the hack was long broken.

> fsl_rio_setup() in arch/powerpc/sysdev/fsl_rio.c and the calculation
> there is also:
> Â Â Â Âport->iores.start = law_start;
> Â Â Â Âport->iores.end = law_start + law_size - 1;
> So I think this is the correct fix.
>
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

Acked-by: Li Yang <leoli@xxxxxxxxxxxxx>

> ---
> Compile tested only.
>
> diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
> index 68cf0c9..7b5080c 100644
> --- a/drivers/rapidio/rio.c
> +++ b/drivers/rapidio/rio.c
> @@ -1159,11 +1159,11 @@ int __devinit rio_init_mports(void)
>
> Â Â Â Âlist_for_each_entry(port, &rio_mports, node) {
> Â Â Â Â Â Â Â Âif (!request_mem_region(port->iores.start,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â port->iores.end - port->iores.start,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â resource_size(&port->iores),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âport->name)) {
> Â Â Â Â Â Â Â Â Â Â Â Âprintk(KERN_ERR
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "RIO: Error requesting master port region 0x%016llx-0x%016llx\n",
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â(u64)port->iores.start, (u64)port->iores.end - 1);
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â(u64)port->iores.start, (u64)port->iores.end);
> Â Â Â Â Â Â Â Â Â Â Â Ârc = -ENOMEM;
> Â Â Â Â Â Â Â Â Â Â Â Âgoto out;
> Â Â Â Â Â Â Â Â}
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/
>



-- 
- Leo
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux