aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-05-09 19:23:14 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-05-10 12:24:14 -0400
commit2d826cc5c791bdc5f5651324c485746be9492be0 (patch)
tree7c46ff209d06f1f8949aa2c3e10491594d10e203 /drivers
parent213d7bbd76673fb1b26f1786af180bac07e57652 (diff)
firewire: Always use parens with sizeof.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/fw-card.c4
-rw-r--r--drivers/firewire/fw-cdev.c36
-rw-r--r--drivers/firewire/fw-device.c8
-rw-r--r--drivers/firewire/fw-ohci.c28
-rw-r--r--drivers/firewire/fw-sbp2.c46
-rw-r--r--drivers/firewire/fw-topology.c2
-rw-r--r--drivers/firewire/fw-transaction.c6
7 files changed, 65 insertions, 65 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index b8404ee5314c..636151a64add 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -75,7 +75,7 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length)
75 * the version stored in the OHCI registers. 75 * the version stored in the OHCI registers.
76 */ 76 */
77 77
78 memset(config_rom, 0, sizeof config_rom); 78 memset(config_rom, 0, sizeof(config_rom));
79 config_rom[0] = BIB_CRC_LENGTH(4) | BIB_INFO_LENGTH(4) | BIB_CRC(0); 79 config_rom[0] = BIB_CRC_LENGTH(4) | BIB_INFO_LENGTH(4) | BIB_CRC(0);
80 config_rom[1] = 0x31333934; 80 config_rom[1] = 0x31333934;
81 81
@@ -258,7 +258,7 @@ fw_card_bm_work(struct work_struct *work)
258 fw_send_request(card, &bmd.t, TCODE_LOCK_COMPARE_SWAP, 258 fw_send_request(card, &bmd.t, TCODE_LOCK_COMPARE_SWAP,
259 irm_id, generation, 259 irm_id, generation,
260 SCODE_100, CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID, 260 SCODE_100, CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID,
261 &bmd.lock, sizeof bmd.lock, 261 &bmd.lock, sizeof(bmd.lock),
262 complete_bm_lock, &bmd); 262 complete_bm_lock, &bmd);
263 wait_for_completion(&bmd.done); 263 wait_for_completion(&bmd.done);
264 264
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index c876ac3c50e0..0fa5bd54c6a1 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -110,7 +110,7 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
110 if (device == NULL) 110 if (device == NULL)
111 return -ENODEV; 111 return -ENODEV;
112 112
113 client = kzalloc(sizeof *client, GFP_KERNEL); 113 client = kzalloc(sizeof(*client), GFP_KERNEL);
114 if (client == NULL) 114 if (client == NULL)
115 return -ENOMEM; 115 return -ENOMEM;
116 116
@@ -233,7 +233,7 @@ queue_bus_reset_event(struct client *client)
233{ 233{
234 struct bus_reset *bus_reset; 234 struct bus_reset *bus_reset;
235 235
236 bus_reset = kzalloc(sizeof *bus_reset, GFP_ATOMIC); 236 bus_reset = kzalloc(sizeof(*bus_reset), GFP_ATOMIC);
237 if (bus_reset == NULL) { 237 if (bus_reset == NULL) {
238 fw_notify("Out of memory when allocating bus reset event\n"); 238 fw_notify("Out of memory when allocating bus reset event\n");
239 return; 239 return;
@@ -242,7 +242,7 @@ queue_bus_reset_event(struct client *client)
242 fill_bus_reset_event(&bus_reset->reset, client); 242 fill_bus_reset_event(&bus_reset->reset, client);
243 243
244 queue_event(client, &bus_reset->event, 244 queue_event(client, &bus_reset->event,
245 &bus_reset->reset, sizeof bus_reset->reset, NULL, 0); 245 &bus_reset->reset, sizeof(bus_reset->reset), NULL, 0);
246} 246}
247 247
248void fw_device_cdev_update(struct fw_device *device) 248void fw_device_cdev_update(struct fw_device *device)
@@ -284,7 +284,7 @@ static int ioctl_get_info(struct client *client, void *buffer)
284 void __user *uptr = u64_to_uptr(get_info->bus_reset); 284 void __user *uptr = u64_to_uptr(get_info->bus_reset);
285 285
286 fill_bus_reset_event(&bus_reset, client); 286 fill_bus_reset_event(&bus_reset, client);
287 if (copy_to_user(uptr, &bus_reset, sizeof bus_reset)) 287 if (copy_to_user(uptr, &bus_reset, sizeof(bus_reset)))
288 return -EFAULT; 288 return -EFAULT;
289 } 289 }
290 290
@@ -361,7 +361,7 @@ complete_transaction(struct fw_card *card, int rcode,
361 response->response.type = FW_CDEV_EVENT_RESPONSE; 361 response->response.type = FW_CDEV_EVENT_RESPONSE;
362 response->response.rcode = rcode; 362 response->response.rcode = rcode;
363 queue_event(client, &response->event, 363 queue_event(client, &response->event,
364 &response->response, sizeof response->response, 364 &response->response, sizeof(response->response),
365 response->response.data, response->response.length); 365 response->response.data, response->response.length);
366} 366}
367 367
@@ -375,7 +375,7 @@ static ssize_t ioctl_send_request(struct client *client, void *buffer)
375 if (request->length > 4096) 375 if (request->length > 4096)
376 return -EINVAL; 376 return -EINVAL;
377 377
378 response = kmalloc(sizeof *response + request->length, GFP_KERNEL); 378 response = kmalloc(sizeof(*response) + request->length, GFP_KERNEL);
379 if (response == NULL) 379 if (response == NULL)
380 return -ENOMEM; 380 return -ENOMEM;
381 381
@@ -403,9 +403,9 @@ static ssize_t ioctl_send_request(struct client *client, void *buffer)
403 complete_transaction, response); 403 complete_transaction, response);
404 404
405 if (request->data) 405 if (request->data)
406 return sizeof request + request->length; 406 return sizeof(request) + request->length;
407 else 407 else
408 return sizeof request; 408 return sizeof(request);
409} 409}
410 410
411struct address_handler { 411struct address_handler {
@@ -450,8 +450,8 @@ handle_request(struct fw_card *card, struct fw_request *r,
450 struct request_event *e; 450 struct request_event *e;
451 struct client *client = handler->client; 451 struct client *client = handler->client;
452 452
453 request = kmalloc(sizeof *request, GFP_ATOMIC); 453 request = kmalloc(sizeof(*request), GFP_ATOMIC);
454 e = kmalloc(sizeof *e, GFP_ATOMIC); 454 e = kmalloc(sizeof(*e), GFP_ATOMIC);
455 if (request == NULL || e == NULL) { 455 if (request == NULL || e == NULL) {
456 kfree(request); 456 kfree(request);
457 kfree(e); 457 kfree(e);
@@ -474,7 +474,7 @@ handle_request(struct fw_card *card, struct fw_request *r,
474 e->request.closure = handler->closure; 474 e->request.closure = handler->closure;
475 475
476 queue_event(client, &e->event, 476 queue_event(client, &e->event,
477 &e->request, sizeof e->request, payload, length); 477 &e->request, sizeof(e->request), payload, length);
478} 478}
479 479
480static void 480static void
@@ -494,7 +494,7 @@ static int ioctl_allocate(struct client *client, void *buffer)
494 struct address_handler *handler; 494 struct address_handler *handler;
495 struct fw_address_region region; 495 struct fw_address_region region;
496 496
497 handler = kmalloc(sizeof *handler, GFP_KERNEL); 497 handler = kmalloc(sizeof(*handler), GFP_KERNEL);
498 if (handler == NULL) 498 if (handler == NULL)
499 return -ENOMEM; 499 return -ENOMEM;
500 500
@@ -581,7 +581,7 @@ static int ioctl_add_descriptor(struct client *client, void *buffer)
581 return -EINVAL; 581 return -EINVAL;
582 582
583 descriptor = 583 descriptor =
584 kmalloc(sizeof *descriptor + request->length * 4, GFP_KERNEL); 584 kmalloc(sizeof(*descriptor) + request->length * 4, GFP_KERNEL);
585 if (descriptor == NULL) 585 if (descriptor == NULL)
586 return -ENOMEM; 586 return -ENOMEM;
587 587
@@ -623,7 +623,7 @@ iso_callback(struct fw_iso_context *context, u32 cycle,
623 struct client *client = data; 623 struct client *client = data;
624 struct iso_interrupt *interrupt; 624 struct iso_interrupt *interrupt;
625 625
626 interrupt = kzalloc(sizeof *interrupt + header_length, GFP_ATOMIC); 626 interrupt = kzalloc(sizeof(*interrupt) + header_length, GFP_ATOMIC);
627 if (interrupt == NULL) 627 if (interrupt == NULL)
628 return; 628 return;
629 629
@@ -634,7 +634,7 @@ iso_callback(struct fw_iso_context *context, u32 cycle,
634 memcpy(interrupt->interrupt.header, header, header_length); 634 memcpy(interrupt->interrupt.header, header, header_length);
635 queue_event(client, &interrupt->event, 635 queue_event(client, &interrupt->event,
636 &interrupt->interrupt, 636 &interrupt->interrupt,
637 sizeof interrupt->interrupt + header_length, NULL, 0); 637 sizeof(interrupt->interrupt) + header_length, NULL, 0);
638} 638}
639 639
640static int ioctl_create_iso_context(struct client *client, void *buffer) 640static int ioctl_create_iso_context(struct client *client, void *buffer)
@@ -717,7 +717,7 @@ static int ioctl_queue_iso(struct client *client, void *buffer)
717 end = (void __user *)p + request->size; 717 end = (void __user *)p + request->size;
718 count = 0; 718 count = 0;
719 while (p < end) { 719 while (p < end) {
720 if (__copy_from_user(&u.packet, p, sizeof *p)) 720 if (__copy_from_user(&u.packet, p, sizeof(*p)))
721 return -EFAULT; 721 return -EFAULT;
722 722
723 if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) { 723 if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
@@ -819,7 +819,7 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
819 return -EINVAL; 819 return -EINVAL;
820 820
821 if (_IOC_DIR(cmd) & _IOC_WRITE) { 821 if (_IOC_DIR(cmd) & _IOC_WRITE) {
822 if (_IOC_SIZE(cmd) > sizeof buffer || 822 if (_IOC_SIZE(cmd) > sizeof(buffer) ||
823 copy_from_user(buffer, arg, _IOC_SIZE(cmd))) 823 copy_from_user(buffer, arg, _IOC_SIZE(cmd)))
824 return -EFAULT; 824 return -EFAULT;
825 } 825 }
@@ -829,7 +829,7 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg)
829 return retval; 829 return retval;
830 830
831 if (_IOC_DIR(cmd) & _IOC_READ) { 831 if (_IOC_DIR(cmd) & _IOC_READ) {
832 if (_IOC_SIZE(cmd) > sizeof buffer || 832 if (_IOC_SIZE(cmd) > sizeof(buffer) ||
833 copy_to_user(arg, buffer, _IOC_SIZE(cmd))) 833 copy_to_user(arg, buffer, _IOC_SIZE(cmd)))
834 return -EFAULT; 834 return -EFAULT;
835 } 835 }
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index 8e5f17f5e98a..c1ce465d9710 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -138,7 +138,7 @@ fw_unit_uevent(struct device *dev, char **envp, int num_envp,
138 int length = 0; 138 int length = 0;
139 int i = 0; 139 int i = 0;
140 140
141 get_modalias(unit, modalias, sizeof modalias); 141 get_modalias(unit, modalias, sizeof(modalias));
142 142
143 if (add_uevent_var(envp, num_envp, &i, 143 if (add_uevent_var(envp, num_envp, &i,
144 buffer, buffer_size, &length, 144 buffer, buffer_size, &length,
@@ -533,7 +533,7 @@ static void create_units(struct fw_device *device)
533 * Get the address of the unit directory and try to 533 * Get the address of the unit directory and try to
534 * match the drivers id_tables against it. 534 * match the drivers id_tables against it.
535 */ 535 */
536 unit = kzalloc(sizeof *unit, GFP_KERNEL); 536 unit = kzalloc(sizeof(*unit), GFP_KERNEL);
537 if (unit == NULL) { 537 if (unit == NULL) {
538 fw_error("failed to allocate memory for unit\n"); 538 fw_error("failed to allocate memory for unit\n");
539 continue; 539 continue;
@@ -543,7 +543,7 @@ static void create_units(struct fw_device *device)
543 unit->device.bus = &fw_bus_type; 543 unit->device.bus = &fw_bus_type;
544 unit->device.type = &fw_unit_type; 544 unit->device.type = &fw_unit_type;
545 unit->device.parent = &device->device; 545 unit->device.parent = &device->device;
546 snprintf(unit->device.bus_id, sizeof unit->device.bus_id, 546 snprintf(unit->device.bus_id, sizeof(unit->device.bus_id),
547 "%s.%d", device->device.bus_id, i++); 547 "%s.%d", device->device.bus_id, i++);
548 548
549 init_fw_attribute_group(&unit->device, 549 init_fw_attribute_group(&unit->device,
@@ -653,7 +653,7 @@ static void fw_device_init(struct work_struct *work)
653 device->device.type = &fw_device_type; 653 device->device.type = &fw_device_type;
654 device->device.parent = device->card->device; 654 device->device.parent = device->card->device;
655 device->device.devt = MKDEV(fw_cdev_major, minor); 655 device->device.devt = MKDEV(fw_cdev_major, minor);
656 snprintf(device->device.bus_id, sizeof device->device.bus_id, 656 snprintf(device->device.bus_id, sizeof(device->device.bus_id),
657 "fw%d", minor); 657 "fw%d", minor);
658 658
659 init_fw_attribute_group(&device->device, 659 init_fw_attribute_group(&device->device,
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 7d91b7e8f028..5833ce1b040b 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -255,7 +255,7 @@ static int ar_context_add_page(struct ar_context *ctx)
255 return -ENOMEM; 255 return -ENOMEM;
256 } 256 }
257 257
258 memset(&ab->descriptor, 0, sizeof ab->descriptor); 258 memset(&ab->descriptor, 0, sizeof(ab->descriptor));
259 ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | 259 ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
260 DESCRIPTOR_STATUS | 260 DESCRIPTOR_STATUS |
261 DESCRIPTOR_BRANCH_ALWAYS); 261 DESCRIPTOR_BRANCH_ALWAYS);
@@ -440,7 +440,7 @@ static void context_tasklet(unsigned long data)
440 while (last->branch_address != 0) { 440 while (last->branch_address != 0) {
441 address = le32_to_cpu(last->branch_address); 441 address = le32_to_cpu(last->branch_address);
442 z = address & 0xf; 442 z = address & 0xf;
443 d = ctx->buffer + (address - ctx->buffer_bus) / sizeof *d; 443 d = ctx->buffer + (address - ctx->buffer_bus) / sizeof(*d);
444 last = (z == 2) ? d : d + z - 1; 444 last = (z == 2) ? d : d + z - 1;
445 445
446 if (!ctx->callback(ctx, d, last)) 446 if (!ctx->callback(ctx, d, last))
@@ -487,7 +487,7 @@ context_init(struct context *ctx, struct fw_ohci *ohci,
487 * element so that head == tail means buffer full. 487 * element so that head == tail means buffer full.
488 */ 488 */
489 489
490 memset(ctx->head_descriptor, 0, sizeof *ctx->head_descriptor); 490 memset(ctx->head_descriptor, 0, sizeof(*ctx->head_descriptor));
491 ctx->head_descriptor->control = cpu_to_le16(DESCRIPTOR_OUTPUT_LAST); 491 ctx->head_descriptor->control = cpu_to_le16(DESCRIPTOR_OUTPUT_LAST);
492 ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011); 492 ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011);
493 ctx->head_descriptor++; 493 ctx->head_descriptor++;
@@ -512,7 +512,7 @@ context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus)
512 512
513 d = ctx->head_descriptor; 513 d = ctx->head_descriptor;
514 tail = ctx->tail_descriptor; 514 tail = ctx->tail_descriptor;
515 end = ctx->buffer + ctx->buffer_size / sizeof(struct descriptor); 515 end = ctx->buffer + ctx->buffer_size / sizeof(*d);
516 516
517 if (d + z <= tail) { 517 if (d + z <= tail) {
518 goto has_space; 518 goto has_space;
@@ -526,8 +526,8 @@ context_get_descriptors(struct context *ctx, int z, dma_addr_t *d_bus)
526 return NULL; 526 return NULL;
527 527
528 has_space: 528 has_space:
529 memset(d, 0, z * sizeof *d); 529 memset(d, 0, z * sizeof(*d));
530 *d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof *d; 530 *d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
531 531
532 return d; 532 return d;
533} 533}
@@ -548,7 +548,7 @@ static void context_append(struct context *ctx,
548{ 548{
549 dma_addr_t d_bus; 549 dma_addr_t d_bus;
550 550
551 d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof *d; 551 d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
552 552
553 ctx->head_descriptor = d + z + extra; 553 ctx->head_descriptor = d + z + extra;
554 ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z); 554 ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z);
@@ -820,7 +820,7 @@ handle_local_lock(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr)
820 fw_notify("swap not done yet\n"); 820 fw_notify("swap not done yet\n");
821 821
822 fw_fill_response(&response, packet->header, 822 fw_fill_response(&response, packet->header,
823 RCODE_COMPLETE, &lock_old, sizeof lock_old); 823 RCODE_COMPLETE, &lock_old, sizeof(lock_old));
824 out: 824 out:
825 fw_core_handle_response(&ohci->card, &response); 825 fw_core_handle_response(&ohci->card, &response);
826} 826}
@@ -1376,7 +1376,7 @@ ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size)
1376 regs = OHCI1394_IsoRcvContextBase(index); 1376 regs = OHCI1394_IsoRcvContextBase(index);
1377 1377
1378 ctx = &list[index]; 1378 ctx = &list[index];
1379 memset(ctx, 0, sizeof *ctx); 1379 memset(ctx, 0, sizeof(*ctx));
1380 ctx->header_length = 0; 1380 ctx->header_length = 0;
1381 ctx->header = (void *) __get_free_page(GFP_KERNEL); 1381 ctx->header = (void *) __get_free_page(GFP_KERNEL);
1382 if (ctx->header == NULL) 1382 if (ctx->header == NULL)
@@ -1518,7 +1518,7 @@ ohci_queue_iso_transmit(struct fw_iso_context *base,
1518 z += payload_z; 1518 z += payload_z;
1519 1519
1520 /* Get header size in number of descriptors. */ 1520 /* Get header size in number of descriptors. */
1521 header_z = DIV_ROUND_UP(p->header_length, sizeof *d); 1521 header_z = DIV_ROUND_UP(p->header_length, sizeof(*d));
1522 1522
1523 d = context_get_descriptors(&ctx->context, z + header_z, &d_bus); 1523 d = context_get_descriptors(&ctx->context, z + header_z, &d_bus);
1524 if (d == NULL) 1524 if (d == NULL)
@@ -1541,7 +1541,7 @@ ohci_queue_iso_transmit(struct fw_iso_context *base,
1541 1541
1542 if (p->header_length > 0) { 1542 if (p->header_length > 0) {
1543 d[2].req_count = cpu_to_le16(p->header_length); 1543 d[2].req_count = cpu_to_le16(p->header_length);
1544 d[2].data_address = cpu_to_le32(d_bus + z * sizeof *d); 1544 d[2].data_address = cpu_to_le32(d_bus + z * sizeof(*d));
1545 memcpy(&d[z], p->header, p->header_length); 1545 memcpy(&d[z], p->header, p->header_length);
1546 } 1546 }
1547 1547
@@ -1620,7 +1620,7 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
1620 header_size = packet_count * (ctx->base.header_size + 4); 1620 header_size = packet_count * (ctx->base.header_size + 4);
1621 1621
1622 /* Get header size in number of descriptors. */ 1622 /* Get header size in number of descriptors. */
1623 header_z = DIV_ROUND_UP(header_size, sizeof *d); 1623 header_z = DIV_ROUND_UP(header_size, sizeof(*d));
1624 page = payload >> PAGE_SHIFT; 1624 page = payload >> PAGE_SHIFT;
1625 offset = payload & ~PAGE_MASK; 1625 offset = payload & ~PAGE_MASK;
1626 rest = p->payload_length; 1626 rest = p->payload_length;
@@ -1639,7 +1639,7 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
1639 db->first_size = cpu_to_le16(ctx->base.header_size + 4); 1639 db->first_size = cpu_to_le16(ctx->base.header_size + 4);
1640 db->first_req_count = cpu_to_le16(header_size); 1640 db->first_req_count = cpu_to_le16(header_size);
1641 db->first_res_count = db->first_req_count; 1641 db->first_res_count = db->first_req_count;
1642 db->first_buffer = cpu_to_le32(d_bus + sizeof *db); 1642 db->first_buffer = cpu_to_le32(d_bus + sizeof(*db));
1643 1643
1644 if (offset + rest < PAGE_SIZE) 1644 if (offset + rest < PAGE_SIZE)
1645 length = rest; 1645 length = rest;
@@ -1755,7 +1755,7 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1755 int error_code; 1755 int error_code;
1756 size_t size; 1756 size_t size;
1757 1757
1758 ohci = kzalloc(sizeof *ohci, GFP_KERNEL); 1758 ohci = kzalloc(sizeof(*ohci), GFP_KERNEL);
1759 if (ohci == NULL) { 1759 if (ohci == NULL) {
1760 fw_error("Could not malloc fw_ohci data.\n"); 1760 fw_error("Could not malloc fw_ohci data.\n");
1761 return -ENOMEM; 1761 return -ENOMEM;
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index e2ffbc87dcfe..68300414e5f4 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -279,7 +279,7 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request,
279 unsigned long flags; 279 unsigned long flags;
280 280
281 if (tcode != TCODE_WRITE_BLOCK_REQUEST || 281 if (tcode != TCODE_WRITE_BLOCK_REQUEST ||
282 length == 0 || length > sizeof status) { 282 length == 0 || length > sizeof(status)) {
283 fw_send_response(card, request, RCODE_TYPE_ERROR); 283 fw_send_response(card, request, RCODE_TYPE_ERROR);
284 return; 284 return;
285 } 285 }
@@ -340,7 +340,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
340 340
341 orb->pointer.high = 0; 341 orb->pointer.high = 0;
342 orb->pointer.low = orb->request_bus; 342 orb->pointer.low = orb->request_bus;
343 fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof orb->pointer); 343 fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof(orb->pointer));
344 344
345 spin_lock_irqsave(&device->card->lock, flags); 345 spin_lock_irqsave(&device->card->lock, flags);
346 list_add_tail(&orb->link, &sd->orb_list); 346 list_add_tail(&orb->link, &sd->orb_list);
@@ -349,7 +349,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
349 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, 349 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
350 node_id, generation, 350 node_id, generation,
351 device->node->max_speed, offset, 351 device->node->max_speed, offset,
352 &orb->pointer, sizeof orb->pointer, 352 &orb->pointer, sizeof(orb->pointer),
353 complete_transaction, orb); 353 complete_transaction, orb);
354} 354}
355 355
@@ -386,7 +386,7 @@ complete_management_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
386 (struct sbp2_management_orb *)base_orb; 386 (struct sbp2_management_orb *)base_orb;
387 387
388 if (status) 388 if (status)
389 memcpy(&orb->status, status, sizeof *status); 389 memcpy(&orb->status, status, sizeof(*status));
390 complete(&orb->done); 390 complete(&orb->done);
391} 391}
392 392
@@ -399,7 +399,7 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
399 struct sbp2_management_orb *orb; 399 struct sbp2_management_orb *orb;
400 int retval = -ENOMEM; 400 int retval = -ENOMEM;
401 401
402 orb = kzalloc(sizeof *orb, GFP_ATOMIC); 402 orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
403 if (orb == NULL) 403 if (orb == NULL)
404 return -ENOMEM; 404 return -ENOMEM;
405 405
@@ -409,13 +409,13 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
409 */ 409 */
410 orb->base.request_bus = 410 orb->base.request_bus =
411 dma_map_single(device->card->device, &orb->request, 411 dma_map_single(device->card->device, &orb->request,
412 sizeof orb->request, DMA_TO_DEVICE); 412 sizeof(orb->request), DMA_TO_DEVICE);
413 if (dma_mapping_error(orb->base.request_bus)) 413 if (dma_mapping_error(orb->base.request_bus))
414 goto out; 414 goto out;
415 415
416 orb->response_bus = 416 orb->response_bus =
417 dma_map_single(device->card->device, &orb->response, 417 dma_map_single(device->card->device, &orb->response,
418 sizeof orb->response, DMA_FROM_DEVICE); 418 sizeof(orb->response), DMA_FROM_DEVICE);
419 if (dma_mapping_error(orb->response_bus)) 419 if (dma_mapping_error(orb->response_bus))
420 goto out; 420 goto out;
421 421
@@ -427,7 +427,7 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
427 MANAGEMENT_ORB_FUNCTION(function) | 427 MANAGEMENT_ORB_FUNCTION(function) |
428 MANAGEMENT_ORB_LUN(lun); 428 MANAGEMENT_ORB_LUN(lun);
429 orb->request.length = 429 orb->request.length =
430 MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof orb->response); 430 MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response));
431 431
432 orb->request.status_fifo.high = sd->address_handler.offset >> 32; 432 orb->request.status_fifo.high = sd->address_handler.offset >> 32;
433 orb->request.status_fifo.low = sd->address_handler.offset; 433 orb->request.status_fifo.low = sd->address_handler.offset;
@@ -443,7 +443,7 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
443 MANAGEMENT_ORB_RECONNECT(0); 443 MANAGEMENT_ORB_RECONNECT(0);
444 } 444 }
445 445
446 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request); 446 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
447 447
448 init_completion(&orb->done); 448 init_completion(&orb->done);
449 orb->base.callback = complete_management_orb; 449 orb->base.callback = complete_management_orb;
@@ -478,13 +478,13 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
478 retval = 0; 478 retval = 0;
479 out: 479 out:
480 dma_unmap_single(device->card->device, orb->base.request_bus, 480 dma_unmap_single(device->card->device, orb->base.request_bus,
481 sizeof orb->request, DMA_TO_DEVICE); 481 sizeof(orb->request), DMA_TO_DEVICE);
482 dma_unmap_single(device->card->device, orb->response_bus, 482 dma_unmap_single(device->card->device, orb->response_bus,
483 sizeof orb->response, DMA_FROM_DEVICE); 483 sizeof(orb->response), DMA_FROM_DEVICE);
484 484
485 if (response) 485 if (response)
486 fw_memcpy_from_be32(response, 486 fw_memcpy_from_be32(response,
487 orb->response, sizeof orb->response); 487 orb->response, sizeof(orb->response));
488 kfree(orb); 488 kfree(orb);
489 489
490 return retval; 490 return retval;
@@ -506,14 +506,14 @@ static int sbp2_agent_reset(struct fw_unit *unit)
506 struct fw_transaction *t; 506 struct fw_transaction *t;
507 static u32 zero; 507 static u32 zero;
508 508
509 t = kzalloc(sizeof *t, GFP_ATOMIC); 509 t = kzalloc(sizeof(*t), GFP_ATOMIC);
510 if (t == NULL) 510 if (t == NULL)
511 return -ENOMEM; 511 return -ENOMEM;
512 512
513 fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST, 513 fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST,
514 sd->node_id, sd->generation, SCODE_400, 514 sd->node_id, sd->generation, SCODE_400,
515 sd->command_block_agent_address + SBP2_AGENT_RESET, 515 sd->command_block_agent_address + SBP2_AGENT_RESET,
516 &zero, sizeof zero, complete_agent_reset_write, t); 516 &zero, sizeof(zero), complete_agent_reset_write, t);
517 517
518 return 0; 518 return 0;
519} 519}
@@ -870,7 +870,7 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
870 } 870 }
871 871
872 dma_unmap_single(device->card->device, orb->base.request_bus, 872 dma_unmap_single(device->card->device, orb->base.request_bus,
873 sizeof orb->request, DMA_TO_DEVICE); 873 sizeof(orb->request), DMA_TO_DEVICE);
874 874
875 if (orb->cmd->use_sg > 0) { 875 if (orb->cmd->use_sg > 0) {
876 sg = (struct scatterlist *)orb->cmd->request_buffer; 876 sg = (struct scatterlist *)orb->cmd->request_buffer;
@@ -880,11 +880,11 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
880 880
881 if (orb->page_table_bus != 0) 881 if (orb->page_table_bus != 0)
882 dma_unmap_single(device->card->device, orb->page_table_bus, 882 dma_unmap_single(device->card->device, orb->page_table_bus,
883 sizeof orb->page_table_bus, DMA_TO_DEVICE); 883 sizeof(orb->page_table_bus), DMA_TO_DEVICE);
884 884
885 if (orb->request_buffer_bus != 0) 885 if (orb->request_buffer_bus != 0)
886 dma_unmap_single(device->card->device, orb->request_buffer_bus, 886 dma_unmap_single(device->card->device, orb->request_buffer_bus,
887 sizeof orb->request_buffer_bus, 887 sizeof(orb->request_buffer_bus),
888 DMA_FROM_DEVICE); 888 DMA_FROM_DEVICE);
889 889
890 orb->cmd->result = result; 890 orb->cmd->result = result;
@@ -944,7 +944,7 @@ static int sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb)
944 } 944 }
945 } 945 }
946 946
947 size = sizeof orb->page_table[0] * j; 947 size = sizeof(orb->page_table[0]) * j;
948 948
949 /* 949 /*
950 * The data_descriptor pointer is the one case where we need 950 * The data_descriptor pointer is the one case where we need
@@ -997,7 +997,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
997 return 0; 997 return 0;
998 } 998 }
999 999
1000 orb = kzalloc(sizeof *orb, GFP_ATOMIC); 1000 orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
1001 if (orb == NULL) { 1001 if (orb == NULL) {
1002 fw_notify("failed to alloc orb\n"); 1002 fw_notify("failed to alloc orb\n");
1003 goto fail_alloc; 1003 goto fail_alloc;
@@ -1007,7 +1007,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1007 orb->base.rcode = -1; 1007 orb->base.rcode = -1;
1008 orb->base.request_bus = 1008 orb->base.request_bus =
1009 dma_map_single(device->card->device, &orb->request, 1009 dma_map_single(device->card->device, &orb->request,
1010 sizeof orb->request, DMA_TO_DEVICE); 1010 sizeof(orb->request), DMA_TO_DEVICE);
1011 if (dma_mapping_error(orb->base.request_bus)) 1011 if (dma_mapping_error(orb->base.request_bus))
1012 goto fail_mapping; 1012 goto fail_mapping;
1013 1013
@@ -1038,10 +1038,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1038 if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0) 1038 if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0)
1039 goto fail_map_payload; 1039 goto fail_map_payload;
1040 1040
1041 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request); 1041 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
1042 1042
1043 memset(orb->request.command_block, 1043 memset(orb->request.command_block,
1044 0, sizeof orb->request.command_block); 1044 0, sizeof(orb->request.command_block));
1045 memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); 1045 memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
1046 1046
1047 orb->base.callback = complete_command_orb; 1047 orb->base.callback = complete_command_orb;
@@ -1053,7 +1053,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1053 1053
1054 fail_map_payload: 1054 fail_map_payload:
1055 dma_unmap_single(device->card->device, orb->base.request_bus, 1055 dma_unmap_single(device->card->device, orb->base.request_bus,
1056 sizeof orb->request, DMA_TO_DEVICE); 1056 sizeof(orb->request), DMA_TO_DEVICE);
1057 fail_mapping: 1057 fail_mapping:
1058 kfree(orb); 1058 kfree(orb);
1059 fail_alloc: 1059 fail_alloc:
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
index b9dce70b3aed..7aebb8ae0efa 100644
--- a/drivers/firewire/fw-topology.c
+++ b/drivers/firewire/fw-topology.c
@@ -97,7 +97,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color)
97{ 97{
98 struct fw_node *node; 98 struct fw_node *node;
99 99
100 node = kzalloc(sizeof *node + port_count * sizeof node->ports[0], 100 node = kzalloc(sizeof(*node) + port_count * sizeof(node->ports[0]),
101 GFP_ATOMIC); 101 GFP_ATOMIC);
102 if (node == NULL) 102 if (node == NULL)
103 return NULL; 103 return NULL;
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 01c438f1c670..80d0121463d0 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -305,7 +305,7 @@ static void send_phy_packet(struct fw_card *card, u32 data, int generation)
305{ 305{
306 struct fw_packet *packet; 306 struct fw_packet *packet;
307 307
308 packet = kzalloc(sizeof *packet, GFP_ATOMIC); 308 packet = kzalloc(sizeof(*packet), GFP_ATOMIC);
309 if (packet == NULL) 309 if (packet == NULL)
310 return; 310 return;
311 311
@@ -572,7 +572,7 @@ allocate_request(struct fw_packet *p)
572 return NULL; 572 return NULL;
573 } 573 }
574 574
575 request = kmalloc(sizeof *request + length, GFP_ATOMIC); 575 request = kmalloc(sizeof(*request) + length, GFP_ATOMIC);
576 if (request == NULL) 576 if (request == NULL)
577 return NULL; 577 return NULL;
578 578
@@ -592,7 +592,7 @@ allocate_request(struct fw_packet *p)
592 if (data) 592 if (data)
593 memcpy(request->data, data, length); 593 memcpy(request->data, data, length);
594 594
595 memcpy(request->request_header, p->header, sizeof p->header); 595 memcpy(request->request_header, p->header, sizeof(p->header));
596 596
597 return request; 597 return request;
598} 598}