* the version stored in the OHCI registers.
*/
- memset(config_rom, 0, sizeof config_rom);
+ memset(config_rom, 0, sizeof(config_rom));
config_rom[0] = BIB_CRC_LENGTH(4) | BIB_INFO_LENGTH(4) | BIB_CRC(0);
config_rom[1] = 0x31333934;
fw_send_request(card, &bmd.t, TCODE_LOCK_COMPARE_SWAP,
irm_id, generation,
SCODE_100, CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID,
- &bmd.lock, sizeof bmd.lock,
+ &bmd.lock, sizeof(bmd.lock),
complete_bm_lock, &bmd);
wait_for_completion(&bmd.done);
if (device == NULL)
return -ENODEV;
- client = kzalloc(sizeof *client, GFP_KERNEL);
+ client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL)
return -ENOMEM;
{
struct bus_reset *bus_reset;
- bus_reset = kzalloc(sizeof *bus_reset, GFP_ATOMIC);
+ bus_reset = kzalloc(sizeof(*bus_reset), GFP_ATOMIC);
if (bus_reset == NULL) {
fw_notify("Out of memory when allocating bus reset event\n");
return;
fill_bus_reset_event(&bus_reset->reset, client);
queue_event(client, &bus_reset->event,
- &bus_reset->reset, sizeof bus_reset->reset, NULL, 0);
+ &bus_reset->reset, sizeof(bus_reset->reset), NULL, 0);
}
void fw_device_cdev_update(struct fw_device *device)
void __user *uptr = u64_to_uptr(get_info->bus_reset);
fill_bus_reset_event(&bus_reset, client);
- if (copy_to_user(uptr, &bus_reset, sizeof bus_reset))
+ if (copy_to_user(uptr, &bus_reset, sizeof(bus_reset)))
return -EFAULT;
}
response->response.type = FW_CDEV_EVENT_RESPONSE;
response->response.rcode = rcode;
queue_event(client, &response->event,
- &response->response, sizeof response->response,
+ &response->response, sizeof(response->response),
response->response.data, response->response.length);
}
if (request->length > 4096)
return -EINVAL;
- response = kmalloc(sizeof *response + request->length, GFP_KERNEL);
+ response = kmalloc(sizeof(*response) + request->length, GFP_KERNEL);
if (response == NULL)
return -ENOMEM;
complete_transaction, response);
if (request->data)
- return sizeof request + request->length;
+ return sizeof(request) + request->length;
else
- return sizeof request;
+ return sizeof(request);
}
struct address_handler {
struct request_event *e;
struct client *client = handler->client;
- request = kmalloc(sizeof *request, GFP_ATOMIC);
- e = kmalloc(sizeof *e, GFP_ATOMIC);
+ request = kmalloc(sizeof(*request), GFP_ATOMIC);
+ e = kmalloc(sizeof(*e), GFP_ATOMIC);
if (request == NULL || e == NULL) {
kfree(request);
kfree(e);
e->request.closure = handler->closure;
queue_event(client, &e->event,
- &e->request, sizeof e->request, payload, length);
+ &e->request, sizeof(e->request), payload, length);
}
static void
struct address_handler *handler;
struct fw_address_region region;
- handler = kmalloc(sizeof *handler, GFP_KERNEL);
+ handler = kmalloc(sizeof(*handler), GFP_KERNEL);
if (handler == NULL)
return -ENOMEM;
return -EINVAL;
descriptor =
- kmalloc(sizeof *descriptor + request->length * 4, GFP_KERNEL);
+ kmalloc(sizeof(*descriptor) + request->length * 4, GFP_KERNEL);
if (descriptor == NULL)
return -ENOMEM;
struct client *client = data;
struct iso_interrupt *interrupt;
- interrupt = kzalloc(sizeof *interrupt + header_length, GFP_ATOMIC);
+ interrupt = kzalloc(sizeof(*interrupt) + header_length, GFP_ATOMIC);
if (interrupt == NULL)
return;
memcpy(interrupt->interrupt.header, header, header_length);
queue_event(client, &interrupt->event,
&interrupt->interrupt,
- sizeof interrupt->interrupt + header_length, NULL, 0);
+ sizeof(interrupt->interrupt) + header_length, NULL, 0);
}
static int ioctl_create_iso_context(struct client *client, void *buffer)
end = (void __user *)p + request->size;
count = 0;
while (p < end) {
- if (__copy_from_user(&u.packet, p, sizeof *p))
+ if (__copy_from_user(&u.packet, p, sizeof(*p)))
return -EFAULT;
if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
return -EINVAL;
if (_IOC_DIR(cmd) & _IOC_WRITE) {
- if (_IOC_SIZE(cmd) > sizeof buffer ||
+ if (_IOC_SIZE(cmd) > sizeof(buffer) ||
copy_from_user(buffer, arg, _IOC_SIZE(cmd)))
return -EFAULT;
}
return retval;
if (_IOC_DIR(cmd) & _IOC_READ) {
- if (_IOC_SIZE(cmd) > sizeof buffer ||
+ if (_IOC_SIZE(cmd) > sizeof(buffer) ||
copy_to_user(arg, buffer, _IOC_SIZE(cmd)))
return -EFAULT;
}
int length = 0;
int i = 0;
- get_modalias(unit, modalias, sizeof modalias);
+ get_modalias(unit, modalias, sizeof(modalias));
if (add_uevent_var(envp, num_envp, &i,
buffer, buffer_size, &length,
* Get the address of the unit directory and try to
* match the drivers id_tables against it.
*/
- unit = kzalloc(sizeof *unit, GFP_KERNEL);
+ unit = kzalloc(sizeof(*unit), GFP_KERNEL);
if (unit == NULL) {
fw_error("failed to allocate memory for unit\n");
continue;
unit->device.bus = &fw_bus_type;
unit->device.type = &fw_unit_type;
unit->device.parent = &device->device;
- snprintf(unit->device.bus_id, sizeof unit->device.bus_id,
+ snprintf(unit->device.bus_id, sizeof(unit->device.bus_id),
"%s.%d", device->device.bus_id, i++);
init_fw_attribute_group(&unit->device,
device->device.type = &fw_device_type;
device->device.parent = device->card->device;
device->device.devt = MKDEV(fw_cdev_major, minor);
- snprintf(device->device.bus_id, sizeof device->device.bus_id,
+ snprintf(device->device.bus_id, sizeof(device->device.bus_id),
"fw%d", minor);
init_fw_attribute_group(&device->device,
return -ENOMEM;
}
- memset(&ab->descriptor, 0, sizeof ab->descriptor);
+ memset(&ab->descriptor, 0, sizeof(ab->descriptor));
ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
DESCRIPTOR_STATUS |
DESCRIPTOR_BRANCH_ALWAYS);
while (last->branch_address != 0) {
address = le32_to_cpu(last->branch_address);
z = address & 0xf;
- d = ctx->buffer + (address - ctx->buffer_bus) / sizeof *d;
+ d = ctx->buffer + (address - ctx->buffer_bus) / sizeof(*d);
last = (z == 2) ? d : d + z - 1;
if (!ctx->callback(ctx, d, last))
* element so that head == tail means buffer full.
*/
- memset(ctx->head_descriptor, 0, sizeof *ctx->head_descriptor);
+ memset(ctx->head_descriptor, 0, sizeof(*ctx->head_descriptor));
ctx->head_descriptor->control = cpu_to_le16(DESCRIPTOR_OUTPUT_LAST);
ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011);
ctx->head_descriptor++;
d = ctx->head_descriptor;
tail = ctx->tail_descriptor;
- end = ctx->buffer + ctx->buffer_size / sizeof(struct descriptor);
+ end = ctx->buffer + ctx->buffer_size / sizeof(*d);
if (d + z <= tail) {
goto has_space;
return NULL;
has_space:
- memset(d, 0, z * sizeof *d);
- *d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof *d;
+ memset(d, 0, z * sizeof(*d));
+ *d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
return d;
}
{
dma_addr_t d_bus;
- d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof *d;
+ d_bus = ctx->buffer_bus + (d - ctx->buffer) * sizeof(*d);
ctx->head_descriptor = d + z + extra;
ctx->prev_descriptor->branch_address = cpu_to_le32(d_bus | z);
fw_notify("swap not done yet\n");
fw_fill_response(&response, packet->header,
- RCODE_COMPLETE, &lock_old, sizeof lock_old);
+ RCODE_COMPLETE, &lock_old, sizeof(lock_old));
out:
fw_core_handle_response(&ohci->card, &response);
}
regs = OHCI1394_IsoRcvContextBase(index);
ctx = &list[index];
- memset(ctx, 0, sizeof *ctx);
+ memset(ctx, 0, sizeof(*ctx));
ctx->header_length = 0;
ctx->header = (void *) __get_free_page(GFP_KERNEL);
if (ctx->header == NULL)
z += payload_z;
/* Get header size in number of descriptors. */
- header_z = DIV_ROUND_UP(p->header_length, sizeof *d);
+ header_z = DIV_ROUND_UP(p->header_length, sizeof(*d));
d = context_get_descriptors(&ctx->context, z + header_z, &d_bus);
if (d == NULL)
if (p->header_length > 0) {
d[2].req_count = cpu_to_le16(p->header_length);
- d[2].data_address = cpu_to_le32(d_bus + z * sizeof *d);
+ d[2].data_address = cpu_to_le32(d_bus + z * sizeof(*d));
memcpy(&d[z], p->header, p->header_length);
}
header_size = packet_count * (ctx->base.header_size + 4);
/* Get header size in number of descriptors. */
- header_z = DIV_ROUND_UP(header_size, sizeof *d);
+ header_z = DIV_ROUND_UP(header_size, sizeof(*d));
page = payload >> PAGE_SHIFT;
offset = payload & ~PAGE_MASK;
rest = p->payload_length;
db->first_size = cpu_to_le16(ctx->base.header_size + 4);
db->first_req_count = cpu_to_le16(header_size);
db->first_res_count = db->first_req_count;
- db->first_buffer = cpu_to_le32(d_bus + sizeof *db);
+ db->first_buffer = cpu_to_le32(d_bus + sizeof(*db));
if (offset + rest < PAGE_SIZE)
length = rest;
int error_code;
size_t size;
- ohci = kzalloc(sizeof *ohci, GFP_KERNEL);
+ ohci = kzalloc(sizeof(*ohci), GFP_KERNEL);
if (ohci == NULL) {
fw_error("Could not malloc fw_ohci data.\n");
return -ENOMEM;
unsigned long flags;
if (tcode != TCODE_WRITE_BLOCK_REQUEST ||
- length == 0 || length > sizeof status) {
+ length == 0 || length > sizeof(status)) {
fw_send_response(card, request, RCODE_TYPE_ERROR);
return;
}
orb->pointer.high = 0;
orb->pointer.low = orb->request_bus;
- fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof orb->pointer);
+ fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof(orb->pointer));
spin_lock_irqsave(&device->card->lock, flags);
list_add_tail(&orb->link, &sd->orb_list);
fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
node_id, generation,
device->node->max_speed, offset,
- &orb->pointer, sizeof orb->pointer,
+ &orb->pointer, sizeof(orb->pointer),
complete_transaction, orb);
}
(struct sbp2_management_orb *)base_orb;
if (status)
- memcpy(&orb->status, status, sizeof *status);
+ memcpy(&orb->status, status, sizeof(*status));
complete(&orb->done);
}
struct sbp2_management_orb *orb;
int retval = -ENOMEM;
- orb = kzalloc(sizeof *orb, GFP_ATOMIC);
+ orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
if (orb == NULL)
return -ENOMEM;
*/
orb->base.request_bus =
dma_map_single(device->card->device, &orb->request,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
if (dma_mapping_error(orb->base.request_bus))
goto out;
orb->response_bus =
dma_map_single(device->card->device, &orb->response,
- sizeof orb->response, DMA_FROM_DEVICE);
+ sizeof(orb->response), DMA_FROM_DEVICE);
if (dma_mapping_error(orb->response_bus))
goto out;
MANAGEMENT_ORB_FUNCTION(function) |
MANAGEMENT_ORB_LUN(lun);
orb->request.length =
- MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof orb->response);
+ MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response));
orb->request.status_fifo.high = sd->address_handler.offset >> 32;
orb->request.status_fifo.low = sd->address_handler.offset;
MANAGEMENT_ORB_RECONNECT(0);
}
- fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
+ fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
init_completion(&orb->done);
orb->base.callback = complete_management_orb;
retval = 0;
out:
dma_unmap_single(device->card->device, orb->base.request_bus,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
dma_unmap_single(device->card->device, orb->response_bus,
- sizeof orb->response, DMA_FROM_DEVICE);
+ sizeof(orb->response), DMA_FROM_DEVICE);
if (response)
fw_memcpy_from_be32(response,
- orb->response, sizeof orb->response);
+ orb->response, sizeof(orb->response));
kfree(orb);
return retval;
struct fw_transaction *t;
static u32 zero;
- t = kzalloc(sizeof *t, GFP_ATOMIC);
+ t = kzalloc(sizeof(*t), GFP_ATOMIC);
if (t == NULL)
return -ENOMEM;
fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST,
sd->node_id, sd->generation, SCODE_400,
sd->command_block_agent_address + SBP2_AGENT_RESET,
- &zero, sizeof zero, complete_agent_reset_write, t);
+ &zero, sizeof(zero), complete_agent_reset_write, t);
return 0;
}
}
dma_unmap_single(device->card->device, orb->base.request_bus,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
if (orb->cmd->use_sg > 0) {
sg = (struct scatterlist *)orb->cmd->request_buffer;
if (orb->page_table_bus != 0)
dma_unmap_single(device->card->device, orb->page_table_bus,
- sizeof orb->page_table_bus, DMA_TO_DEVICE);
+ sizeof(orb->page_table_bus), DMA_TO_DEVICE);
if (orb->request_buffer_bus != 0)
dma_unmap_single(device->card->device, orb->request_buffer_bus,
- sizeof orb->request_buffer_bus,
+ sizeof(orb->request_buffer_bus),
DMA_FROM_DEVICE);
orb->cmd->result = result;
}
}
- size = sizeof orb->page_table[0] * j;
+ size = sizeof(orb->page_table[0]) * j;
/*
* The data_descriptor pointer is the one case where we need
return 0;
}
- orb = kzalloc(sizeof *orb, GFP_ATOMIC);
+ orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
if (orb == NULL) {
fw_notify("failed to alloc orb\n");
goto fail_alloc;
orb->base.rcode = -1;
orb->base.request_bus =
dma_map_single(device->card->device, &orb->request,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
if (dma_mapping_error(orb->base.request_bus))
goto fail_mapping;
if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0)
goto fail_map_payload;
- fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
+ fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
memset(orb->request.command_block,
- 0, sizeof orb->request.command_block);
+ 0, sizeof(orb->request.command_block));
memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
orb->base.callback = complete_command_orb;
fail_map_payload:
dma_unmap_single(device->card->device, orb->base.request_bus,
- sizeof orb->request, DMA_TO_DEVICE);
+ sizeof(orb->request), DMA_TO_DEVICE);
fail_mapping:
kfree(orb);
fail_alloc:
{
struct fw_node *node;
- node = kzalloc(sizeof *node + port_count * sizeof node->ports[0],
+ node = kzalloc(sizeof(*node) + port_count * sizeof(node->ports[0]),
GFP_ATOMIC);
if (node == NULL)
return NULL;
{
struct fw_packet *packet;
- packet = kzalloc(sizeof *packet, GFP_ATOMIC);
+ packet = kzalloc(sizeof(*packet), GFP_ATOMIC);
if (packet == NULL)
return;
return NULL;
}
- request = kmalloc(sizeof *request + length, GFP_ATOMIC);
+ request = kmalloc(sizeof(*request) + length, GFP_ATOMIC);
if (request == NULL)
return NULL;
if (data)
memcpy(request->data, data, length);
- memcpy(request->request_header, p->header, sizeof p->header);
+ memcpy(request->request_header, p->header, sizeof(p->header));
return request;
}