Lines 2393-2398
Link Here
|
2393 |
/* Try to allocate a netlink socket minimizing the risk of collision, |
2393 |
/* Try to allocate a netlink socket minimizing the risk of collision, |
2394 |
* by starting at the max unit number and counting down */ |
2394 |
* by starting at the max unit number and counting down */ |
2395 |
for (unit=MAX_LINKS-1;unit>MIN_NETLINK_UNIT;unit--) { |
2395 |
for (unit=MAX_LINKS-1;unit>MIN_NETLINK_UNIT;unit--) { |
|
|
2396 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) |
2397 |
nl_sk = netlink_kernel_create( |
2398 |
&init_net, |
2399 |
unit, |
2400 |
THIS_MODULE, |
2401 |
NULL); |
2402 |
#else |
2396 |
nl_sk = netlink_kernel_create( |
2403 |
nl_sk = netlink_kernel_create( |
2397 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) |
2404 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) |
2398 |
&init_net, |
2405 |
&init_net, |
Lines 2404-2409
Link Here
|
2404 |
NULL, |
2411 |
NULL, |
2405 |
#endif |
2412 |
#endif |
2406 |
THIS_MODULE); |
2413 |
THIS_MODULE); |
|
|
2414 |
#endif |
2407 |
if (nl_sk!=NULL) { |
2415 |
if (nl_sk!=NULL) { |
2408 |
netlink_unit = unit; |
2416 |
netlink_unit = unit; |
2409 |
return 0; |
2417 |
return 0; |
Lines 2469-2474
Link Here
|
2469 |
return NULL; |
2477 |
return NULL; |
2470 |
} |
2478 |
} |
2471 |
|
2479 |
|
|
|
2480 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) |
2481 |
nlh = nlmsg_put(skb, target_pid, seq, t, size, flags); |
2482 |
if(!nlh) { |
2483 |
if (skb) { |
2484 |
kfree_skb(skb); |
2485 |
} |
2486 |
return NULL; |
2487 |
} |
2488 |
data = nlmsg_data(nlh); |
2489 |
if (size > 0) { |
2490 |
memcpy(data, payload, size); |
2491 |
} |
2492 |
return skb; |
2493 |
#else |
2472 |
nlh = NLMSG_PUT(skb, target_pid, seq, t, size); |
2494 |
nlh = NLMSG_PUT(skb, target_pid, seq, t, size); |
2473 |
nlh->nlmsg_flags = flags; |
2495 |
nlh->nlmsg_flags = flags; |
2474 |
data = NLMSG_DATA(nlh); |
2496 |
data = NLMSG_DATA(nlh); |
Lines 2482-2487
Link Here
|
2482 |
kfree_skb(skb); |
2504 |
kfree_skb(skb); |
2483 |
} |
2505 |
} |
2484 |
return NULL; |
2506 |
return NULL; |
|
|
2507 |
#endif |
2485 |
} |
2508 |
} |
2486 |
|
2509 |
|
2487 |
int register_for_netlink(struct snd_hdj_chip* chip, |
2510 |
int register_for_netlink(struct snd_hdj_chip* chip, |