diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2013-03-24 16:09:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-25 06:51:52 -0400 |
commit | fa74aca3a3decbd8e8ff2f25ef86edcc61222455 (patch) | |
tree | 44c80e0da314797d8c985941f1a124994ae144d1 | |
parent | d230d5ad0bca1c2d90b387549d4eebafabd60569 (diff) |
[media] em28xx-i2c: fix coding style of multi line comments
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-i2c.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index db40835888d1..704f283d34ab 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -171,8 +171,10 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, | |||
171 | 171 | ||
172 | if (len < 1 || len > 64) | 172 | if (len < 1 || len > 64) |
173 | return -EOPNOTSUPP; | 173 | return -EOPNOTSUPP; |
174 | /* NOTE: limited by the USB ctrl message constraints | 174 | /* |
175 | * Zero length reads always succeed, even if no device is connected */ | 175 | * NOTE: limited by the USB ctrl message constraints |
176 | * Zero length reads always succeed, even if no device is connected | ||
177 | */ | ||
176 | 178 | ||
177 | /* Write to i2c device */ | 179 | /* Write to i2c device */ |
178 | ret = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); | 180 | ret = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); |
@@ -202,9 +204,11 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, | |||
202 | return ret; | 204 | return ret; |
203 | } | 205 | } |
204 | msleep(5); | 206 | msleep(5); |
205 | /* NOTE: do we really have to wait for success ? | 207 | /* |
206 | Never seen anything else than 0x00 or 0x10 | 208 | * NOTE: do we really have to wait for success ? |
207 | (even with high payload) ... */ | 209 | * Never seen anything else than 0x00 or 0x10 |
210 | * (even with high payload) ... | ||
211 | */ | ||
208 | } | 212 | } |
209 | em28xx_warn("write to i2c device at 0x%x timed out\n", addr); | 213 | em28xx_warn("write to i2c device at 0x%x timed out\n", addr); |
210 | return -EIO; | 214 | return -EIO; |
@@ -220,8 +224,10 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) | |||
220 | 224 | ||
221 | if (len < 1 || len > 64) | 225 | if (len < 1 || len > 64) |
222 | return -EOPNOTSUPP; | 226 | return -EOPNOTSUPP; |
223 | /* NOTE: limited by the USB ctrl message constraints | 227 | /* |
224 | * Zero length reads always succeed, even if no device is connected */ | 228 | * NOTE: limited by the USB ctrl message constraints |
229 | * Zero length reads always succeed, even if no device is connected | ||
230 | */ | ||
225 | 231 | ||
226 | /* Read data from i2c device */ | 232 | /* Read data from i2c device */ |
227 | ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len); | 233 | ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len); |
@@ -230,7 +236,8 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) | |||
230 | addr, ret); | 236 | addr, ret); |
231 | return ret; | 237 | return ret; |
232 | } | 238 | } |
233 | /* NOTE: some devices with two i2c busses have the bad habit to return 0 | 239 | /* |
240 | * NOTE: some devices with two i2c busses have the bad habit to return 0 | ||
234 | * bytes if we are on bus B AND there was no write attempt to the | 241 | * bytes if we are on bus B AND there was no write attempt to the |
235 | * specified slave address before AND no device is present at the | 242 | * specified slave address before AND no device is present at the |
236 | * requested slave address. | 243 | * requested slave address. |
@@ -366,9 +373,10 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
366 | return num; | 373 | return num; |
367 | } | 374 | } |
368 | 375 | ||
369 | /* based on linux/sunrpc/svcauth.h and linux/hash.h | 376 | /* |
377 | * based on linux/sunrpc/svcauth.h and linux/hash.h | ||
370 | * The original hash function returns a different value, if arch is x86_64 | 378 | * The original hash function returns a different value, if arch is x86_64 |
371 | * or i386. | 379 | * or i386. |
372 | */ | 380 | */ |
373 | static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits) | 381 | static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits) |
374 | { | 382 | { |
@@ -391,8 +399,10 @@ static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits) | |||
391 | return (hash >> (32 - bits)) & 0xffffffffUL; | 399 | return (hash >> (32 - bits)) & 0xffffffffUL; |
392 | } | 400 | } |
393 | 401 | ||
394 | /* Helper function to read data blocks from i2c clients with 8 or 16 bit | 402 | /* |
395 | * address width, 8 bit register width and auto incrementation been activated */ | 403 | * Helper function to read data blocks from i2c clients with 8 or 16 bit |
404 | * address width, 8 bit register width and auto incrementation been activated | ||
405 | */ | ||
396 | static int em28xx_i2c_read_block(struct em28xx *dev, unsigned bus, u16 addr, | 406 | static int em28xx_i2c_read_block(struct em28xx *dev, unsigned bus, u16 addr, |
397 | bool addr_w16, u16 len, u8 *data) | 407 | bool addr_w16, u16 len, u8 *data) |
398 | { | 408 | { |
@@ -434,9 +444,11 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
434 | u8 **eedata, u16 *eedata_len) | 444 | u8 **eedata, u16 *eedata_len) |
435 | { | 445 | { |
436 | const u16 len = 256; | 446 | const u16 len = 256; |
437 | /* FIXME common length/size for bytes to read, to display, hash | 447 | /* |
448 | * FIXME common length/size for bytes to read, to display, hash | ||
438 | * calculation and returned device dataset. Simplifies the code a lot, | 449 | * calculation and returned device dataset. Simplifies the code a lot, |
439 | * but we might have to deal with multiple sizes in the future ! */ | 450 | * but we might have to deal with multiple sizes in the future ! |
451 | */ | ||
440 | int i, err; | 452 | int i, err; |
441 | struct em28xx_eeprom *dev_config; | 453 | struct em28xx_eeprom *dev_config; |
442 | u8 buf, *data; | 454 | u8 buf, *data; |
@@ -497,7 +509,8 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
497 | em28xx_info("EEPROM info:\n"); | 509 | em28xx_info("EEPROM info:\n"); |
498 | em28xx_info("\tmicrocode start address = 0x%04x, boot configuration = 0x%02x\n", | 510 | em28xx_info("\tmicrocode start address = 0x%04x, boot configuration = 0x%02x\n", |
499 | mc_start, data[2]); | 511 | mc_start, data[2]); |
500 | /* boot configuration (address 0x0002): | 512 | /* |
513 | * boot configuration (address 0x0002): | ||
501 | * [0] microcode download speed: 1 = 400 kHz; 0 = 100 kHz | 514 | * [0] microcode download speed: 1 = 400 kHz; 0 = 100 kHz |
502 | * [1] always selects 12 kb RAM | 515 | * [1] always selects 12 kb RAM |
503 | * [2] USB device speed: 1 = force Full Speed; 0 = auto detect | 516 | * [2] USB device speed: 1 = force Full Speed; 0 = auto detect |
@@ -506,8 +519,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
506 | * characterization | 519 | * characterization |
507 | */ | 520 | */ |
508 | 521 | ||
509 | /* Read hardware config dataset offset from address | 522 | /* |
510 | * (microcode start + 46) */ | 523 | * Read hardware config dataset offset from address |
524 | * (microcode start + 46) | ||
525 | */ | ||
511 | err = em28xx_i2c_read_block(dev, bus, mc_start + 46, 1, 2, | 526 | err = em28xx_i2c_read_block(dev, bus, mc_start + 46, 1, 2, |
512 | data); | 527 | data); |
513 | if (err != 2) { | 528 | if (err != 2) { |
@@ -520,7 +535,8 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
520 | hwconf_offset = mc_start + data[0] + (data[1] << 8); | 535 | hwconf_offset = mc_start + data[0] + (data[1] << 8); |
521 | 536 | ||
522 | /* Read hardware config dataset */ | 537 | /* Read hardware config dataset */ |
523 | /* NOTE: the microcode copy can be multiple pages long, but | 538 | /* |
539 | * NOTE: the microcode copy can be multiple pages long, but | ||
524 | * we assume the hardware config dataset is the same as in | 540 | * we assume the hardware config dataset is the same as in |
525 | * the old eeprom and not longer than 256 bytes. | 541 | * the old eeprom and not longer than 256 bytes. |
526 | * tveeprom is currently also limited to 256 bytes. | 542 | * tveeprom is currently also limited to 256 bytes. |