diff options
author | Hong zhi guo <honkiko@gmail.com> | 2013-03-27 02:53:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-28 14:27:24 -0400 |
commit | e07ebea0ccfaf627464460eb57d7f2fdbcccf8ec (patch) | |
tree | c8f9ba3c8699cafd8d3c490e62f692d4967b9878 /drivers/scsi/scsi_transport_fc.c | |
parent | b96dc464994cb6d839c3b307b20061b440dc3edb (diff) |
scsi: replace obsolete NLMSG_* with type safe nlmsg_*
Signed-off-by: Hong Zhiguo <honkiko@gmail.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index e894ca7b54c0..e106c276aa00 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <scsi/scsi_transport.h> | 35 | #include <scsi/scsi_transport.h> |
36 | #include <scsi/scsi_transport_fc.h> | 36 | #include <scsi/scsi_transport_fc.h> |
37 | #include <scsi/scsi_cmnd.h> | 37 | #include <scsi/scsi_cmnd.h> |
38 | #include <linux/netlink.h> | ||
39 | #include <net/netlink.h> | 38 | #include <net/netlink.h> |
40 | #include <scsi/scsi_netlink_fc.h> | 39 | #include <scsi/scsi_netlink_fc.h> |
41 | #include <scsi/scsi_bsg_fc.h> | 40 | #include <scsi/scsi_bsg_fc.h> |
@@ -534,7 +533,7 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number, | |||
534 | struct nlmsghdr *nlh; | 533 | struct nlmsghdr *nlh; |
535 | struct fc_nl_event *event; | 534 | struct fc_nl_event *event; |
536 | const char *name; | 535 | const char *name; |
537 | u32 len, skblen; | 536 | u32 len; |
538 | int err; | 537 | int err; |
539 | 538 | ||
540 | if (!scsi_nl_sock) { | 539 | if (!scsi_nl_sock) { |
@@ -543,21 +542,19 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number, | |||
543 | } | 542 | } |
544 | 543 | ||
545 | len = FC_NL_MSGALIGN(sizeof(*event)); | 544 | len = FC_NL_MSGALIGN(sizeof(*event)); |
546 | skblen = NLMSG_SPACE(len); | ||
547 | 545 | ||
548 | skb = alloc_skb(skblen, GFP_KERNEL); | 546 | skb = nlmsg_new(len, GFP_KERNEL); |
549 | if (!skb) { | 547 | if (!skb) { |
550 | err = -ENOBUFS; | 548 | err = -ENOBUFS; |
551 | goto send_fail; | 549 | goto send_fail; |
552 | } | 550 | } |
553 | 551 | ||
554 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, | 552 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, len, 0); |
555 | skblen - sizeof(*nlh), 0); | ||
556 | if (!nlh) { | 553 | if (!nlh) { |
557 | err = -ENOBUFS; | 554 | err = -ENOBUFS; |
558 | goto send_fail_skb; | 555 | goto send_fail_skb; |
559 | } | 556 | } |
560 | event = NLMSG_DATA(nlh); | 557 | event = nlmsg_data(nlh); |
561 | 558 | ||
562 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, | 559 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, |
563 | FC_NL_ASYNC_EVENT, len); | 560 | FC_NL_ASYNC_EVENT, len); |
@@ -604,7 +601,7 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, | |||
604 | struct sk_buff *skb; | 601 | struct sk_buff *skb; |
605 | struct nlmsghdr *nlh; | 602 | struct nlmsghdr *nlh; |
606 | struct fc_nl_event *event; | 603 | struct fc_nl_event *event; |
607 | u32 len, skblen; | 604 | u32 len; |
608 | int err; | 605 | int err; |
609 | 606 | ||
610 | if (!scsi_nl_sock) { | 607 | if (!scsi_nl_sock) { |
@@ -613,21 +610,19 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number, | |||
613 | } | 610 | } |
614 | 611 | ||
615 | len = FC_NL_MSGALIGN(sizeof(*event) + data_len); | 612 | len = FC_NL_MSGALIGN(sizeof(*event) + data_len); |
616 | skblen = NLMSG_SPACE(len); | ||
617 | 613 | ||
618 | skb = alloc_skb(skblen, GFP_KERNEL); | 614 | skb = nlmsg_new(len, GFP_KERNEL); |
619 | if (!skb) { | 615 | if (!skb) { |
620 | err = -ENOBUFS; | 616 | err = -ENOBUFS; |
621 | goto send_vendor_fail; | 617 | goto send_vendor_fail; |
622 | } | 618 | } |
623 | 619 | ||
624 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, | 620 | nlh = nlmsg_put(skb, 0, 0, SCSI_TRANSPORT_MSG, len, 0); |
625 | skblen - sizeof(*nlh), 0); | ||
626 | if (!nlh) { | 621 | if (!nlh) { |
627 | err = -ENOBUFS; | 622 | err = -ENOBUFS; |
628 | goto send_vendor_fail_skb; | 623 | goto send_vendor_fail_skb; |
629 | } | 624 | } |
630 | event = NLMSG_DATA(nlh); | 625 | event = nlmsg_data(nlh); |
631 | 626 | ||
632 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, | 627 | INIT_SCSI_NL_HDR(&event->snlh, SCSI_NL_TRANSPORT_FC, |
633 | FC_NL_ASYNC_EVENT, len); | 628 | FC_NL_ASYNC_EVENT, len); |