RE: [PATCH] treewide: Convert uses of struct resource * toresource_size(ptr)

From: H Hartley Sweeten
Date: Tue Jun 07 2011 - 14:27:47 EST


On Monday, June 06, 2011 6:05 PM, Joe Perches wrote:
> Done via coccinelle script:
>
> struct resource *ptr;
> @@
>
> - ptr->end - ptr->start + 1
> + resource_size(ptr)
>
> Mostly uncompiled, not enough cross-compilers.
>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
>
>> I think most of the offenders were caught back in late 2009.
>
> There are quite a few left...

FWIW, your patch missed a couple...


> arch/arm/plat-s5p/sysmmu.c | 2 +-

((res->end) - (res->start)) + 1

arch/arm/plat-samsung/pm-check.c

(u32)(res->end - res->start)+1

arch/mips/pci/ops-tx3927.c

channel->io_resource->end - channel->io_resource->start;
channel->mem_resource->end - channel->mem_resource->start;

These two look like they are missing the + 1.

> arch/powerpc/sysdev/ppc4xx_pci.c | 6 +++---

res->end + 1 - res->start

drivers/acpi/apei/apei-base.c

res->end - res->start

There are a couple of these, they look like they are missing the + 1.

drivers/gpio/gpio-u300.c

memres->end - memres->start

Missing + 1.

drivers/message/i2o/iop.c

1 + res->end - res->start

drivers/mtd/maps/ixp2000.c

dev->resource->end - dev->resource->start + 1

drivers/mtd/maps/sa1100-flash.c

phys = res->start;
size = res->end - phys + 1;

drivers/rtc/rtc-cmos.c

ports->end + 1 - ports->start

drivers/rtc/rtc-mrst.c

iomem->end + 1 - iomem->start

drivers/video/mb862xx/mb862xxfbdrv.c

1 + par->res->end - par->res->start

drivers/video/mbx/mbxfb.c

#define res_size(_r) (((_r)->end - (_r)->start) + 1)

drivers/video/msm/mdp.c

resource->end - resource->start

Missing + 1.

drivers/video/msm/msm_fb.c

resource->end - resource->start

Missing + 1.


There are also a number that look like:

res.end - res.start + 1
and
res.end + 1 - res.start


Regards,
Hartley
¢éì®&Þ~º&¶¬–+-±éÝ¥Šw®žË±Êâmébžìdz¹Þ)í…æèw*jg¬±¨¶‰šŽŠÝj/êäz¹ÞŠà2ŠÞ¨è­Ú&¢)ß«a¶Úþø®G«éh®æj:+v‰¨Šwè†Ù>Wš±êÞiÛaxPjØm¶Ÿÿà -»+ƒùdš_