diff options
| author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2013-09-27 12:49:53 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-27 20:20:19 -0400 |
| commit | ced2c60fb5024a5cf5c33cb573b3d6a66d738f36 (patch) | |
| tree | 19763d6180d0a9b16f0da478c4801f3445424b28 /drivers/misc | |
| parent | 4aa79961a50119d6112a160e97d5e6a77656b68c (diff) | |
misc: mic: cleanups for "--strict" checkpatch.
These changes were mostly authored by Joe Perches <joe@perches.com>
@ https://lkml.org/lkml/2013/9/5/602
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Signed-off-by: Harshavardhan R Kharche <harshavardhan.r.kharche@intel.com>
Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/mic/card/mic_device.c | 1 | ||||
| -rw-r--r-- | drivers/misc/mic/card/mic_virtio.c | 17 | ||||
| -rw-r--r-- | drivers/misc/mic/card/mic_x100.c | 4 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_debugfs.c | 90 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_fops.c | 6 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_intr.c | 34 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_smpt.c | 14 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_sysfs.c | 20 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_virtio.c | 37 | ||||
| -rw-r--r-- | drivers/misc/mic/host/mic_x100.c | 33 |
10 files changed, 123 insertions, 133 deletions
diff --git a/drivers/misc/mic/card/mic_device.c b/drivers/misc/mic/card/mic_device.c index 175d11425636..d0980ff96833 100644 --- a/drivers/misc/mic/card/mic_device.c +++ b/drivers/misc/mic/card/mic_device.c | |||
| @@ -167,7 +167,6 @@ struct mic_irq *mic_request_card_irq(irqreturn_t (*func)(int irq, void *data), | |||
| 167 | return (struct mic_irq *)cookie; | 167 | return (struct mic_irq *)cookie; |
| 168 | err: | 168 | err: |
| 169 | return ERR_PTR(rc); | 169 | return ERR_PTR(rc); |
| 170 | |||
| 171 | } | 170 | } |
| 172 | 171 | ||
| 173 | /** | 172 | /** |
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c index 7420c33d8f65..914cc9b2caad 100644 --- a/drivers/misc/mic/card/mic_virtio.c +++ b/drivers/misc/mic/card/mic_virtio.c | |||
| @@ -103,7 +103,7 @@ static void mic_finalize_features(struct virtio_device *vdev) | |||
| 103 | for (i = 0; i < bits; i++) { | 103 | for (i = 0; i < bits; i++) { |
| 104 | if (test_bit(i, vdev->features)) | 104 | if (test_bit(i, vdev->features)) |
| 105 | iowrite8(ioread8(&out_features[i / 8]) | (1 << (i % 8)), | 105 | iowrite8(ioread8(&out_features[i / 8]) | (1 << (i % 8)), |
| 106 | &out_features[i / 8]); | 106 | &out_features[i / 8]); |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 | ||
| @@ -197,10 +197,9 @@ static void mic_notify(struct virtqueue *vq) | |||
| 197 | static void mic_del_vq(struct virtqueue *vq, int n) | 197 | static void mic_del_vq(struct virtqueue *vq, int n) |
| 198 | { | 198 | { |
| 199 | struct mic_vdev *mvdev = to_micvdev(vq->vdev); | 199 | struct mic_vdev *mvdev = to_micvdev(vq->vdev); |
| 200 | struct vring *vr = (struct vring *) (vq + 1); | 200 | struct vring *vr = (struct vring *)(vq + 1); |
| 201 | 201 | ||
| 202 | free_pages((unsigned long) vr->used, | 202 | free_pages((unsigned long) vr->used, get_order(mvdev->used_size[n])); |
| 203 | get_order(mvdev->used_size[n])); | ||
| 204 | vring_del_virtqueue(vq); | 203 | vring_del_virtqueue(vq); |
| 205 | mic_card_unmap(mvdev->mdev, mvdev->vr[n]); | 204 | mic_card_unmap(mvdev->mdev, mvdev->vr[n]); |
| 206 | mvdev->vr[n] = NULL; | 205 | mvdev->vr[n] = NULL; |
| @@ -274,8 +273,8 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, | |||
| 274 | /* Allocate and reassign used ring now */ | 273 | /* Allocate and reassign used ring now */ |
| 275 | mvdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + | 274 | mvdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + |
| 276 | sizeof(struct vring_used_elem) * config.num); | 275 | sizeof(struct vring_used_elem) * config.num); |
| 277 | used = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO, | 276 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
| 278 | get_order(mvdev->used_size[index])); | 277 | get_order(mvdev->used_size[index])); |
| 279 | if (!used) { | 278 | if (!used) { |
| 280 | err = -ENOMEM; | 279 | err = -ENOMEM; |
| 281 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 280 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| @@ -291,7 +290,7 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, | |||
| 291 | * vring_new_virtqueue() would ensure that | 290 | * vring_new_virtqueue() would ensure that |
| 292 | * (&vq->vring == (struct vring *) (&vq->vq + 1)); | 291 | * (&vq->vring == (struct vring *) (&vq->vq + 1)); |
| 293 | */ | 292 | */ |
| 294 | vr = (struct vring *) (vq + 1); | 293 | vr = (struct vring *)(vq + 1); |
| 295 | vr->used = used; | 294 | vr->used = used; |
| 296 | 295 | ||
| 297 | vq->priv = mvdev; | 296 | vq->priv = mvdev; |
| @@ -544,7 +543,7 @@ static void mic_scan_devices(struct mic_driver *mdrv, bool remove) | |||
| 544 | if (dev) { | 543 | if (dev) { |
| 545 | if (remove) | 544 | if (remove) |
| 546 | iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE, | 545 | iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE, |
| 547 | &dc->config_change); | 546 | &dc->config_change); |
| 548 | put_device(dev); | 547 | put_device(dev); |
| 549 | mic_handle_config_change(d, i, mdrv); | 548 | mic_handle_config_change(d, i, mdrv); |
| 550 | ret = mic_remove_device(d, i, mdrv); | 549 | ret = mic_remove_device(d, i, mdrv); |
| @@ -559,7 +558,7 @@ static void mic_scan_devices(struct mic_driver *mdrv, bool remove) | |||
| 559 | 558 | ||
| 560 | /* new device */ | 559 | /* new device */ |
| 561 | dev_dbg(mdrv->dev, "%s %d Adding new virtio device %p\n", | 560 | dev_dbg(mdrv->dev, "%s %d Adding new virtio device %p\n", |
| 562 | __func__, __LINE__, d); | 561 | __func__, __LINE__, d); |
| 563 | if (!remove) | 562 | if (!remove) |
| 564 | mic_add_device(d, i, mdrv); | 563 | mic_add_device(d, i, mdrv); |
| 565 | } | 564 | } |
diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c index f491c9163bb2..2868945c9a4d 100644 --- a/drivers/misc/mic/card/mic_x100.c +++ b/drivers/misc/mic/card/mic_x100.c | |||
| @@ -66,8 +66,8 @@ void mic_send_intr(struct mic_device *mdev, int doorbell) | |||
| 66 | /* Ensure that the interrupt is ordered w.r.t previous stores. */ | 66 | /* Ensure that the interrupt is ordered w.r.t previous stores. */ |
| 67 | wmb(); | 67 | wmb(); |
| 68 | mic_mmio_write(mw, MIC_X100_SBOX_SDBIC0_DBREQ_BIT, | 68 | mic_mmio_write(mw, MIC_X100_SBOX_SDBIC0_DBREQ_BIT, |
| 69 | MIC_X100_SBOX_BASE_ADDRESS + | 69 | MIC_X100_SBOX_BASE_ADDRESS + |
| 70 | (MIC_X100_SBOX_SDBIC0 + (4 * doorbell))); | 70 | (MIC_X100_SBOX_SDBIC0 + (4 * doorbell))); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
diff --git a/drivers/misc/mic/host/mic_debugfs.c b/drivers/misc/mic/host/mic_debugfs.c index 98a61b4319f4..028ba5d6fd1c 100644 --- a/drivers/misc/mic/host/mic_debugfs.c +++ b/drivers/misc/mic/host/mic_debugfs.c | |||
| @@ -103,7 +103,7 @@ static int mic_smpt_show(struct seq_file *s, void *pos) | |||
| 103 | unsigned long flags; | 103 | unsigned long flags; |
| 104 | 104 | ||
| 105 | seq_printf(s, "MIC %-2d |%-10s| %-14s %-10s\n", | 105 | seq_printf(s, "MIC %-2d |%-10s| %-14s %-10s\n", |
| 106 | mdev->id, "SMPT entry", "SW DMA addr", "RefCount"); | 106 | mdev->id, "SMPT entry", "SW DMA addr", "RefCount"); |
| 107 | seq_puts(s, "====================================================\n"); | 107 | seq_puts(s, "====================================================\n"); |
| 108 | 108 | ||
| 109 | if (mdev->smpt) { | 109 | if (mdev->smpt) { |
| @@ -111,8 +111,8 @@ static int mic_smpt_show(struct seq_file *s, void *pos) | |||
| 111 | spin_lock_irqsave(&smpt_info->smpt_lock, flags); | 111 | spin_lock_irqsave(&smpt_info->smpt_lock, flags); |
| 112 | for (i = 0; i < smpt_info->info.num_reg; i++) { | 112 | for (i = 0; i < smpt_info->info.num_reg; i++) { |
| 113 | seq_printf(s, "%9s|%-10d| %-#14llx %-10lld\n", | 113 | seq_printf(s, "%9s|%-10d| %-#14llx %-10lld\n", |
| 114 | " ", i, smpt_info->entry[i].dma_addr, | 114 | " ", i, smpt_info->entry[i].dma_addr, |
| 115 | smpt_info->entry[i].ref_count); | 115 | smpt_info->entry[i].ref_count); |
| 116 | } | 116 | } |
| 117 | spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); | 117 | spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); |
| 118 | } | 118 | } |
| @@ -203,17 +203,17 @@ static int mic_dp_show(struct seq_file *s, void *pos) | |||
| 203 | int i, j; | 203 | int i, j; |
| 204 | 204 | ||
| 205 | seq_printf(s, "Bootparam: magic 0x%x\n", | 205 | seq_printf(s, "Bootparam: magic 0x%x\n", |
| 206 | bootparam->magic); | 206 | bootparam->magic); |
| 207 | seq_printf(s, "Bootparam: h2c_shutdown_db %d\n", | 207 | seq_printf(s, "Bootparam: h2c_shutdown_db %d\n", |
| 208 | bootparam->h2c_shutdown_db); | 208 | bootparam->h2c_shutdown_db); |
| 209 | seq_printf(s, "Bootparam: h2c_config_db %d\n", | 209 | seq_printf(s, "Bootparam: h2c_config_db %d\n", |
| 210 | bootparam->h2c_config_db); | 210 | bootparam->h2c_config_db); |
| 211 | seq_printf(s, "Bootparam: c2h_shutdown_db %d\n", | 211 | seq_printf(s, "Bootparam: c2h_shutdown_db %d\n", |
| 212 | bootparam->c2h_shutdown_db); | 212 | bootparam->c2h_shutdown_db); |
| 213 | seq_printf(s, "Bootparam: shutdown_status %d\n", | 213 | seq_printf(s, "Bootparam: shutdown_status %d\n", |
| 214 | bootparam->shutdown_status); | 214 | bootparam->shutdown_status); |
| 215 | seq_printf(s, "Bootparam: shutdown_card %d\n", | 215 | seq_printf(s, "Bootparam: shutdown_card %d\n", |
| 216 | bootparam->shutdown_card); | 216 | bootparam->shutdown_card); |
| 217 | 217 | ||
| 218 | for (i = sizeof(*bootparam); i < MIC_DP_SIZE; | 218 | for (i = sizeof(*bootparam); i < MIC_DP_SIZE; |
| 219 | i += mic_total_desc_size(d)) { | 219 | i += mic_total_desc_size(d)) { |
| @@ -239,10 +239,10 @@ static int mic_dp_show(struct seq_file *s, void *pos) | |||
| 239 | seq_printf(s, "address 0x%llx ", vqconfig->address); | 239 | seq_printf(s, "address 0x%llx ", vqconfig->address); |
| 240 | seq_printf(s, "num %d ", vqconfig->num); | 240 | seq_printf(s, "num %d ", vqconfig->num); |
| 241 | seq_printf(s, "used address 0x%llx\n", | 241 | seq_printf(s, "used address 0x%llx\n", |
| 242 | vqconfig->used_address); | 242 | vqconfig->used_address); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | features = (__u32 *) mic_vq_features(d); | 245 | features = (__u32 *)mic_vq_features(d); |
| 246 | seq_printf(s, "Features: Host 0x%x ", features[0]); | 246 | seq_printf(s, "Features: Host 0x%x ", features[0]); |
| 247 | seq_printf(s, "Guest 0x%x\n", features[1]); | 247 | seq_printf(s, "Guest 0x%x\n", features[1]); |
| 248 | 248 | ||
| @@ -256,7 +256,7 @@ static int mic_dp_show(struct seq_file *s, void *pos) | |||
| 256 | seq_printf(s, "Guest Ack %d ", dc->guest_ack); | 256 | seq_printf(s, "Guest Ack %d ", dc->guest_ack); |
| 257 | seq_printf(s, "Host ack %d\n", dc->host_ack); | 257 | seq_printf(s, "Host ack %d\n", dc->host_ack); |
| 258 | seq_printf(s, "Used address updated %d ", | 258 | seq_printf(s, "Used address updated %d ", |
| 259 | dc->used_address_updated); | 259 | dc->used_address_updated); |
| 260 | seq_printf(s, "Vdev 0x%llx\n", dc->vdev); | 260 | seq_printf(s, "Vdev 0x%llx\n", dc->vdev); |
| 261 | seq_printf(s, "c2h doorbell %d ", dc->c2h_vdev_db); | 261 | seq_printf(s, "c2h doorbell %d ", dc->c2h_vdev_db); |
| 262 | seq_printf(s, "h2c doorbell %d\n", dc->h2c_vdev_db); | 262 | seq_printf(s, "h2c doorbell %d\n", dc->h2c_vdev_db); |
| @@ -294,10 +294,10 @@ static int mic_vdev_info_show(struct seq_file *s, void *unused) | |||
| 294 | list_for_each_safe(pos, tmp, &mdev->vdev_list) { | 294 | list_for_each_safe(pos, tmp, &mdev->vdev_list) { |
| 295 | mvdev = list_entry(pos, struct mic_vdev, list); | 295 | mvdev = list_entry(pos, struct mic_vdev, list); |
| 296 | seq_printf(s, "VDEV type %d state %s in %ld out %ld\n", | 296 | seq_printf(s, "VDEV type %d state %s in %ld out %ld\n", |
| 297 | mvdev->virtio_id, | 297 | mvdev->virtio_id, |
| 298 | mic_vdevup(mvdev) ? "UP" : "DOWN", | 298 | mic_vdevup(mvdev) ? "UP" : "DOWN", |
| 299 | mvdev->in_bytes, | 299 | mvdev->in_bytes, |
| 300 | mvdev->out_bytes); | 300 | mvdev->out_bytes); |
| 301 | for (i = 0; i < MIC_MAX_VRINGS; i++) { | 301 | for (i = 0; i < MIC_MAX_VRINGS; i++) { |
| 302 | struct vring_desc *desc; | 302 | struct vring_desc *desc; |
| 303 | struct vring_avail *avail; | 303 | struct vring_avail *avail; |
| @@ -309,38 +309,38 @@ static int mic_vdev_info_show(struct seq_file *s, void *unused) | |||
| 309 | continue; | 309 | continue; |
| 310 | desc = vrh->vring.desc; | 310 | desc = vrh->vring.desc; |
| 311 | seq_printf(s, "vring i %d avail_idx %d", | 311 | seq_printf(s, "vring i %d avail_idx %d", |
| 312 | i, mvr->vring.info->avail_idx & (num - 1)); | 312 | i, mvr->vring.info->avail_idx & (num - 1)); |
| 313 | seq_printf(s, " vring i %d avail_idx %d\n", | 313 | seq_printf(s, " vring i %d avail_idx %d\n", |
| 314 | i, mvr->vring.info->avail_idx); | 314 | i, mvr->vring.info->avail_idx); |
| 315 | seq_printf(s, "vrh i %d weak_barriers %d", | 315 | seq_printf(s, "vrh i %d weak_barriers %d", |
| 316 | i, vrh->weak_barriers); | 316 | i, vrh->weak_barriers); |
| 317 | seq_printf(s, " last_avail_idx %d last_used_idx %d", | 317 | seq_printf(s, " last_avail_idx %d last_used_idx %d", |
| 318 | vrh->last_avail_idx, vrh->last_used_idx); | 318 | vrh->last_avail_idx, vrh->last_used_idx); |
| 319 | seq_printf(s, " completed %d\n", vrh->completed); | 319 | seq_printf(s, " completed %d\n", vrh->completed); |
| 320 | for (j = 0; j < num; j++) { | 320 | for (j = 0; j < num; j++) { |
| 321 | seq_printf(s, "desc[%d] addr 0x%llx len %d", | 321 | seq_printf(s, "desc[%d] addr 0x%llx len %d", |
| 322 | j, desc->addr, desc->len); | 322 | j, desc->addr, desc->len); |
| 323 | seq_printf(s, " flags 0x%x next %d\n", | 323 | seq_printf(s, " flags 0x%x next %d\n", |
| 324 | desc->flags, | 324 | desc->flags, desc->next); |
| 325 | desc->next); | ||
| 326 | desc++; | 325 | desc++; |
| 327 | } | 326 | } |
| 328 | avail = vrh->vring.avail; | 327 | avail = vrh->vring.avail; |
| 329 | seq_printf(s, "avail flags 0x%x idx %d\n", | 328 | seq_printf(s, "avail flags 0x%x idx %d\n", |
| 330 | avail->flags, avail->idx & (num - 1)); | 329 | avail->flags, avail->idx & (num - 1)); |
| 331 | seq_printf(s, "avail flags 0x%x idx %d\n", | 330 | seq_printf(s, "avail flags 0x%x idx %d\n", |
| 332 | avail->flags, avail->idx); | 331 | avail->flags, avail->idx); |
| 333 | for (j = 0; j < num; j++) | 332 | for (j = 0; j < num; j++) |
| 334 | seq_printf(s, "avail ring[%d] %d\n", | 333 | seq_printf(s, "avail ring[%d] %d\n", |
| 335 | j, avail->ring[j]); | 334 | j, avail->ring[j]); |
| 336 | used = vrh->vring.used; | 335 | used = vrh->vring.used; |
| 337 | seq_printf(s, "used flags 0x%x idx %d\n", | 336 | seq_printf(s, "used flags 0x%x idx %d\n", |
| 338 | used->flags, used->idx & (num - 1)); | 337 | used->flags, used->idx & (num - 1)); |
| 339 | seq_printf(s, "used flags 0x%x idx %d\n", | 338 | seq_printf(s, "used flags 0x%x idx %d\n", |
| 340 | used->flags, used->idx); | 339 | used->flags, used->idx); |
| 341 | for (j = 0; j < num; j++) | 340 | for (j = 0; j < num; j++) |
| 342 | seq_printf(s, "used ring[%d] id %d len %d\n", | 341 | seq_printf(s, "used ring[%d] id %d len %d\n", |
| 343 | j, used->ring[j].id, used->ring[j].len); | 342 | j, used->ring[j].id, |
| 343 | used->ring[j].len); | ||
| 344 | } | 344 | } |
| 345 | } | 345 | } |
| 346 | mutex_unlock(&mdev->mic_mutex); | 346 | mutex_unlock(&mdev->mic_mutex); |
| @@ -389,7 +389,7 @@ static int mic_msi_irq_info_show(struct seq_file *s, void *pos) | |||
| 389 | reg = mdev->intr_ops->read_msi_to_src_map(mdev, entry); | 389 | reg = mdev->intr_ops->read_msi_to_src_map(mdev, entry); |
| 390 | 390 | ||
| 391 | seq_printf(s, "%s %-10d %s %-10d MXAR[%d]: %08X\n", | 391 | seq_printf(s, "%s %-10d %s %-10d MXAR[%d]: %08X\n", |
| 392 | "IRQ:", vector, "Entry:", entry, i, reg); | 392 | "IRQ:", vector, "Entry:", entry, i, reg); |
| 393 | 393 | ||
| 394 | seq_printf(s, "%-10s", "offset:"); | 394 | seq_printf(s, "%-10s", "offset:"); |
| 395 | for (j = (MIC_NUM_OFFSETS - 1); j >= 0; j--) | 395 | for (j = (MIC_NUM_OFFSETS - 1); j >= 0; j--) |
| @@ -400,8 +400,8 @@ static int mic_msi_irq_info_show(struct seq_file *s, void *pos) | |||
| 400 | seq_printf(s, "%-10s", "count:"); | 400 | seq_printf(s, "%-10s", "count:"); |
| 401 | for (j = (MIC_NUM_OFFSETS - 1); j >= 0; j--) | 401 | for (j = (MIC_NUM_OFFSETS - 1); j >= 0; j--) |
| 402 | seq_printf(s, "%4d ", | 402 | seq_printf(s, "%4d ", |
| 403 | (mdev->irq_info.mic_msi_map[i] & BIT(j)) ? | 403 | (mdev->irq_info.mic_msi_map[i] & |
| 404 | 1 : 0); | 404 | BIT(j)) ? 1 : 0); |
| 405 | seq_puts(s, "\n\n"); | 405 | seq_puts(s, "\n\n"); |
| 406 | } | 406 | } |
| 407 | } else { | 407 | } else { |
| @@ -409,7 +409,6 @@ static int mic_msi_irq_info_show(struct seq_file *s, void *pos) | |||
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | return 0; | 411 | return 0; |
| 412 | |||
| 413 | } | 412 | } |
| 414 | 413 | ||
| 415 | static int mic_msi_irq_info_debug_open(struct inode *inode, struct file *file) | 414 | static int mic_msi_irq_info_debug_open(struct inode *inode, struct file *file) |
| @@ -443,26 +442,23 @@ void mic_create_debug_dir(struct mic_device *mdev) | |||
| 443 | if (!mdev->dbg_dir) | 442 | if (!mdev->dbg_dir) |
| 444 | return; | 443 | return; |
| 445 | 444 | ||
| 446 | debugfs_create_file("log_buf", 0444, mdev->dbg_dir, | 445 | debugfs_create_file("log_buf", 0444, mdev->dbg_dir, mdev, &log_buf_ops); |
| 447 | mdev, &log_buf_ops); | ||
| 448 | 446 | ||
| 449 | debugfs_create_file("smpt", 0444, mdev->dbg_dir, | 447 | debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev, &smpt_file_ops); |
| 450 | mdev, &smpt_file_ops); | ||
| 451 | 448 | ||
| 452 | debugfs_create_file("soft_reset", 0444, mdev->dbg_dir, | 449 | debugfs_create_file("soft_reset", 0444, mdev->dbg_dir, mdev, |
| 453 | mdev, &soft_reset_ops); | 450 | &soft_reset_ops); |
| 454 | 451 | ||
| 455 | debugfs_create_file("post_code", 0444, mdev->dbg_dir, | 452 | debugfs_create_file("post_code", 0444, mdev->dbg_dir, mdev, |
| 456 | mdev, &post_code_ops); | 453 | &post_code_ops); |
| 457 | 454 | ||
| 458 | debugfs_create_file("dp", 0444, mdev->dbg_dir, | 455 | debugfs_create_file("dp", 0444, mdev->dbg_dir, mdev, &dp_ops); |
| 459 | mdev, &dp_ops); | ||
| 460 | 456 | ||
| 461 | debugfs_create_file("vdev_info", 0444, mdev->dbg_dir, | 457 | debugfs_create_file("vdev_info", 0444, mdev->dbg_dir, mdev, |
| 462 | mdev, &vdev_info_ops); | 458 | &vdev_info_ops); |
| 463 | 459 | ||
| 464 | debugfs_create_file("msi_irq_info", 0444, mdev->dbg_dir, | 460 | debugfs_create_file("msi_irq_info", 0444, mdev->dbg_dir, mdev, |
| 465 | mdev, &msi_irq_info_ops); | 461 | &msi_irq_info_ops); |
| 466 | } | 462 | } |
| 467 | 463 | ||
| 468 | /** | 464 | /** |
diff --git a/drivers/misc/mic/host/mic_fops.c b/drivers/misc/mic/host/mic_fops.c index e699c80a8c0a..8dc6ff16845a 100644 --- a/drivers/misc/mic/host/mic_fops.c +++ b/drivers/misc/mic/host/mic_fops.c | |||
| @@ -140,9 +140,9 @@ unsigned int mic_poll(struct file *f, poll_table *wait) | |||
| 140 | 140 | ||
| 141 | poll_wait(f, &mvdev->waitq, wait); | 141 | poll_wait(f, &mvdev->waitq, wait); |
| 142 | 142 | ||
| 143 | if (mic_vdev_inited(mvdev)) | 143 | if (mic_vdev_inited(mvdev)) { |
| 144 | mask = POLLERR; | 144 | mask = POLLERR; |
| 145 | else if (mvdev->poll_wake) { | 145 | } else if (mvdev->poll_wake) { |
| 146 | mvdev->poll_wake = 0; | 146 | mvdev->poll_wake = 0; |
| 147 | mask = POLLIN | POLLOUT; | 147 | mask = POLLIN | POLLOUT; |
| 148 | } | 148 | } |
| @@ -152,7 +152,7 @@ unsigned int mic_poll(struct file *f, poll_table *wait) | |||
| 152 | 152 | ||
| 153 | static inline int | 153 | static inline int |
| 154 | mic_query_offset(struct mic_vdev *mvdev, unsigned long offset, | 154 | mic_query_offset(struct mic_vdev *mvdev, unsigned long offset, |
| 155 | unsigned long *size, unsigned long *pa) | 155 | unsigned long *size, unsigned long *pa) |
| 156 | { | 156 | { |
| 157 | struct mic_device *mdev = mvdev->mdev; | 157 | struct mic_device *mdev = mvdev->mdev; |
| 158 | unsigned long start = MIC_DP_SIZE; | 158 | unsigned long start = MIC_DP_SIZE; |
diff --git a/drivers/misc/mic/host/mic_intr.c b/drivers/misc/mic/host/mic_intr.c index 71a7521cf1a4..f9c29bc918bc 100644 --- a/drivers/misc/mic/host/mic_intr.c +++ b/drivers/misc/mic/host/mic_intr.c | |||
| @@ -71,8 +71,8 @@ static irqreturn_t mic_interrupt(int irq, void *dev) | |||
| 71 | 71 | ||
| 72 | /* Return the interrupt offset from the index. Index is 0 based. */ | 72 | /* Return the interrupt offset from the index. Index is 0 based. */ |
| 73 | static u16 mic_map_src_to_offset(struct mic_device *mdev, | 73 | static u16 mic_map_src_to_offset(struct mic_device *mdev, |
| 74 | int intr_src, enum mic_intr_type type) { | 74 | int intr_src, enum mic_intr_type type) |
| 75 | 75 | { | |
| 76 | if (type >= MIC_NUM_INTR_TYPES) | 76 | if (type >= MIC_NUM_INTR_TYPES) |
| 77 | return MIC_NUM_OFFSETS; | 77 | return MIC_NUM_OFFSETS; |
| 78 | if (intr_src >= mdev->intr_info->intr_len[type]) | 78 | if (intr_src >= mdev->intr_info->intr_len[type]) |
| @@ -112,7 +112,7 @@ static struct mic_intr_cb *mic_register_intr_callback(struct mic_device *mdev, | |||
| 112 | struct mic_intr_cb *intr_cb; | 112 | struct mic_intr_cb *intr_cb; |
| 113 | unsigned long flags; | 113 | unsigned long flags; |
| 114 | int rc; | 114 | int rc; |
| 115 | intr_cb = kmalloc(sizeof(struct mic_intr_cb), GFP_KERNEL); | 115 | intr_cb = kmalloc(sizeof(*intr_cb), GFP_KERNEL); |
| 116 | 116 | ||
| 117 | if (!intr_cb) | 117 | if (!intr_cb) |
| 118 | return ERR_PTR(-ENOMEM); | 118 | return ERR_PTR(-ENOMEM); |
| @@ -159,7 +159,7 @@ static u8 mic_unregister_intr_callback(struct mic_device *mdev, u32 idx) | |||
| 159 | if (intr_cb->cb_id == idx) { | 159 | if (intr_cb->cb_id == idx) { |
| 160 | list_del(pos); | 160 | list_del(pos); |
| 161 | ida_simple_remove(&mdev->irq_info.cb_ida, | 161 | ida_simple_remove(&mdev->irq_info.cb_ida, |
| 162 | intr_cb->cb_id); | 162 | intr_cb->cb_id); |
| 163 | kfree(intr_cb); | 163 | kfree(intr_cb); |
| 164 | spin_unlock_irqrestore( | 164 | spin_unlock_irqrestore( |
| 165 | &mdev->irq_info.mic_intr_lock, flags); | 165 | &mdev->irq_info.mic_intr_lock, flags); |
| @@ -182,9 +182,10 @@ static u8 mic_unregister_intr_callback(struct mic_device *mdev, u32 idx) | |||
| 182 | static int mic_setup_msix(struct mic_device *mdev, struct pci_dev *pdev) | 182 | static int mic_setup_msix(struct mic_device *mdev, struct pci_dev *pdev) |
| 183 | { | 183 | { |
| 184 | int rc, i; | 184 | int rc, i; |
| 185 | int entry_size = sizeof(*mdev->irq_info.msix_entries); | ||
| 185 | 186 | ||
| 186 | mdev->irq_info.msix_entries = kmalloc(sizeof(struct msix_entry) * | 187 | mdev->irq_info.msix_entries = kmalloc_array(MIC_MIN_MSIX, |
| 187 | MIC_MIN_MSIX, GFP_KERNEL); | 188 | entry_size, GFP_KERNEL); |
| 188 | if (!mdev->irq_info.msix_entries) { | 189 | if (!mdev->irq_info.msix_entries) { |
| 189 | rc = -ENOMEM; | 190 | rc = -ENOMEM; |
| 190 | goto err_nomem1; | 191 | goto err_nomem1; |
| @@ -231,8 +232,9 @@ static int mic_setup_callbacks(struct mic_device *mdev) | |||
| 231 | { | 232 | { |
| 232 | int i; | 233 | int i; |
| 233 | 234 | ||
| 234 | mdev->irq_info.cb_list = kmalloc(sizeof(struct list_head) * | 235 | mdev->irq_info.cb_list = kmalloc_array(MIC_NUM_OFFSETS, |
| 235 | MIC_NUM_OFFSETS, GFP_KERNEL); | 236 | sizeof(*mdev->irq_info.cb_list), |
| 237 | GFP_KERNEL); | ||
| 236 | if (!mdev->irq_info.cb_list) | 238 | if (!mdev->irq_info.cb_list) |
| 237 | return -ENOMEM; | 239 | return -ENOMEM; |
| 238 | 240 | ||
| @@ -261,7 +263,7 @@ static void mic_release_callbacks(struct mic_device *mdev) | |||
| 261 | 263 | ||
| 262 | if (list_empty(&mdev->irq_info.cb_list[i])) { | 264 | if (list_empty(&mdev->irq_info.cb_list[i])) { |
| 263 | spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, | 265 | spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, |
| 264 | flags); | 266 | flags); |
| 265 | break; | 267 | break; |
| 266 | } | 268 | } |
| 267 | 269 | ||
| @@ -269,7 +271,7 @@ static void mic_release_callbacks(struct mic_device *mdev) | |||
| 269 | intr_cb = list_entry(pos, struct mic_intr_cb, list); | 271 | intr_cb = list_entry(pos, struct mic_intr_cb, list); |
| 270 | list_del(pos); | 272 | list_del(pos); |
| 271 | ida_simple_remove(&mdev->irq_info.cb_ida, | 273 | ida_simple_remove(&mdev->irq_info.cb_ida, |
| 272 | intr_cb->cb_id); | 274 | intr_cb->cb_id); |
| 273 | kfree(intr_cb); | 275 | kfree(intr_cb); |
| 274 | } | 276 | } |
| 275 | spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, flags); | 277 | spin_unlock_irqrestore(&mdev->irq_info.mic_intr_lock, flags); |
| @@ -427,8 +429,8 @@ struct mic_irq *mic_request_irq(struct mic_device *mdev, | |||
| 427 | offset = mic_map_src_to_offset(mdev, intr_src, type); | 429 | offset = mic_map_src_to_offset(mdev, intr_src, type); |
| 428 | if (offset >= MIC_NUM_OFFSETS) { | 430 | if (offset >= MIC_NUM_OFFSETS) { |
| 429 | dev_err(mdev->sdev->parent, | 431 | dev_err(mdev->sdev->parent, |
| 430 | "Error mapping index %d to a valid source id.\n", | 432 | "Error mapping index %d to a valid source id.\n", |
| 431 | intr_src); | 433 | intr_src); |
| 432 | rc = -EINVAL; | 434 | rc = -EINVAL; |
| 433 | goto err; | 435 | goto err; |
| 434 | } | 436 | } |
| @@ -437,7 +439,7 @@ struct mic_irq *mic_request_irq(struct mic_device *mdev, | |||
| 437 | msix = mic_get_available_vector(mdev); | 439 | msix = mic_get_available_vector(mdev); |
| 438 | if (!msix) { | 440 | if (!msix) { |
| 439 | dev_err(mdev->sdev->parent, | 441 | dev_err(mdev->sdev->parent, |
| 440 | "No MSIx vectors available for use.\n"); | 442 | "No MSIx vectors available for use.\n"); |
| 441 | rc = -ENOSPC; | 443 | rc = -ENOSPC; |
| 442 | goto err; | 444 | goto err; |
| 443 | } | 445 | } |
| @@ -460,7 +462,7 @@ struct mic_irq *mic_request_irq(struct mic_device *mdev, | |||
| 460 | offset, func, data); | 462 | offset, func, data); |
| 461 | if (IS_ERR(intr_cb)) { | 463 | if (IS_ERR(intr_cb)) { |
| 462 | dev_err(mdev->sdev->parent, | 464 | dev_err(mdev->sdev->parent, |
| 463 | "No available callback entries for use\n"); | 465 | "No available callback entries for use\n"); |
| 464 | rc = PTR_ERR(intr_cb); | 466 | rc = PTR_ERR(intr_cb); |
| 465 | goto err; | 467 | goto err; |
| 466 | } | 468 | } |
| @@ -506,7 +508,7 @@ void mic_free_irq(struct mic_device *mdev, | |||
| 506 | if (mdev->irq_info.num_vectors > 1) { | 508 | if (mdev->irq_info.num_vectors > 1) { |
| 507 | if (entry >= mdev->irq_info.num_vectors) { | 509 | if (entry >= mdev->irq_info.num_vectors) { |
| 508 | dev_warn(mdev->sdev->parent, | 510 | dev_warn(mdev->sdev->parent, |
| 509 | "entry %d should be < num_irq %d\n", | 511 | "entry %d should be < num_irq %d\n", |
| 510 | entry, mdev->irq_info.num_vectors); | 512 | entry, mdev->irq_info.num_vectors); |
| 511 | return; | 513 | return; |
| 512 | } | 514 | } |
| @@ -581,7 +583,7 @@ void mic_free_interrupts(struct mic_device *mdev, struct pci_dev *pdev) | |||
| 581 | for (i = 0; i < mdev->irq_info.num_vectors; i++) { | 583 | for (i = 0; i < mdev->irq_info.num_vectors; i++) { |
| 582 | if (mdev->irq_info.mic_msi_map[i]) | 584 | if (mdev->irq_info.mic_msi_map[i]) |
| 583 | dev_warn(&pdev->dev, "irq %d may still be in use.\n", | 585 | dev_warn(&pdev->dev, "irq %d may still be in use.\n", |
| 584 | mdev->irq_info.msix_entries[i].vector); | 586 | mdev->irq_info.msix_entries[i].vector); |
| 585 | } | 587 | } |
| 586 | kfree(mdev->irq_info.mic_msi_map); | 588 | kfree(mdev->irq_info.mic_msi_map); |
| 587 | kfree(mdev->irq_info.msix_entries); | 589 | kfree(mdev->irq_info.msix_entries); |
diff --git a/drivers/misc/mic/host/mic_smpt.c b/drivers/misc/mic/host/mic_smpt.c index 003d02b212be..fae474c4899e 100644 --- a/drivers/misc/mic/host/mic_smpt.c +++ b/drivers/misc/mic/host/mic_smpt.c | |||
| @@ -84,7 +84,7 @@ static void mic_add_smpt_entry(int spt, s64 *ref, u64 addr, | |||
| 84 | for (i = spt; i < spt + entries; i++, | 84 | for (i = spt; i < spt + entries; i++, |
| 85 | addr += smpt_info->info.page_size) { | 85 | addr += smpt_info->info.page_size) { |
| 86 | if (!smpt_info->entry[i].ref_count && | 86 | if (!smpt_info->entry[i].ref_count && |
| 87 | (smpt_info->entry[i].dma_addr != addr)) { | 87 | (smpt_info->entry[i].dma_addr != addr)) { |
| 88 | mdev->smpt_ops->set(mdev, addr, i); | 88 | mdev->smpt_ops->set(mdev, addr, i); |
| 89 | smpt_info->entry[i].dma_addr = addr; | 89 | smpt_info->entry[i].dma_addr = addr; |
| 90 | } | 90 | } |
| @@ -183,7 +183,7 @@ mic_to_dma_addr(struct mic_device *mdev, dma_addr_t mic_addr) | |||
| 183 | 183 | ||
| 184 | if (!mic_is_system_addr(mdev, mic_addr)) { | 184 | if (!mic_is_system_addr(mdev, mic_addr)) { |
| 185 | dev_err(mdev->sdev->parent, | 185 | dev_err(mdev->sdev->parent, |
| 186 | "mic_addr is invalid. mic_addr = 0x%llx\n", mic_addr); | 186 | "mic_addr is invalid. mic_addr = 0x%llx\n", mic_addr); |
| 187 | return -EINVAL; | 187 | return -EINVAL; |
| 188 | } | 188 | } |
| 189 | spt = mic_sys_addr_to_smpt(mdev, mic_addr); | 189 | spt = mic_sys_addr_to_smpt(mdev, mic_addr); |
| @@ -286,7 +286,7 @@ void mic_unmap(struct mic_device *mdev, dma_addr_t mic_addr, size_t size) | |||
| 286 | smpt_info->entry[i].ref_count -= ref[i - spt]; | 286 | smpt_info->entry[i].ref_count -= ref[i - spt]; |
| 287 | if (smpt_info->entry[i].ref_count < 0) | 287 | if (smpt_info->entry[i].ref_count < 0) |
| 288 | dev_warn(mdev->sdev->parent, | 288 | dev_warn(mdev->sdev->parent, |
| 289 | "ref count for entry %d is negative\n", i); | 289 | "ref count for entry %d is negative\n", i); |
| 290 | } | 290 | } |
| 291 | spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); | 291 | spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); |
| 292 | kfree(ref); | 292 | kfree(ref); |
| @@ -320,7 +320,7 @@ dma_addr_t mic_map_single(struct mic_device *mdev, void *va, size_t size) | |||
| 320 | "mic_map failed dma_addr 0x%llx size 0x%lx\n", | 320 | "mic_map failed dma_addr 0x%llx size 0x%lx\n", |
| 321 | dma_addr, size); | 321 | dma_addr, size); |
| 322 | pci_unmap_single(pdev, dma_addr, | 322 | pci_unmap_single(pdev, dma_addr, |
| 323 | size, PCI_DMA_BIDIRECTIONAL); | 323 | size, PCI_DMA_BIDIRECTIONAL); |
| 324 | } | 324 | } |
| 325 | } | 325 | } |
| 326 | return mic_addr; | 326 | return mic_addr; |
| @@ -366,8 +366,8 @@ int mic_smpt_init(struct mic_device *mdev) | |||
| 366 | 366 | ||
| 367 | smpt_info = mdev->smpt; | 367 | smpt_info = mdev->smpt; |
| 368 | mdev->smpt_ops->init(mdev); | 368 | mdev->smpt_ops->init(mdev); |
| 369 | smpt_info->entry = kmalloc(sizeof(struct mic_smpt) | 369 | smpt_info->entry = kmalloc_array(smpt_info->info.num_reg, |
| 370 | * smpt_info->info.num_reg, GFP_KERNEL); | 370 | sizeof(*smpt_info->entry), GFP_KERNEL); |
| 371 | if (!smpt_info->entry) { | 371 | if (!smpt_info->entry) { |
| 372 | err = -ENOMEM; | 372 | err = -ENOMEM; |
| 373 | goto free_smpt; | 373 | goto free_smpt; |
| @@ -412,7 +412,7 @@ void mic_smpt_uninit(struct mic_device *mdev) | |||
| 412 | smpt_info->entry[i].ref_count); | 412 | smpt_info->entry[i].ref_count); |
| 413 | if (smpt_info->entry[i].ref_count) | 413 | if (smpt_info->entry[i].ref_count) |
| 414 | dev_warn(mdev->sdev->parent, | 414 | dev_warn(mdev->sdev->parent, |
| 415 | "ref count for entry %d is not zero\n", i); | 415 | "ref count for entry %d is not zero\n", i); |
| 416 | } | 416 | } |
| 417 | kfree(smpt_info->entry); | 417 | kfree(smpt_info->entry); |
| 418 | kfree(smpt_info); | 418 | kfree(smpt_info); |
diff --git a/drivers/misc/mic/host/mic_sysfs.c b/drivers/misc/mic/host/mic_sysfs.c index 029a4f31bee7..75746adfb155 100644 --- a/drivers/misc/mic/host/mic_sysfs.c +++ b/drivers/misc/mic/host/mic_sysfs.c | |||
| @@ -130,7 +130,7 @@ state_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 130 | 130 | ||
| 131 | static ssize_t | 131 | static ssize_t |
| 132 | state_store(struct device *dev, struct device_attribute *attr, | 132 | state_store(struct device *dev, struct device_attribute *attr, |
| 133 | const char *buf, size_t count) | 133 | const char *buf, size_t count) |
| 134 | { | 134 | { |
| 135 | int rc = 0; | 135 | int rc = 0; |
| 136 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 136 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| @@ -163,7 +163,7 @@ done: | |||
| 163 | static DEVICE_ATTR_RW(state); | 163 | static DEVICE_ATTR_RW(state); |
| 164 | 164 | ||
| 165 | static ssize_t shutdown_status_show(struct device *dev, | 165 | static ssize_t shutdown_status_show(struct device *dev, |
| 166 | struct device_attribute *attr, char *buf) | 166 | struct device_attribute *attr, char *buf) |
| 167 | { | 167 | { |
| 168 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 168 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 169 | 169 | ||
| @@ -193,7 +193,7 @@ cmdline_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 193 | 193 | ||
| 194 | static ssize_t | 194 | static ssize_t |
| 195 | cmdline_store(struct device *dev, struct device_attribute *attr, | 195 | cmdline_store(struct device *dev, struct device_attribute *attr, |
| 196 | const char *buf, size_t count) | 196 | const char *buf, size_t count) |
| 197 | { | 197 | { |
| 198 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 198 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 199 | 199 | ||
| @@ -239,7 +239,7 @@ firmware_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 239 | 239 | ||
| 240 | static ssize_t | 240 | static ssize_t |
| 241 | firmware_store(struct device *dev, struct device_attribute *attr, | 241 | firmware_store(struct device *dev, struct device_attribute *attr, |
| 242 | const char *buf, size_t count) | 242 | const char *buf, size_t count) |
| 243 | { | 243 | { |
| 244 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 244 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 245 | 245 | ||
| @@ -284,7 +284,7 @@ ramdisk_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 284 | 284 | ||
| 285 | static ssize_t | 285 | static ssize_t |
| 286 | ramdisk_store(struct device *dev, struct device_attribute *attr, | 286 | ramdisk_store(struct device *dev, struct device_attribute *attr, |
| 287 | const char *buf, size_t count) | 287 | const char *buf, size_t count) |
| 288 | { | 288 | { |
| 289 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 289 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 290 | 290 | ||
| @@ -330,7 +330,7 @@ bootmode_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
| 330 | 330 | ||
| 331 | static ssize_t | 331 | static ssize_t |
| 332 | bootmode_store(struct device *dev, struct device_attribute *attr, | 332 | bootmode_store(struct device *dev, struct device_attribute *attr, |
| 333 | const char *buf, size_t count) | 333 | const char *buf, size_t count) |
| 334 | { | 334 | { |
| 335 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 335 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 336 | 336 | ||
| @@ -363,7 +363,7 @@ static DEVICE_ATTR_RW(bootmode); | |||
| 363 | 363 | ||
| 364 | static ssize_t | 364 | static ssize_t |
| 365 | log_buf_addr_show(struct device *dev, struct device_attribute *attr, | 365 | log_buf_addr_show(struct device *dev, struct device_attribute *attr, |
| 366 | char *buf) | 366 | char *buf) |
| 367 | { | 367 | { |
| 368 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 368 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 369 | 369 | ||
| @@ -375,7 +375,7 @@ log_buf_addr_show(struct device *dev, struct device_attribute *attr, | |||
| 375 | 375 | ||
| 376 | static ssize_t | 376 | static ssize_t |
| 377 | log_buf_addr_store(struct device *dev, struct device_attribute *attr, | 377 | log_buf_addr_store(struct device *dev, struct device_attribute *attr, |
| 378 | const char *buf, size_t count) | 378 | const char *buf, size_t count) |
| 379 | { | 379 | { |
| 380 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 380 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 381 | int ret; | 381 | int ret; |
| @@ -397,7 +397,7 @@ static DEVICE_ATTR_RW(log_buf_addr); | |||
| 397 | 397 | ||
| 398 | static ssize_t | 398 | static ssize_t |
| 399 | log_buf_len_show(struct device *dev, struct device_attribute *attr, | 399 | log_buf_len_show(struct device *dev, struct device_attribute *attr, |
| 400 | char *buf) | 400 | char *buf) |
| 401 | { | 401 | { |
| 402 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 402 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 403 | 403 | ||
| @@ -409,7 +409,7 @@ log_buf_len_show(struct device *dev, struct device_attribute *attr, | |||
| 409 | 409 | ||
| 410 | static ssize_t | 410 | static ssize_t |
| 411 | log_buf_len_store(struct device *dev, struct device_attribute *attr, | 411 | log_buf_len_store(struct device *dev, struct device_attribute *attr, |
| 412 | const char *buf, size_t count) | 412 | const char *buf, size_t count) |
| 413 | { | 413 | { |
| 414 | struct mic_device *mdev = dev_get_drvdata(dev->parent); | 414 | struct mic_device *mdev = dev_get_drvdata(dev->parent); |
| 415 | int ret; | 415 | int ret; |
diff --git a/drivers/misc/mic/host/mic_virtio.c b/drivers/misc/mic/host/mic_virtio.c index 9e0456fb1ea8..0c883cd4f1d1 100644 --- a/drivers/misc/mic/host/mic_virtio.c +++ b/drivers/misc/mic/host/mic_virtio.c | |||
| @@ -195,7 +195,7 @@ static int _mic_virtio_copy(struct mic_vdev *mvdev, | |||
| 195 | MIC_VRINGH_READ, &out_len); | 195 | MIC_VRINGH_READ, &out_len); |
| 196 | if (ret) { | 196 | if (ret) { |
| 197 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 197 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| 198 | __func__, __LINE__, ret); | 198 | __func__, __LINE__, ret); |
| 199 | break; | 199 | break; |
| 200 | } | 200 | } |
| 201 | len -= out_len; | 201 | len -= out_len; |
| @@ -206,7 +206,7 @@ static int _mic_virtio_copy(struct mic_vdev *mvdev, | |||
| 206 | !MIC_VRINGH_READ, &out_len); | 206 | !MIC_VRINGH_READ, &out_len); |
| 207 | if (ret) { | 207 | if (ret) { |
| 208 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 208 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| 209 | __func__, __LINE__, ret); | 209 | __func__, __LINE__, ret); |
| 210 | break; | 210 | break; |
| 211 | } | 211 | } |
| 212 | len -= out_len; | 212 | len -= out_len; |
| @@ -225,8 +225,7 @@ static int _mic_virtio_copy(struct mic_vdev *mvdev, | |||
| 225 | * Update the used ring if a descriptor was available and some data was | 225 | * Update the used ring if a descriptor was available and some data was |
| 226 | * copied in/out and the user asked for a used ring update. | 226 | * copied in/out and the user asked for a used ring update. |
| 227 | */ | 227 | */ |
| 228 | if (*head != USHRT_MAX && copy->out_len && | 228 | if (*head != USHRT_MAX && copy->out_len && copy->update_used) { |
| 229 | copy->update_used) { | ||
| 230 | u32 total = 0; | 229 | u32 total = 0; |
| 231 | 230 | ||
| 232 | /* Determine the total data consumed */ | 231 | /* Determine the total data consumed */ |
| @@ -367,7 +366,6 @@ void mic_bh_handler(struct work_struct *work) | |||
| 367 | 366 | ||
| 368 | static irqreturn_t mic_virtio_intr_handler(int irq, void *data) | 367 | static irqreturn_t mic_virtio_intr_handler(int irq, void *data) |
| 369 | { | 368 | { |
| 370 | |||
| 371 | struct mic_vdev *mvdev = data; | 369 | struct mic_vdev *mvdev = data; |
| 372 | struct mic_device *mdev = mvdev->mdev; | 370 | struct mic_device *mdev = mvdev->mdev; |
| 373 | 371 | ||
| @@ -394,7 +392,7 @@ int mic_virtio_config_change(struct mic_vdev *mvdev, | |||
| 394 | } | 392 | } |
| 395 | 393 | ||
| 396 | if (copy_from_user(mic_vq_configspace(mvdev->dd), | 394 | if (copy_from_user(mic_vq_configspace(mvdev->dd), |
| 397 | argp, mvdev->dd->config_len)) { | 395 | argp, mvdev->dd->config_len)) { |
| 398 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 396 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| 399 | __func__, __LINE__, -EFAULT); | 397 | __func__, __LINE__, -EFAULT); |
| 400 | ret = -EFAULT; | 398 | ret = -EFAULT; |
| @@ -438,8 +436,8 @@ static int mic_copy_dp_entry(struct mic_vdev *mvdev, | |||
| 438 | return -EFAULT; | 436 | return -EFAULT; |
| 439 | } | 437 | } |
| 440 | 438 | ||
| 441 | if (mic_aligned_desc_size(&dd) > MIC_MAX_DESC_BLK_SIZE | 439 | if (mic_aligned_desc_size(&dd) > MIC_MAX_DESC_BLK_SIZE || |
| 442 | || dd.num_vq > MIC_MAX_VRINGS) { | 440 | dd.num_vq > MIC_MAX_VRINGS) { |
| 443 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 441 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| 444 | __func__, __LINE__, -EINVAL); | 442 | __func__, __LINE__, -EINVAL); |
| 445 | return -EINVAL; | 443 | return -EINVAL; |
| @@ -503,7 +501,7 @@ static void mic_init_device_ctrl(struct mic_vdev *mvdev, | |||
| 503 | { | 501 | { |
| 504 | struct mic_device_ctrl *dc; | 502 | struct mic_device_ctrl *dc; |
| 505 | 503 | ||
| 506 | dc = mvdev->dc = (void *)devpage + mic_aligned_desc_size(devpage); | 504 | dc = (void *)devpage + mic_aligned_desc_size(devpage); |
| 507 | 505 | ||
| 508 | dc->config_change = 0; | 506 | dc->config_change = 0; |
| 509 | dc->guest_ack = 0; | 507 | dc->guest_ack = 0; |
| @@ -512,6 +510,7 @@ static void mic_init_device_ctrl(struct mic_vdev *mvdev, | |||
| 512 | dc->used_address_updated = 0; | 510 | dc->used_address_updated = 0; |
| 513 | dc->c2h_vdev_db = -1; | 511 | dc->c2h_vdev_db = -1; |
| 514 | dc->h2c_vdev_db = -1; | 512 | dc->h2c_vdev_db = -1; |
| 513 | mvdev->dc = dc; | ||
| 515 | } | 514 | } |
| 516 | 515 | ||
| 517 | int mic_virtio_add_device(struct mic_vdev *mvdev, | 516 | int mic_virtio_add_device(struct mic_vdev *mvdev, |
| @@ -551,7 +550,7 @@ int mic_virtio_add_device(struct mic_vdev *mvdev, | |||
| 551 | sizeof(struct _mic_vring_info)); | 550 | sizeof(struct _mic_vring_info)); |
| 552 | vr->va = (void *) | 551 | vr->va = (void *) |
| 553 | __get_free_pages(GFP_KERNEL | __GFP_ZERO, | 552 | __get_free_pages(GFP_KERNEL | __GFP_ZERO, |
| 554 | get_order(vr_size)); | 553 | get_order(vr_size)); |
| 555 | if (!vr->va) { | 554 | if (!vr->va) { |
| 556 | ret = -ENOMEM; | 555 | ret = -ENOMEM; |
| 557 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 556 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| @@ -564,8 +563,7 @@ int mic_virtio_add_device(struct mic_vdev *mvdev, | |||
| 564 | vqconfig[i].address = mic_map_single(mdev, | 563 | vqconfig[i].address = mic_map_single(mdev, |
| 565 | vr->va, vr_size); | 564 | vr->va, vr_size); |
| 566 | if (mic_map_error(vqconfig[i].address)) { | 565 | if (mic_map_error(vqconfig[i].address)) { |
| 567 | free_pages((unsigned long)vr->va, | 566 | free_pages((unsigned long)vr->va, get_order(vr_size)); |
| 568 | get_order(vr_size)); | ||
| 569 | ret = -ENOMEM; | 567 | ret = -ENOMEM; |
| 570 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 568 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
| 571 | __func__, __LINE__, ret); | 569 | __func__, __LINE__, ret); |
| @@ -573,8 +571,7 @@ int mic_virtio_add_device(struct mic_vdev *mvdev, | |||
| 573 | } | 571 | } |
| 574 | vqconfig[i].address = cpu_to_le64(vqconfig[i].address); | 572 | vqconfig[i].address = cpu_to_le64(vqconfig[i].address); |
| 575 | 573 | ||
| 576 | vring_init(&vr->vr, num, | 574 | vring_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN); |
| 577 | vr->va, MIC_VIRTIO_RING_ALIGN); | ||
| 578 | ret = vringh_init_kern(&mvr->vrh, | 575 | ret = vringh_init_kern(&mvr->vrh, |
| 579 | *(u32 *)mic_vq_features(mvdev->dd), num, false, | 576 | *(u32 *)mic_vq_features(mvdev->dd), num, false, |
| 580 | vr->vr.desc, vr->vr.avail, vr->vr.used); | 577 | vr->vr.desc, vr->vr.avail, vr->vr.used); |
| @@ -593,8 +590,8 @@ int mic_virtio_add_device(struct mic_vdev *mvdev, | |||
| 593 | __func__, __LINE__, i, vr->va, vr->info, vr_size); | 590 | __func__, __LINE__, i, vr->va, vr->info, vr_size); |
| 594 | } | 591 | } |
| 595 | 592 | ||
| 596 | snprintf(irqname, sizeof(irqname), | 593 | snprintf(irqname, sizeof(irqname), "mic%dvirtio%d", mdev->id, |
| 597 | "mic%dvirtio%d", mdev->id, mvdev->virtio_id); | 594 | mvdev->virtio_id); |
| 598 | mvdev->virtio_db = mic_next_db(mdev); | 595 | mvdev->virtio_db = mic_next_db(mdev); |
| 599 | mvdev->virtio_cookie = mic_request_irq(mdev, mic_virtio_intr_handler, | 596 | mvdev->virtio_cookie = mic_request_irq(mdev, mic_virtio_intr_handler, |
| 600 | irqname, mvdev, mvdev->virtio_db, MIC_INTR_DB); | 597 | irqname, mvdev, mvdev->virtio_db, MIC_INTR_DB); |
| @@ -628,9 +625,9 @@ err: | |||
| 628 | for (j = 0; j < i; j++) { | 625 | for (j = 0; j < i; j++) { |
| 629 | struct mic_vringh *mvr = &mvdev->mvr[j]; | 626 | struct mic_vringh *mvr = &mvdev->mvr[j]; |
| 630 | mic_unmap_single(mdev, le64_to_cpu(vqconfig[j].address), | 627 | mic_unmap_single(mdev, le64_to_cpu(vqconfig[j].address), |
| 631 | mvr->vring.len); | 628 | mvr->vring.len); |
| 632 | free_pages((unsigned long)mvr->vring.va, | 629 | free_pages((unsigned long)mvr->vring.va, |
| 633 | get_order(mvr->vring.len)); | 630 | get_order(mvr->vring.len)); |
| 634 | } | 631 | } |
| 635 | mutex_unlock(&mdev->mic_mutex); | 632 | mutex_unlock(&mdev->mic_mutex); |
| 636 | return ret; | 633 | return ret; |
| @@ -676,9 +673,9 @@ skip_hot_remove: | |||
| 676 | vringh_kiov_cleanup(&mvr->riov); | 673 | vringh_kiov_cleanup(&mvr->riov); |
| 677 | vringh_kiov_cleanup(&mvr->wiov); | 674 | vringh_kiov_cleanup(&mvr->wiov); |
| 678 | mic_unmap_single(mdev, le64_to_cpu(vqconfig[i].address), | 675 | mic_unmap_single(mdev, le64_to_cpu(vqconfig[i].address), |
| 679 | mvr->vring.len); | 676 | mvr->vring.len); |
| 680 | free_pages((unsigned long)mvr->vring.va, | 677 | free_pages((unsigned long)mvr->vring.va, |
| 681 | get_order(mvr->vring.len)); | 678 | get_order(mvr->vring.len)); |
| 682 | } | 679 | } |
| 683 | 680 | ||
| 684 | list_for_each_safe(pos, tmp, &mdev->vdev_list) { | 681 | list_for_each_safe(pos, tmp, &mdev->vdev_list) { |
diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c index 3a0d660bad4a..81e9541b784c 100644 --- a/drivers/misc/mic/host/mic_x100.c +++ b/drivers/misc/mic/host/mic_x100.c | |||
| @@ -46,8 +46,8 @@ mic_x100_write_spad(struct mic_device *mdev, unsigned int idx, u32 val) | |||
| 46 | dev_dbg(mdev->sdev->parent, "Writing 0x%x to scratch pad index %d\n", | 46 | dev_dbg(mdev->sdev->parent, "Writing 0x%x to scratch pad index %d\n", |
| 47 | val, idx); | 47 | val, idx); |
| 48 | mic_mmio_write(&mdev->mmio, val, | 48 | mic_mmio_write(&mdev->mmio, val, |
| 49 | MIC_X100_SBOX_BASE_ADDRESS + | 49 | MIC_X100_SBOX_BASE_ADDRESS + |
| 50 | MIC_X100_SBOX_SPAD0 + idx * 4); | 50 | MIC_X100_SBOX_SPAD0 + idx * 4); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /** | 53 | /** |
| @@ -130,8 +130,8 @@ static void mic_x100_send_sbox_intr(struct mic_device *mdev, | |||
| 130 | { | 130 | { |
| 131 | struct mic_mw *mw = &mdev->mmio; | 131 | struct mic_mw *mw = &mdev->mmio; |
| 132 | u64 apic_icr_offset = MIC_X100_SBOX_APICICR0 + doorbell * 8; | 132 | u64 apic_icr_offset = MIC_X100_SBOX_APICICR0 + doorbell * 8; |
| 133 | u32 apicicr_low = mic_mmio_read(mw, | 133 | u32 apicicr_low = mic_mmio_read(mw, MIC_X100_SBOX_BASE_ADDRESS + |
| 134 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset); | 134 | apic_icr_offset); |
| 135 | 135 | ||
| 136 | /* for MIC we need to make sure we "hit" the send_icr bit (13) */ | 136 | /* for MIC we need to make sure we "hit" the send_icr bit (13) */ |
| 137 | apicicr_low = (apicicr_low | (1 << 13)); | 137 | apicicr_low = (apicicr_low | (1 << 13)); |
| @@ -139,7 +139,7 @@ static void mic_x100_send_sbox_intr(struct mic_device *mdev, | |||
| 139 | /* Ensure that the interrupt is ordered w.r.t. previous stores. */ | 139 | /* Ensure that the interrupt is ordered w.r.t. previous stores. */ |
| 140 | wmb(); | 140 | wmb(); |
| 141 | mic_mmio_write(mw, apicicr_low, | 141 | mic_mmio_write(mw, apicicr_low, |
| 142 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset); | 142 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | /** | 145 | /** |
| @@ -153,7 +153,7 @@ static void mic_x100_send_rdmasr_intr(struct mic_device *mdev, | |||
| 153 | /* Ensure that the interrupt is ordered w.r.t. previous stores. */ | 153 | /* Ensure that the interrupt is ordered w.r.t. previous stores. */ |
| 154 | wmb(); | 154 | wmb(); |
| 155 | mic_mmio_write(&mdev->mmio, 0, | 155 | mic_mmio_write(&mdev->mmio, 0, |
| 156 | MIC_X100_SBOX_BASE_ADDRESS + rdmasr_offset); | 156 | MIC_X100_SBOX_BASE_ADDRESS + rdmasr_offset); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /** | 159 | /** |
| @@ -212,7 +212,7 @@ done: | |||
| 212 | */ | 212 | */ |
| 213 | static void mic_x100_hw_intr_init(struct mic_device *mdev) | 213 | static void mic_x100_hw_intr_init(struct mic_device *mdev) |
| 214 | { | 214 | { |
| 215 | mdev->intr_info = (struct mic_intr_info *) mic_x100_intr_init; | 215 | mdev->intr_info = (struct mic_intr_info *)mic_x100_intr_init; |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | /** | 218 | /** |
| @@ -244,7 +244,7 @@ mic_x100_read_msi_to_src_map(struct mic_device *mdev, int idx) | |||
| 244 | */ | 244 | */ |
| 245 | static void | 245 | static void |
| 246 | mic_x100_program_msi_to_src_map(struct mic_device *mdev, | 246 | mic_x100_program_msi_to_src_map(struct mic_device *mdev, |
| 247 | int idx, int offset, bool set) | 247 | int idx, int offset, bool set) |
| 248 | { | 248 | { |
| 249 | unsigned long reg; | 249 | unsigned long reg; |
| 250 | struct mic_mw *mw = &mdev->mmio; | 250 | struct mic_mw *mw = &mdev->mmio; |
| @@ -308,12 +308,12 @@ static void mic_x100_send_firmware_intr(struct mic_device *mdev) | |||
| 308 | apicicr_low = (vector | (1 << 13)); | 308 | apicicr_low = (vector | (1 << 13)); |
| 309 | 309 | ||
| 310 | mic_mmio_write(mw, mic_x100_get_apic_id(mdev), | 310 | mic_mmio_write(mw, mic_x100_get_apic_id(mdev), |
| 311 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset + 4); | 311 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset + 4); |
| 312 | 312 | ||
| 313 | /* Ensure that the interrupt is ordered w.r.t. previous stores. */ | 313 | /* Ensure that the interrupt is ordered w.r.t. previous stores. */ |
| 314 | wmb(); | 314 | wmb(); |
| 315 | mic_mmio_write(mw, apicicr_low, | 315 | mic_mmio_write(mw, apicicr_low, |
| 316 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset); | 316 | MIC_X100_SBOX_BASE_ADDRESS + apic_icr_offset); |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | /** | 319 | /** |
| @@ -365,8 +365,7 @@ mic_x100_load_command_line(struct mic_device *mdev, const struct firmware *fw) | |||
| 365 | len += snprintf(buf, CMDLINE_SIZE - len, | 365 | len += snprintf(buf, CMDLINE_SIZE - len, |
| 366 | " mem=%dM", boot_mem); | 366 | " mem=%dM", boot_mem); |
| 367 | if (mdev->cmdline) | 367 | if (mdev->cmdline) |
| 368 | snprintf(buf + len, CMDLINE_SIZE - len, | 368 | snprintf(buf + len, CMDLINE_SIZE - len, " %s", mdev->cmdline); |
| 369 | " %s", mdev->cmdline); | ||
| 370 | memcpy_toio(cmd_line_va, buf, strlen(buf) + 1); | 369 | memcpy_toio(cmd_line_va, buf, strlen(buf) + 1); |
| 371 | kfree(buf); | 370 | kfree(buf); |
| 372 | return 0; | 371 | return 0; |
| @@ -397,8 +396,7 @@ mic_x100_load_ramdisk(struct mic_device *mdev) | |||
| 397 | * Typically the bootaddr for card OS is 64M | 396 | * Typically the bootaddr for card OS is 64M |
| 398 | * so copy over the ramdisk @ 128M. | 397 | * so copy over the ramdisk @ 128M. |
| 399 | */ | 398 | */ |
| 400 | memcpy_toio(mdev->aper.va + (mdev->bootaddr << 1), | 399 | memcpy_toio(mdev->aper.va + (mdev->bootaddr << 1), fw->data, fw->size); |
| 401 | fw->data, fw->size); | ||
| 402 | iowrite32(cpu_to_le32(mdev->bootaddr << 1), &bp->hdr.ramdisk_image); | 400 | iowrite32(cpu_to_le32(mdev->bootaddr << 1), &bp->hdr.ramdisk_image); |
| 403 | iowrite32(cpu_to_le32(fw->size), &bp->hdr.ramdisk_size); | 401 | iowrite32(cpu_to_le32(fw->size), &bp->hdr.ramdisk_size); |
| 404 | release_firmware(fw); | 402 | release_firmware(fw); |
| @@ -484,8 +482,7 @@ mic_x100_load_firmware(struct mic_device *mdev, const char *buf) | |||
| 484 | if (mdev->ramdisk) | 482 | if (mdev->ramdisk) |
| 485 | rc = mic_x100_load_ramdisk(mdev); | 483 | rc = mic_x100_load_ramdisk(mdev); |
| 486 | error: | 484 | error: |
| 487 | dev_dbg(mdev->sdev->parent, "%s %d rc %d\n", | 485 | dev_dbg(mdev->sdev->parent, "%s %d rc %d\n", __func__, __LINE__, rc); |
| 488 | __func__, __LINE__, rc); | ||
| 489 | done: | 486 | done: |
| 490 | return rc; | 487 | return rc; |
| 491 | } | 488 | } |
| @@ -524,8 +521,8 @@ mic_x100_smpt_set(struct mic_device *mdev, dma_addr_t dma_addr, u8 index) | |||
| 524 | uint32_t smpt_reg_val = BUILD_SMPT(SNOOP_ON, | 521 | uint32_t smpt_reg_val = BUILD_SMPT(SNOOP_ON, |
| 525 | dma_addr >> mdev->smpt->info.page_shift); | 522 | dma_addr >> mdev->smpt->info.page_shift); |
| 526 | mic_mmio_write(&mdev->mmio, smpt_reg_val, | 523 | mic_mmio_write(&mdev->mmio, smpt_reg_val, |
| 527 | MIC_X100_SBOX_BASE_ADDRESS + | 524 | MIC_X100_SBOX_BASE_ADDRESS + |
| 528 | MIC_X100_SBOX_SMPT00 + (4 * index)); | 525 | MIC_X100_SBOX_SMPT00 + (4 * index)); |
| 529 | } | 526 | } |
| 530 | 527 | ||
| 531 | /** | 528 | /** |
