diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-04 19:03:53 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-06 15:16:25 -0500 |
commit | 0a40acb24602783fcf6881f915659148aa9807d7 (patch) | |
tree | aad4a42c270c615fdc67f454f974794e8fcd2160 /net/nfc/netlink.c | |
parent | 427a2eb1f568c9c5934a36105232c94553db9b69 (diff) |
NFC: Core code identation fixes
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc/netlink.c')
-rw-r--r-- | net/nfc/netlink.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index fa620d03799e..6404052d6c07 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -52,31 +52,30 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = { | |||
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, | 54 | static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, |
55 | struct netlink_callback *cb, int flags) | 55 | struct netlink_callback *cb, int flags) |
56 | { | 56 | { |
57 | void *hdr; | 57 | void *hdr; |
58 | 58 | ||
59 | hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, | 59 | hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, |
60 | &nfc_genl_family, flags, NFC_CMD_GET_TARGET); | 60 | &nfc_genl_family, flags, NFC_CMD_GET_TARGET); |
61 | if (!hdr) | 61 | if (!hdr) |
62 | return -EMSGSIZE; | 62 | return -EMSGSIZE; |
63 | 63 | ||
64 | genl_dump_check_consistent(cb, hdr, &nfc_genl_family); | 64 | genl_dump_check_consistent(cb, hdr, &nfc_genl_family); |
65 | 65 | ||
66 | NLA_PUT_U32(msg, NFC_ATTR_TARGET_INDEX, target->idx); | 66 | NLA_PUT_U32(msg, NFC_ATTR_TARGET_INDEX, target->idx); |
67 | NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, | 67 | NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, target->supported_protocols); |
68 | target->supported_protocols); | ||
69 | NLA_PUT_U16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res); | 68 | NLA_PUT_U16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res); |
70 | NLA_PUT_U8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res); | 69 | NLA_PUT_U8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res); |
71 | if (target->nfcid1_len > 0) | 70 | if (target->nfcid1_len > 0) |
72 | NLA_PUT(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len, | 71 | NLA_PUT(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len, |
73 | target->nfcid1); | 72 | target->nfcid1); |
74 | if (target->sensb_res_len > 0) | 73 | if (target->sensb_res_len > 0) |
75 | NLA_PUT(msg, NFC_ATTR_TARGET_SENSB_RES, target->sensb_res_len, | 74 | NLA_PUT(msg, NFC_ATTR_TARGET_SENSB_RES, target->sensb_res_len, |
76 | target->sensb_res); | 75 | target->sensb_res); |
77 | if (target->sensf_res_len > 0) | 76 | if (target->sensf_res_len > 0) |
78 | NLA_PUT(msg, NFC_ATTR_TARGET_SENSF_RES, target->sensf_res_len, | 77 | NLA_PUT(msg, NFC_ATTR_TARGET_SENSF_RES, target->sensf_res_len, |
79 | target->sensf_res); | 78 | target->sensf_res); |
80 | 79 | ||
81 | return genlmsg_end(msg, hdr); | 80 | return genlmsg_end(msg, hdr); |
82 | 81 | ||
@@ -92,9 +91,9 @@ static struct nfc_dev *__get_device_from_cb(struct netlink_callback *cb) | |||
92 | u32 idx; | 91 | u32 idx; |
93 | 92 | ||
94 | rc = nlmsg_parse(cb->nlh, GENL_HDRLEN + nfc_genl_family.hdrsize, | 93 | rc = nlmsg_parse(cb->nlh, GENL_HDRLEN + nfc_genl_family.hdrsize, |
95 | nfc_genl_family.attrbuf, | 94 | nfc_genl_family.attrbuf, |
96 | nfc_genl_family.maxattr, | 95 | nfc_genl_family.maxattr, |
97 | nfc_genl_policy); | 96 | nfc_genl_policy); |
98 | if (rc < 0) | 97 | if (rc < 0) |
99 | return ERR_PTR(rc); | 98 | return ERR_PTR(rc); |
100 | 99 | ||
@@ -111,7 +110,7 @@ static struct nfc_dev *__get_device_from_cb(struct netlink_callback *cb) | |||
111 | } | 110 | } |
112 | 111 | ||
113 | static int nfc_genl_dump_targets(struct sk_buff *skb, | 112 | static int nfc_genl_dump_targets(struct sk_buff *skb, |
114 | struct netlink_callback *cb) | 113 | struct netlink_callback *cb) |
115 | { | 114 | { |
116 | int i = cb->args[0]; | 115 | int i = cb->args[0]; |
117 | struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; | 116 | struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; |
@@ -131,7 +130,7 @@ static int nfc_genl_dump_targets(struct sk_buff *skb, | |||
131 | 130 | ||
132 | while (i < dev->n_targets) { | 131 | while (i < dev->n_targets) { |
133 | rc = nfc_genl_send_target(skb, &dev->targets[i], cb, | 132 | rc = nfc_genl_send_target(skb, &dev->targets[i], cb, |
134 | NLM_F_MULTI); | 133 | NLM_F_MULTI); |
135 | if (rc < 0) | 134 | if (rc < 0) |
136 | break; | 135 | break; |
137 | 136 | ||
@@ -167,7 +166,7 @@ int nfc_genl_targets_found(struct nfc_dev *dev) | |||
167 | return -ENOMEM; | 166 | return -ENOMEM; |
168 | 167 | ||
169 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 168 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, |
170 | NFC_EVENT_TARGETS_FOUND); | 169 | NFC_EVENT_TARGETS_FOUND); |
171 | if (!hdr) | 170 | if (!hdr) |
172 | goto free_msg; | 171 | goto free_msg; |
173 | 172 | ||
@@ -194,7 +193,7 @@ int nfc_genl_device_added(struct nfc_dev *dev) | |||
194 | return -ENOMEM; | 193 | return -ENOMEM; |
195 | 194 | ||
196 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 195 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, |
197 | NFC_EVENT_DEVICE_ADDED); | 196 | NFC_EVENT_DEVICE_ADDED); |
198 | if (!hdr) | 197 | if (!hdr) |
199 | goto free_msg; | 198 | goto free_msg; |
200 | 199 | ||
@@ -226,7 +225,7 @@ int nfc_genl_device_removed(struct nfc_dev *dev) | |||
226 | return -ENOMEM; | 225 | return -ENOMEM; |
227 | 226 | ||
228 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 227 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, |
229 | NFC_EVENT_DEVICE_REMOVED); | 228 | NFC_EVENT_DEVICE_REMOVED); |
230 | if (!hdr) | 229 | if (!hdr) |
231 | goto free_msg; | 230 | goto free_msg; |
232 | 231 | ||
@@ -246,14 +245,14 @@ free_msg: | |||
246 | } | 245 | } |
247 | 246 | ||
248 | static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, | 247 | static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, |
249 | u32 pid, u32 seq, | 248 | u32 pid, u32 seq, |
250 | struct netlink_callback *cb, | 249 | struct netlink_callback *cb, |
251 | int flags) | 250 | int flags) |
252 | { | 251 | { |
253 | void *hdr; | 252 | void *hdr; |
254 | 253 | ||
255 | hdr = genlmsg_put(msg, pid, seq, &nfc_genl_family, flags, | 254 | hdr = genlmsg_put(msg, pid, seq, &nfc_genl_family, flags, |
256 | NFC_CMD_GET_DEVICE); | 255 | NFC_CMD_GET_DEVICE); |
257 | if (!hdr) | 256 | if (!hdr) |
258 | return -EMSGSIZE; | 257 | return -EMSGSIZE; |
259 | 258 | ||
@@ -273,7 +272,7 @@ nla_put_failure: | |||
273 | } | 272 | } |
274 | 273 | ||
275 | static int nfc_genl_dump_devices(struct sk_buff *skb, | 274 | static int nfc_genl_dump_devices(struct sk_buff *skb, |
276 | struct netlink_callback *cb) | 275 | struct netlink_callback *cb) |
277 | { | 276 | { |
278 | struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; | 277 | struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0]; |
279 | struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; | 278 | struct nfc_dev *dev = (struct nfc_dev *) cb->args[1]; |
@@ -300,8 +299,7 @@ static int nfc_genl_dump_devices(struct sk_buff *skb, | |||
300 | int rc; | 299 | int rc; |
301 | 300 | ||
302 | rc = nfc_genl_send_device(skb, dev, NETLINK_CB(cb->skb).pid, | 301 | rc = nfc_genl_send_device(skb, dev, NETLINK_CB(cb->skb).pid, |
303 | cb->nlh->nlmsg_seq, | 302 | cb->nlh->nlmsg_seq, cb, NLM_F_MULTI); |
304 | cb, NLM_F_MULTI); | ||
305 | if (rc < 0) | 303 | if (rc < 0) |
306 | break; | 304 | break; |
307 | 305 | ||
@@ -326,7 +324,7 @@ static int nfc_genl_dump_devices_done(struct netlink_callback *cb) | |||
326 | } | 324 | } |
327 | 325 | ||
328 | int nfc_genl_dep_link_up_event(struct nfc_dev *dev, u32 target_idx, | 326 | int nfc_genl_dep_link_up_event(struct nfc_dev *dev, u32 target_idx, |
329 | u8 comm_mode, u8 rf_mode) | 327 | u8 comm_mode, u8 rf_mode) |
330 | { | 328 | { |
331 | struct sk_buff *msg; | 329 | struct sk_buff *msg; |
332 | void *hdr; | 330 | void *hdr; |
@@ -337,8 +335,7 @@ int nfc_genl_dep_link_up_event(struct nfc_dev *dev, u32 target_idx, | |||
337 | if (!msg) | 335 | if (!msg) |
338 | return -ENOMEM; | 336 | return -ENOMEM; |
339 | 337 | ||
340 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 338 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_CMD_DEP_LINK_UP); |
341 | NFC_CMD_DEP_LINK_UP); | ||
342 | if (!hdr) | 339 | if (!hdr) |
343 | goto free_msg; | 340 | goto free_msg; |
344 | 341 | ||
@@ -375,7 +372,7 @@ int nfc_genl_dep_link_down_event(struct nfc_dev *dev) | |||
375 | return -ENOMEM; | 372 | return -ENOMEM; |
376 | 373 | ||
377 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 374 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, |
378 | NFC_CMD_DEP_LINK_DOWN); | 375 | NFC_CMD_DEP_LINK_DOWN); |
379 | if (!hdr) | 376 | if (!hdr) |
380 | goto free_msg; | 377 | goto free_msg; |
381 | 378 | ||
@@ -417,7 +414,7 @@ static int nfc_genl_get_device(struct sk_buff *skb, struct genl_info *info) | |||
417 | } | 414 | } |
418 | 415 | ||
419 | rc = nfc_genl_send_device(msg, dev, info->snd_pid, info->snd_seq, | 416 | rc = nfc_genl_send_device(msg, dev, info->snd_pid, info->snd_seq, |
420 | NULL, 0); | 417 | NULL, 0); |
421 | if (rc < 0) | 418 | if (rc < 0) |
422 | goto out_free; | 419 | goto out_free; |
423 | 420 | ||
@@ -484,7 +481,7 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info) | |||
484 | pr_debug("Poll start\n"); | 481 | pr_debug("Poll start\n"); |
485 | 482 | ||
486 | if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || | 483 | if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || |
487 | !info->attrs[NFC_ATTR_PROTOCOLS]) | 484 | !info->attrs[NFC_ATTR_PROTOCOLS]) |
488 | return -EINVAL; | 485 | return -EINVAL; |
489 | 486 | ||
490 | idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); | 487 | idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); |
@@ -640,7 +637,7 @@ static struct genl_ops nfc_genl_ops[] = { | |||
640 | }; | 637 | }; |
641 | 638 | ||
642 | static int nfc_genl_rcv_nl_event(struct notifier_block *this, | 639 | static int nfc_genl_rcv_nl_event(struct notifier_block *this, |
643 | unsigned long event, void *ptr) | 640 | unsigned long event, void *ptr) |
644 | { | 641 | { |
645 | struct netlink_notify *n = ptr; | 642 | struct netlink_notify *n = ptr; |
646 | struct class_dev_iter iter; | 643 | struct class_dev_iter iter; |
@@ -693,7 +690,7 @@ int __init nfc_genl_init(void) | |||
693 | int rc; | 690 | int rc; |
694 | 691 | ||
695 | rc = genl_register_family_with_ops(&nfc_genl_family, nfc_genl_ops, | 692 | rc = genl_register_family_with_ops(&nfc_genl_family, nfc_genl_ops, |
696 | ARRAY_SIZE(nfc_genl_ops)); | 693 | ARRAY_SIZE(nfc_genl_ops)); |
697 | if (rc) | 694 | if (rc) |
698 | return rc; | 695 | return rc; |
699 | 696 | ||