Skip to contentSkip to conversation

hwmon: lm63: Use ARRAY_SIZE at appropriate place

PATCH New Axel Lin 2 participants 4 messages Jun 22, 2013 – Jun 26, 2013

Subsystems (4)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/3 hwmon: lm63: Use ARRAY_SIZE at appropriate place

---
 drivers/hwmon/lm63.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwmon/lm63.c +1 -2
index f3adf64..bb8e644 100644
@@ -133,8 +133,7 @@ int dtt_init_one(int sensor)
 	/*
 	 * Setup PWM Lookup-Table
 	 */
-	for (i = 0; i < sizeof(pwm_lookup) / sizeof(struct pwm_lookup_entry);
-	     i++) {
+	for (i = 0; i < ARRAY_SIZE(pwm_lookup); i++) {
 		int address = DTT_PWM_LOOKUP_BASE + 2 * i;
 		val = pwm_lookup[i].temp;
 		if (is_lm64(sensor))
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 2/3 mtd: cfi_flash: Use ARRAY_SIZE at appropriate places

---
 drivers/mtd/cfi_flash.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mtd/cfi_flash.c +3 -4
index 25f8752..a13b0b8 100644
@@ -1797,7 +1797,7 @@ static int flash_detect_legacy(phys_addr_t base, int banknum)
 			};
 			int i;
 
-			for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++) {
+			for (i = 0; i < ARRAY_SIZE(modes); i++) {
 				info->vendor = modes[i];
 				info->start[0] =
 					(ulong)map_physmem(base,
@@ -1883,8 +1883,7 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry)
 	/* Issue FLASH reset command */
 	flash_cmd_reset(info);
 
-	for (cfi_offset=0;
-	     cfi_offset < sizeof(flash_offset_cfi) / sizeof(uint);
+	for (cfi_offset = 0; cfi_offset < ARRAY_SIZE(flash_offset_cfi);
 	     cfi_offset++) {
 		flash_write_cmd (info, 0, flash_offset_cfi[cfi_offset],
 				 FLASH_CMD_CFI);
@@ -2336,7 +2335,7 @@ void flash_protect_default(void)
 #endif
 
 #if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST)
-	for (i = 0; i < (sizeof(apl) / sizeof(struct apl_s)); i++) {
+	for (i = 0; i < ARRAY_SIZE(apl); i++) {
 		debug("autoprotecting from %08lx to %08lx\n",
 		      apl[i].start, apl[i].start + apl[i].size - 1);
 		flash_protect(FLAG_PROTECT_SET,
Signature · 1 line
1.8.1.2
author
#2 lore raw

PATCH 3/3 usb: musb: Use ARRAY_SIZE at appropriate places

In reply to Axel Lin
---
 drivers/usb/musb/musb_hcd.c | 3 +--
 drivers/usb/musb/musb_udc.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/usb/musb/musb_hcd.c +1 -2
index 60e03a4..7bb91e5 100644
@@ -1105,8 +1105,7 @@ int usb_lowlevel_init(int index, void **controller)
 
 	/* Configure all the endpoint FIFO's and start usb controller */
 	musbr = musb_cfg.regs;
-	musb_configure_ep(&epinfo[0],
-			sizeof(epinfo) / sizeof(struct musb_epinfo));
+	musb_configure_ep(&epinfo[0], ARRAY_SIZE(epinfo));
 	musb_start();
 
 	/*
drivers/usb/musb/musb_udc.c +1 -2
index e0b4217..e8a2ce0 100644
@@ -894,8 +894,7 @@ void udc_setup_ep(struct usb_device_instance *device, unsigned int id,
 			epinfo[id * 2].epsize = endpoint->rcv_packetSize;
 		}
 
-		musb_configure_ep(&epinfo[0],
-				  sizeof(epinfo) / sizeof(struct musb_epinfo));
+		musb_configure_ep(&epinfo[0], ARRAY_SIZE(epinfo));
 	} else {
 		if (debug_level > 0)
 			serial_printf("ERROR : %s endpoint request %d "
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 1/3 hwmon: lm63: Use ARRAY_SIZE at appropriate place

In reply to Axel Lin
Quoted 5 lines · Axel Lin

---
drivers/hwmon/lm63.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)

This, along with the rest of the series is now applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130626/83121c8f/attachment.pgp>