Skip to contentSkip to conversation

vr41xx: ARRAY_SIZE cleanup

PATCH In review Jean Delvare 1 participant 2 messages Jan 7, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vr41xx: ARRAY_SIZE cleanup

Hi Andrew,

Can you please pick this patch for -mm? I sent it to Yoichi Yuasa one month ago but didn't get any answer. Thanks.

Content-Disposition: inline; filename=vr41xx-array-size-cleanup.patch

Possible ARRAY_SIZE cleanup for the vr41xx_rtc driver.

---
 drivers/char/vr41xx_rtc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/char/vr41xx_rtc.c +2 -3
@@ -127,8 +127,6 @@
 		.flags	= IORESOURCE_MEM,	},
 };
 
-#define RTC_NUM_RESOURCES	sizeof(rtc_resource) / sizeof(struct resource)
-
 static inline unsigned long read_elapsed_second(void)
 {
 	unsigned long first_low, first_mid, first_high;
@@ -686,7 +684,8 @@
 		break;
 	}
 
-	rtc_platform_device = platform_device_register_simple("RTC", -1, rtc_resource, RTC_NUM_RESOURCES);
+	rtc_platform_device = platform_device_register_simple("RTC", -1,
+			      rtc_resource, ARRAY_SIZE(rtc_resource));
 	if (IS_ERR(rtc_platform_device))
 		return PTR_ERR(rtc_platform_device);
 
Signature · 1 line
Jean Delvare
#1 lore raw

Quoting myself:

Quoted 2 lines

Can you please pick this patch for -mm? I sent it to Yoichi Yuasa one month ago but didn't get any answer. Thanks.

Oops, I just realized (two minutes too late, of course) that you already have a similar, but different, fix for this driver (as part of drivers-char-use-array_size-macro.patch). So, please consider this new patch instead, which should apply properly on top of your current stack. Thanks, and sorry for the noise.

Content-Disposition: inline; filename=vr41xx-rtc-num-resources-cleanup.patch

No need to define RTC_NUM_RESOURCES, it doesn't add any value to the code.

---
 drivers/char/vr41xx_rtc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/char/vr41xx_rtc.c +2 -3
@@ -127,8 +127,6 @@
 		.flags	= IORESOURCE_MEM,	},
 };
 
-#define RTC_NUM_RESOURCES	ARRAY_SIZE(rtc_resource)
-
 static inline unsigned long read_elapsed_second(void)
 {
 	unsigned long first_low, first_mid, first_high;
@@ -686,7 +684,8 @@
 		break;
 	}
 
-	rtc_platform_device = platform_device_register_simple("RTC", -1, rtc_resource, RTC_NUM_RESOURCES);
+	rtc_platform_device = platform_device_register_simple("RTC", -1,
+			      rtc_resource, ARRAY_SIZE(rtc_resource));
 	if (IS_ERR(rtc_platform_device))
 		return PTR_ERR(rtc_platform_device);
 
Signature · 1 line
Jean Delvare