aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/mic
diff options
context:
space:
mode:
authorAshutosh Dixit <ashutosh.dixit@intel.com>2013-09-27 12:49:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-27 20:20:19 -0400
commitced2c60fb5024a5cf5c33cb573b3d6a66d738f36 (patch)
tree19763d6180d0a9b16f0da478c4801f3445424b28 /Documentation/mic
parent4aa79961a50119d6112a160e97d5e6a77656b68c (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 'Documentation/mic')
-rw-r--r--Documentation/mic/mpssd/mpssd.c65
-rw-r--r--Documentation/mic/mpssd/sysfs.c4
2 files changed, 35 insertions, 34 deletions
diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c
index 8064804cdac3..f9327a29ae4c 100644
--- a/Documentation/mic/mpssd/mpssd.c
+++ b/Documentation/mic/mpssd/mpssd.c
@@ -246,7 +246,7 @@ static int tun_alloc(struct mic_info *mic, char *dev)
246 if (*dev) 246 if (*dev)
247 strncpy(ifr.ifr_name, dev, IFNAMSIZ); 247 strncpy(ifr.ifr_name, dev, IFNAMSIZ);
248 248
249 err = ioctl(fd, TUNSETIFF, (void *) &ifr); 249 err = ioctl(fd, TUNSETIFF, (void *)&ifr);
250 if (err < 0) { 250 if (err < 0) {
251 mpsslog("%s %s %d TUNSETIFF failed %s\n", 251 mpsslog("%s %s %d TUNSETIFF failed %s\n",
252 mic->name, __func__, __LINE__, strerror(errno)); 252 mic->name, __func__, __LINE__, strerror(errno));
@@ -363,7 +363,7 @@ static inline void verify_out_len(struct mic_info *mic,
363{ 363{
364 if (copy->out_len != sum_iovec_len(copy)) { 364 if (copy->out_len != sum_iovec_len(copy)) {
365 mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%x\n", 365 mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%x\n",
366 mic->name, __func__, __LINE__, 366 mic->name, __func__, __LINE__,
367 copy->out_len, sum_iovec_len(copy)); 367 copy->out_len, sum_iovec_len(copy));
368 assert(copy->out_len == sum_iovec_len(copy)); 368 assert(copy->out_len == sum_iovec_len(copy));
369 } 369 }
@@ -372,7 +372,7 @@ static inline void verify_out_len(struct mic_info *mic,
372/* Display an iovec */ 372/* Display an iovec */
373static void 373static void
374disp_iovec(struct mic_info *mic, struct mic_copy_desc *copy, 374disp_iovec(struct mic_info *mic, struct mic_copy_desc *copy,
375 const char *s, int line) 375 const char *s, int line)
376{ 376{
377 int i; 377 int i;
378 378
@@ -401,7 +401,7 @@ static inline void txrx_prepare(int type, bool tx, struct mic_vring *vr,
401/* Central API which triggers the copies */ 401/* Central API which triggers the copies */
402static int 402static int
403mic_virtio_copy(struct mic_info *mic, int fd, 403mic_virtio_copy(struct mic_info *mic, int fd,
404 struct mic_vring *vr, struct mic_copy_desc *copy) 404 struct mic_vring *vr, struct mic_copy_desc *copy)
405{ 405{
406 int ret; 406 int ret;
407 407
@@ -440,7 +440,7 @@ init_vr(struct mic_info *mic, int fd, int type,
440 vr0->info = vr0->va + 440 vr0->info = vr0->va +
441 vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN); 441 vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN);
442 vring_init(&vr0->vr, 442 vring_init(&vr0->vr,
443 MIC_VRING_ENTRIES, vr0->va, MIC_VIRTIO_RING_ALIGN); 443 MIC_VRING_ENTRIES, vr0->va, MIC_VIRTIO_RING_ALIGN);
444 mpsslog("%s %s vr0 %p vr0->info %p vr_size 0x%x vring 0x%x ", 444 mpsslog("%s %s vr0 %p vr0->info %p vr_size 0x%x vring 0x%x ",
445 __func__, mic->name, vr0->va, vr0->info, vr_size, 445 __func__, mic->name, vr0->va, vr0->info, vr_size,
446 vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN)); 446 vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN));
@@ -453,7 +453,7 @@ init_vr(struct mic_info *mic, int fd, int type,
453 vr1->info = vr1->va + vring_size(MIC_VRING_ENTRIES, 453 vr1->info = vr1->va + vring_size(MIC_VRING_ENTRIES,
454 MIC_VIRTIO_RING_ALIGN); 454 MIC_VIRTIO_RING_ALIGN);
455 vring_init(&vr1->vr, 455 vring_init(&vr1->vr,
456 MIC_VRING_ENTRIES, vr1->va, MIC_VIRTIO_RING_ALIGN); 456 MIC_VRING_ENTRIES, vr1->va, MIC_VIRTIO_RING_ALIGN);
457 mpsslog("%s %s vr1 %p vr1->info %p vr_size 0x%x vring 0x%x ", 457 mpsslog("%s %s vr1 %p vr1->info %p vr_size 0x%x vring 0x%x ",
458 __func__, mic->name, vr1->va, vr1->info, vr_size, 458 __func__, mic->name, vr1->va, vr1->info, vr_size,
459 vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN)); 459 vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN));
@@ -551,7 +551,7 @@ virtio_net(void *arg)
551 net_poll[NET_FD_TUN].events = POLLIN; 551 net_poll[NET_FD_TUN].events = POLLIN;
552 552
553 if (MAP_FAILED == init_vr(mic, mic->mic_net.virtio_net_fd, 553 if (MAP_FAILED == init_vr(mic, mic->mic_net.virtio_net_fd,
554 VIRTIO_ID_NET, &tx_vr, &rx_vr, 554 VIRTIO_ID_NET, &tx_vr, &rx_vr,
555 virtnet_dev_page.dd.num_vq)) { 555 virtnet_dev_page.dd.num_vq)) {
556 mpsslog("%s init_vr failed %s\n", 556 mpsslog("%s init_vr failed %s\n",
557 mic->name, strerror(errno)); 557 mic->name, strerror(errno));
@@ -576,7 +576,7 @@ virtio_net(void *arg)
576 } 576 }
577 if (!(desc->status & VIRTIO_CONFIG_S_DRIVER_OK)) 577 if (!(desc->status & VIRTIO_CONFIG_S_DRIVER_OK))
578 wait_for_card_driver(mic, mic->mic_net.virtio_net_fd, 578 wait_for_card_driver(mic, mic->mic_net.virtio_net_fd,
579 VIRTIO_ID_NET); 579 VIRTIO_ID_NET);
580 /* 580 /*
581 * Check if there is data to be read from TUN and write to 581 * Check if there is data to be read from TUN and write to
582 * virtio net fd if there is. 582 * virtio net fd if there is.
@@ -587,7 +587,7 @@ virtio_net(void *arg)
587 copy.iov, copy.iovcnt); 587 copy.iov, copy.iovcnt);
588 if (len > 0) { 588 if (len > 0) {
589 struct virtio_net_hdr *hdr 589 struct virtio_net_hdr *hdr
590 = (struct virtio_net_hdr *) vnet_hdr[0]; 590 = (struct virtio_net_hdr *)vnet_hdr[0];
591 591
592 /* Disable checksums on the card since we are on 592 /* Disable checksums on the card since we are on
593 a reliable PCIe link */ 593 a reliable PCIe link */
@@ -606,7 +606,7 @@ virtio_net(void *arg)
606#endif 606#endif
607 spin_for_descriptors(mic, &tx_vr); 607 spin_for_descriptors(mic, &tx_vr);
608 txrx_prepare(VIRTIO_ID_NET, 1, &tx_vr, &copy, 608 txrx_prepare(VIRTIO_ID_NET, 1, &tx_vr, &copy,
609 len); 609 len);
610 610
611 err = mic_virtio_copy(mic, 611 err = mic_virtio_copy(mic,
612 mic->mic_net.virtio_net_fd, &tx_vr, 612 mic->mic_net.virtio_net_fd, &tx_vr,
@@ -644,7 +644,7 @@ virtio_net(void *arg)
644 le16toh(rx_vr.vr.avail->idx)) { 644 le16toh(rx_vr.vr.avail->idx)) {
645 copy.iov = iov1; 645 copy.iov = iov1;
646 txrx_prepare(VIRTIO_ID_NET, 0, &rx_vr, &copy, 646 txrx_prepare(VIRTIO_ID_NET, 0, &rx_vr, &copy,
647 MAX_NET_PKT_SIZE 647 MAX_NET_PKT_SIZE
648 + sizeof(struct virtio_net_hdr)); 648 + sizeof(struct virtio_net_hdr));
649 649
650 err = mic_virtio_copy(mic, 650 err = mic_virtio_copy(mic,
@@ -669,7 +669,7 @@ virtio_net(void *arg)
669 verify_out_len(mic, &copy); 669 verify_out_len(mic, &copy);
670#ifdef DEBUG 670#ifdef DEBUG
671 disp_iovec(mic, copy, __func__, 671 disp_iovec(mic, copy, __func__,
672 __LINE__); 672 __LINE__);
673 mpsslog("%s %s %d ", 673 mpsslog("%s %s %d ",
674 mic->name, __func__, __LINE__); 674 mic->name, __func__, __LINE__);
675 mpsslog("read from net 0x%lx\n", 675 mpsslog("read from net 0x%lx\n",
@@ -686,7 +686,7 @@ virtio_net(void *arg)
686 } else { 686 } else {
687#ifdef DEBUG 687#ifdef DEBUG
688 disp_iovec(mic, &copy, __func__, 688 disp_iovec(mic, &copy, __func__,
689 __LINE__); 689 __LINE__);
690 mpsslog("%s %s %d ", 690 mpsslog("%s %s %d ",
691 mic->name, __func__, 691 mic->name, __func__,
692 __LINE__); 692 __LINE__);
@@ -750,13 +750,13 @@ virtio_console(void *arg)
750 err = grantpt(pty_fd); 750 err = grantpt(pty_fd);
751 if (err < 0) { 751 if (err < 0) {
752 mpsslog("can't grant access: %s %s\n", 752 mpsslog("can't grant access: %s %s\n",
753 pts_name, strerror(errno)); 753 pts_name, strerror(errno));
754 goto _close_pty; 754 goto _close_pty;
755 } 755 }
756 err = unlockpt(pty_fd); 756 err = unlockpt(pty_fd);
757 if (err < 0) { 757 if (err < 0) {
758 mpsslog("can't unlock a pseudoterminal: %s %s\n", 758 mpsslog("can't unlock a pseudoterminal: %s %s\n",
759 pts_name, strerror(errno)); 759 pts_name, strerror(errno));
760 goto _close_pty; 760 goto _close_pty;
761 } 761 }
762 console_poll[MONITOR_FD].fd = pty_fd; 762 console_poll[MONITOR_FD].fd = pty_fd;
@@ -766,7 +766,7 @@ virtio_console(void *arg)
766 console_poll[VIRTIO_CONSOLE_FD].events = POLLIN; 766 console_poll[VIRTIO_CONSOLE_FD].events = POLLIN;
767 767
768 if (MAP_FAILED == init_vr(mic, mic->mic_console.virtio_console_fd, 768 if (MAP_FAILED == init_vr(mic, mic->mic_console.virtio_console_fd,
769 VIRTIO_ID_CONSOLE, &tx_vr, &rx_vr, 769 VIRTIO_ID_CONSOLE, &tx_vr, &rx_vr,
770 virtcons_dev_page.dd.num_vq)) { 770 virtcons_dev_page.dd.num_vq)) {
771 mpsslog("%s init_vr failed %s\n", 771 mpsslog("%s init_vr failed %s\n",
772 mic->name, strerror(errno)); 772 mic->name, strerror(errno));
@@ -787,7 +787,7 @@ virtio_console(void *arg)
787 } 787 }
788 if (!(desc->status & VIRTIO_CONFIG_S_DRIVER_OK)) 788 if (!(desc->status & VIRTIO_CONFIG_S_DRIVER_OK))
789 wait_for_card_driver(mic, 789 wait_for_card_driver(mic,
790 mic->mic_console.virtio_console_fd, 790 mic->mic_console.virtio_console_fd,
791 VIRTIO_ID_CONSOLE); 791 VIRTIO_ID_CONSOLE);
792 792
793 if (console_poll[MONITOR_FD].revents & POLLIN) { 793 if (console_poll[MONITOR_FD].revents & POLLIN) {
@@ -802,7 +802,7 @@ virtio_console(void *arg)
802#endif 802#endif
803 spin_for_descriptors(mic, &tx_vr); 803 spin_for_descriptors(mic, &tx_vr);
804 txrx_prepare(VIRTIO_ID_CONSOLE, 1, &tx_vr, 804 txrx_prepare(VIRTIO_ID_CONSOLE, 1, &tx_vr,
805 &copy, len); 805 &copy, len);
806 806
807 err = mic_virtio_copy(mic, 807 err = mic_virtio_copy(mic,
808 mic->mic_console.virtio_console_fd, 808 mic->mic_console.virtio_console_fd,
@@ -837,7 +837,7 @@ virtio_console(void *arg)
837 le16toh(rx_vr.vr.avail->idx)) { 837 le16toh(rx_vr.vr.avail->idx)) {
838 copy.iov = iov1; 838 copy.iov = iov1;
839 txrx_prepare(VIRTIO_ID_CONSOLE, 0, &rx_vr, 839 txrx_prepare(VIRTIO_ID_CONSOLE, 0, &rx_vr,
840 &copy, PAGE_SIZE); 840 &copy, PAGE_SIZE);
841 841
842 err = mic_virtio_copy(mic, 842 err = mic_virtio_copy(mic,
843 mic->mic_console.virtio_console_fd, 843 mic->mic_console.virtio_console_fd,
@@ -848,7 +848,7 @@ virtio_console(void *arg)
848 verify_out_len(mic, &copy); 848 verify_out_len(mic, &copy);
849#ifdef DEBUG 849#ifdef DEBUG
850 disp_iovec(mic, copy, __func__, 850 disp_iovec(mic, copy, __func__,
851 __LINE__); 851 __LINE__);
852 mpsslog("%s %s %d ", 852 mpsslog("%s %s %d ",
853 mic->name, __func__, __LINE__); 853 mic->name, __func__, __LINE__);
854 mpsslog("read from net 0x%lx\n", 854 mpsslog("read from net 0x%lx\n",
@@ -865,7 +865,7 @@ virtio_console(void *arg)
865 } else { 865 } else {
866#ifdef DEBUG 866#ifdef DEBUG
867 disp_iovec(mic, copy, __func__, 867 disp_iovec(mic, copy, __func__,
868 __LINE__); 868 __LINE__);
869 mpsslog("%s %s %d ", 869 mpsslog("%s %s %d ",
870 mic->name, __func__, 870 mic->name, __func__,
871 __LINE__); 871 __LINE__);
@@ -1033,7 +1033,8 @@ start_virtblk(struct mic_info *mic, struct mic_vring *vring)
1033 } 1033 }
1034 add_virtio_device(mic, &virtblk_dev_page.dd); 1034 add_virtio_device(mic, &virtblk_dev_page.dd);
1035 if (MAP_FAILED == init_vr(mic, mic->mic_virtblk.virtio_block_fd, 1035 if (MAP_FAILED == init_vr(mic, mic->mic_virtblk.virtio_block_fd,
1036 VIRTIO_ID_BLOCK, vring, NULL, virtblk_dev_page.dd.num_vq)) { 1036 VIRTIO_ID_BLOCK, vring, NULL,
1037 virtblk_dev_page.dd.num_vq)) {
1037 mpsslog("%s init_vr failed %s\n", 1038 mpsslog("%s init_vr failed %s\n",
1038 mic->name, strerror(errno)); 1039 mic->name, strerror(errno));
1039 return false; 1040 return false;
@@ -1060,7 +1061,7 @@ header_error_check(struct vring_desc *desc)
1060{ 1061{
1061 if (le32toh(desc->len) != sizeof(struct virtio_blk_outhdr)) { 1062 if (le32toh(desc->len) != sizeof(struct virtio_blk_outhdr)) {
1062 mpsslog("%s() %d: length is not sizeof(virtio_blk_outhd)\n", 1063 mpsslog("%s() %d: length is not sizeof(virtio_blk_outhd)\n",
1063 __func__, __LINE__); 1064 __func__, __LINE__);
1064 return -EIO; 1065 return -EIO;
1065 } 1066 }
1066 if (!(le16toh(desc->flags) & VRING_DESC_F_NEXT)) { 1067 if (!(le16toh(desc->flags) & VRING_DESC_F_NEXT)) {
@@ -1132,7 +1133,7 @@ write_status(int fd, __u8 *status)
1132static void * 1133static void *
1133virtio_block(void *arg) 1134virtio_block(void *arg)
1134{ 1135{
1135 struct mic_info *mic = (struct mic_info *) arg; 1136 struct mic_info *mic = (struct mic_info *)arg;
1136 int ret; 1137 int ret;
1137 struct pollfd block_poll; 1138 struct pollfd block_poll;
1138 struct mic_vring vring; 1139 struct mic_vring vring;
@@ -1219,8 +1220,8 @@ virtio_block(void *arg)
1219 status = 0; 1220 status = 0;
1220 fos = mic->mic_virtblk.backend_addr + 1221 fos = mic->mic_virtblk.backend_addr +
1221 (hdr.sector * SECTOR_SIZE); 1222 (hdr.sector * SECTOR_SIZE);
1222 buffer_desc_idx = desc_idx = 1223 buffer_desc_idx = next_desc(desc);
1223 next_desc(desc); 1224 desc_idx = buffer_desc_idx;
1224 for (desc = &vring.vr.desc[buffer_desc_idx]; 1225 for (desc = &vring.vr.desc[buffer_desc_idx];
1225 desc->flags & VRING_DESC_F_NEXT; 1226 desc->flags & VRING_DESC_F_NEXT;
1226 desc_idx = next_desc(desc), 1227 desc_idx = next_desc(desc),
@@ -1255,7 +1256,7 @@ virtio_block(void *arg)
1255 iovec, 1256 iovec,
1256 piov - iovec); 1257 piov - iovec);
1257 if (ret < 0 && 1258 if (ret < 0 &&
1258 status != 0) 1259 status != 0)
1259 status = ret; 1260 status = ret;
1260 } 1261 }
1261 /* write status and update used pointer */ 1262 /* write status and update used pointer */
@@ -1391,7 +1392,7 @@ mic_config(void *arg)
1391 char value[4096]; 1392 char value[4096];
1392 1393
1393 snprintf(pathname, PATH_MAX - 1, "%s/%s/%s", 1394 snprintf(pathname, PATH_MAX - 1, "%s/%s/%s",
1394 MICSYSFSDIR, mic->name, "state"); 1395 MICSYSFSDIR, mic->name, "state");
1395 1396
1396 fd = open(pathname, O_RDONLY); 1397 fd = open(pathname, O_RDONLY);
1397 if (fd < 0) { 1398 if (fd < 0) {
@@ -1560,22 +1561,22 @@ init_mic(struct mic_info *mic)
1560 virtio_console, mic); 1561 virtio_console, mic);
1561 if (err) 1562 if (err)
1562 mpsslog("%s virtcons pthread_create failed %s\n", 1563 mpsslog("%s virtcons pthread_create failed %s\n",
1563 mic->name, strerror(err)); 1564 mic->name, strerror(err));
1564 err = pthread_create(&mic->mic_net.net_thread, NULL, 1565 err = pthread_create(&mic->mic_net.net_thread, NULL,
1565 virtio_net, mic); 1566 virtio_net, mic);
1566 if (err) 1567 if (err)
1567 mpsslog("%s virtnet pthread_create failed %s\n", 1568 mpsslog("%s virtnet pthread_create failed %s\n",
1568 mic->name, strerror(err)); 1569 mic->name, strerror(err));
1569 err = pthread_create(&mic->mic_virtblk.block_thread, NULL, 1570 err = pthread_create(&mic->mic_virtblk.block_thread, NULL,
1570 virtio_block, mic); 1571 virtio_block, mic);
1571 if (err) 1572 if (err)
1572 mpsslog("%s virtblk pthread_create failed %s\n", 1573 mpsslog("%s virtblk pthread_create failed %s\n",
1573 mic->name, strerror(err)); 1574 mic->name, strerror(err));
1574 sigemptyset(&act.sa_mask); 1575 sigemptyset(&act.sa_mask);
1575 err = sigaction(SIGUSR1, &act, NULL); 1576 err = sigaction(SIGUSR1, &act, NULL);
1576 if (err) 1577 if (err)
1577 mpsslog("%s sigaction SIGUSR1 failed %s\n", 1578 mpsslog("%s sigaction SIGUSR1 failed %s\n",
1578 mic->name, strerror(errno)); 1579 mic->name, strerror(errno));
1579 while (1) 1580 while (1)
1580 sleep(60); 1581 sleep(60);
1581 case -1: 1582 case -1:
diff --git a/Documentation/mic/mpssd/sysfs.c b/Documentation/mic/mpssd/sysfs.c
index 11de72b63386..8dd326936083 100644
--- a/Documentation/mic/mpssd/sysfs.c
+++ b/Documentation/mic/mpssd/sysfs.c
@@ -35,7 +35,7 @@ readsysfs(char *dir, char *entry)
35 snprintf(filename, PATH_MAX, "%s/%s", MICSYSFSDIR, entry); 35 snprintf(filename, PATH_MAX, "%s/%s", MICSYSFSDIR, entry);
36 else 36 else
37 snprintf(filename, PATH_MAX, 37 snprintf(filename, PATH_MAX,
38 "%s/%s/%s", MICSYSFSDIR, dir, entry); 38 "%s/%s/%s", MICSYSFSDIR, dir, entry);
39 39
40 fd = open(filename, O_RDONLY); 40 fd = open(filename, O_RDONLY);
41 if (fd < 0) { 41 if (fd < 0) {
@@ -75,7 +75,7 @@ setsysfs(char *dir, char *entry, char *value)
75 snprintf(filename, PATH_MAX, "%s/%s", MICSYSFSDIR, entry); 75 snprintf(filename, PATH_MAX, "%s/%s", MICSYSFSDIR, entry);
76 else 76 else
77 snprintf(filename, PATH_MAX, "%s/%s/%s", 77 snprintf(filename, PATH_MAX, "%s/%s/%s",
78 MICSYSFSDIR, dir, entry); 78 MICSYSFSDIR, dir, entry);
79 79
80 oldvalue = readsysfs(dir, entry); 80 oldvalue = readsysfs(dir, entry);
81 81