diff options
Diffstat (limited to 'drivers')
107 files changed, 1289 insertions, 974 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 779e4e500df4..d060e6fd7fd5 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -300,9 +300,9 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state) | |||
300 | static struct platform_suspend_ops acpi_suspend_ops = { | 300 | static struct platform_suspend_ops acpi_suspend_ops = { |
301 | .valid = acpi_suspend_state_valid, | 301 | .valid = acpi_suspend_state_valid, |
302 | .begin = acpi_suspend_begin, | 302 | .begin = acpi_suspend_begin, |
303 | .prepare = acpi_pm_prepare, | 303 | .prepare_late = acpi_pm_prepare, |
304 | .enter = acpi_suspend_enter, | 304 | .enter = acpi_suspend_enter, |
305 | .finish = acpi_pm_finish, | 305 | .wake = acpi_pm_finish, |
306 | .end = acpi_pm_end, | 306 | .end = acpi_pm_end, |
307 | }; | 307 | }; |
308 | 308 | ||
@@ -328,9 +328,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state) | |||
328 | static struct platform_suspend_ops acpi_suspend_ops_old = { | 328 | static struct platform_suspend_ops acpi_suspend_ops_old = { |
329 | .valid = acpi_suspend_state_valid, | 329 | .valid = acpi_suspend_state_valid, |
330 | .begin = acpi_suspend_begin_old, | 330 | .begin = acpi_suspend_begin_old, |
331 | .prepare = acpi_pm_disable_gpes, | 331 | .prepare_late = acpi_pm_disable_gpes, |
332 | .enter = acpi_suspend_enter, | 332 | .enter = acpi_suspend_enter, |
333 | .finish = acpi_pm_finish, | 333 | .wake = acpi_pm_finish, |
334 | .end = acpi_pm_end, | 334 | .end = acpi_pm_end, |
335 | .recover = acpi_pm_finish, | 335 | .recover = acpi_pm_finish, |
336 | }; | 336 | }; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index d230ff4b3eec..4aa527b8a913 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -891,7 +891,8 @@ int device_add(struct device *dev) | |||
891 | set_dev_node(dev, dev_to_node(parent)); | 891 | set_dev_node(dev, dev_to_node(parent)); |
892 | 892 | ||
893 | /* first, register with generic layer. */ | 893 | /* first, register with generic layer. */ |
894 | error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev)); | 894 | /* we require the name to be set before, and pass NULL */ |
895 | error = kobject_add(&dev->kobj, dev->kobj.parent, NULL); | ||
895 | if (error) | 896 | if (error) |
896 | goto Error; | 897 | goto Error; |
897 | 898 | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index f17c3266a0e0..742cbe6b042b 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -179,6 +179,7 @@ void wait_for_device_probe(void) | |||
179 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); | 179 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
180 | async_synchronize_full(); | 180 | async_synchronize_full(); |
181 | } | 181 | } |
182 | EXPORT_SYMBOL_GPL(wait_for_device_probe); | ||
182 | 183 | ||
183 | /** | 184 | /** |
184 | * driver_probe_device - attempt to bind device & driver together | 185 | * driver_probe_device - attempt to bind device & driver together |
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 9744d59a69f2..858c34dd032d 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -906,6 +906,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, | |||
906 | goto failed_alloc; | 906 | goto failed_alloc; |
907 | 907 | ||
908 | blk_queue_make_request(card->queue, mm_make_request); | 908 | blk_queue_make_request(card->queue, mm_make_request); |
909 | card->queue->queue_lock = &card->lock; | ||
909 | card->queue->queuedata = card; | 910 | card->queue->queuedata = card; |
910 | card->queue->unplug_fn = mm_unplug_device; | 911 | card->queue->unplug_fn = mm_unplug_device; |
911 | 912 | ||
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 10d6cbd7c05e..2224b762b7fb 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -1226,7 +1226,7 @@ int agp_generic_alloc_pages(struct agp_bridge_data *bridge, struct agp_memory *m | |||
1226 | int i, ret = -ENOMEM; | 1226 | int i, ret = -ENOMEM; |
1227 | 1227 | ||
1228 | for (i = 0; i < num_pages; i++) { | 1228 | for (i = 0; i < num_pages; i++) { |
1229 | page = alloc_page(GFP_KERNEL | GFP_DMA32); | 1229 | page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); |
1230 | /* agp_free_memory() needs gart address */ | 1230 | /* agp_free_memory() needs gart address */ |
1231 | if (page == NULL) | 1231 | if (page == NULL) |
1232 | goto out; | 1232 | goto out; |
@@ -1257,7 +1257,7 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge) | |||
1257 | { | 1257 | { |
1258 | struct page * page; | 1258 | struct page * page; |
1259 | 1259 | ||
1260 | page = alloc_page(GFP_KERNEL | GFP_DMA32); | 1260 | page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); |
1261 | if (page == NULL) | 1261 | if (page == NULL) |
1262 | return NULL; | 1262 | return NULL; |
1263 | 1263 | ||
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 50dfa3bc71ce..340ba4f9dc54 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -72,7 +72,7 @@ static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ; | |||
72 | #ifdef CONFIG_IA64 | 72 | #ifdef CONFIG_IA64 |
73 | static void __iomem *hpet_mctr; | 73 | static void __iomem *hpet_mctr; |
74 | 74 | ||
75 | static cycle_t read_hpet(void) | 75 | static cycle_t read_hpet(struct clocksource *cs) |
76 | { | 76 | { |
77 | return (cycle_t)read_counter((void __iomem *)hpet_mctr); | 77 | return (cycle_t)read_counter((void __iomem *)hpet_mctr); |
78 | } | 78 | } |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index e93fc8d22fb2..aa83a0865ec1 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -285,6 +285,11 @@ enum ipmi_stat_indexes { | |||
285 | /* Events that were received with the proper format. */ | 285 | /* Events that were received with the proper format. */ |
286 | IPMI_STAT_events, | 286 | IPMI_STAT_events, |
287 | 287 | ||
288 | /* Retransmissions on IPMB that failed. */ | ||
289 | IPMI_STAT_dropped_rexmit_ipmb_commands, | ||
290 | |||
291 | /* Retransmissions on LAN that failed. */ | ||
292 | IPMI_STAT_dropped_rexmit_lan_commands, | ||
288 | 293 | ||
289 | /* This *must* remain last, add new values above this. */ | 294 | /* This *must* remain last, add new values above this. */ |
290 | IPMI_NUM_STATS | 295 | IPMI_NUM_STATS |
@@ -445,6 +450,20 @@ static DEFINE_MUTEX(smi_watchers_mutex); | |||
445 | #define ipmi_get_stat(intf, stat) \ | 450 | #define ipmi_get_stat(intf, stat) \ |
446 | ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat])) | 451 | ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat])) |
447 | 452 | ||
453 | static int is_lan_addr(struct ipmi_addr *addr) | ||
454 | { | ||
455 | return addr->addr_type == IPMI_LAN_ADDR_TYPE; | ||
456 | } | ||
457 | |||
458 | static int is_ipmb_addr(struct ipmi_addr *addr) | ||
459 | { | ||
460 | return addr->addr_type == IPMI_IPMB_ADDR_TYPE; | ||
461 | } | ||
462 | |||
463 | static int is_ipmb_bcast_addr(struct ipmi_addr *addr) | ||
464 | { | ||
465 | return addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE; | ||
466 | } | ||
448 | 467 | ||
449 | static void free_recv_msg_list(struct list_head *q) | 468 | static void free_recv_msg_list(struct list_head *q) |
450 | { | 469 | { |
@@ -601,8 +620,7 @@ ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2) | |||
601 | return (smi_addr1->lun == smi_addr2->lun); | 620 | return (smi_addr1->lun == smi_addr2->lun); |
602 | } | 621 | } |
603 | 622 | ||
604 | if ((addr1->addr_type == IPMI_IPMB_ADDR_TYPE) | 623 | if (is_ipmb_addr(addr1) || is_ipmb_bcast_addr(addr1)) { |
605 | || (addr1->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { | ||
606 | struct ipmi_ipmb_addr *ipmb_addr1 | 624 | struct ipmi_ipmb_addr *ipmb_addr1 |
607 | = (struct ipmi_ipmb_addr *) addr1; | 625 | = (struct ipmi_ipmb_addr *) addr1; |
608 | struct ipmi_ipmb_addr *ipmb_addr2 | 626 | struct ipmi_ipmb_addr *ipmb_addr2 |
@@ -612,7 +630,7 @@ ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2) | |||
612 | && (ipmb_addr1->lun == ipmb_addr2->lun)); | 630 | && (ipmb_addr1->lun == ipmb_addr2->lun)); |
613 | } | 631 | } |
614 | 632 | ||
615 | if (addr1->addr_type == IPMI_LAN_ADDR_TYPE) { | 633 | if (is_lan_addr(addr1)) { |
616 | struct ipmi_lan_addr *lan_addr1 | 634 | struct ipmi_lan_addr *lan_addr1 |
617 | = (struct ipmi_lan_addr *) addr1; | 635 | = (struct ipmi_lan_addr *) addr1; |
618 | struct ipmi_lan_addr *lan_addr2 | 636 | struct ipmi_lan_addr *lan_addr2 |
@@ -644,14 +662,13 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len) | |||
644 | || (addr->channel < 0)) | 662 | || (addr->channel < 0)) |
645 | return -EINVAL; | 663 | return -EINVAL; |
646 | 664 | ||
647 | if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE) | 665 | if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) { |
648 | || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { | ||
649 | if (len < sizeof(struct ipmi_ipmb_addr)) | 666 | if (len < sizeof(struct ipmi_ipmb_addr)) |
650 | return -EINVAL; | 667 | return -EINVAL; |
651 | return 0; | 668 | return 0; |
652 | } | 669 | } |
653 | 670 | ||
654 | if (addr->addr_type == IPMI_LAN_ADDR_TYPE) { | 671 | if (is_lan_addr(addr)) { |
655 | if (len < sizeof(struct ipmi_lan_addr)) | 672 | if (len < sizeof(struct ipmi_lan_addr)) |
656 | return -EINVAL; | 673 | return -EINVAL; |
657 | return 0; | 674 | return 0; |
@@ -1503,8 +1520,7 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1503 | memcpy(&(smi_msg->data[2]), msg->data, msg->data_len); | 1520 | memcpy(&(smi_msg->data[2]), msg->data, msg->data_len); |
1504 | smi_msg->data_size = msg->data_len + 2; | 1521 | smi_msg->data_size = msg->data_len + 2; |
1505 | ipmi_inc_stat(intf, sent_local_commands); | 1522 | ipmi_inc_stat(intf, sent_local_commands); |
1506 | } else if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE) | 1523 | } else if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) { |
1507 | || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { | ||
1508 | struct ipmi_ipmb_addr *ipmb_addr; | 1524 | struct ipmi_ipmb_addr *ipmb_addr; |
1509 | unsigned char ipmb_seq; | 1525 | unsigned char ipmb_seq; |
1510 | long seqid; | 1526 | long seqid; |
@@ -1583,8 +1599,6 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1583 | 1599 | ||
1584 | spin_lock_irqsave(&(intf->seq_lock), flags); | 1600 | spin_lock_irqsave(&(intf->seq_lock), flags); |
1585 | 1601 | ||
1586 | ipmi_inc_stat(intf, sent_ipmb_commands); | ||
1587 | |||
1588 | /* | 1602 | /* |
1589 | * Create a sequence number with a 1 second | 1603 | * Create a sequence number with a 1 second |
1590 | * timeout and 4 retries. | 1604 | * timeout and 4 retries. |
@@ -1606,6 +1620,8 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1606 | goto out_err; | 1620 | goto out_err; |
1607 | } | 1621 | } |
1608 | 1622 | ||
1623 | ipmi_inc_stat(intf, sent_ipmb_commands); | ||
1624 | |||
1609 | /* | 1625 | /* |
1610 | * Store the sequence number in the message, | 1626 | * Store the sequence number in the message, |
1611 | * so that when the send message response | 1627 | * so that when the send message response |
@@ -1635,7 +1651,7 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1635 | */ | 1651 | */ |
1636 | spin_unlock_irqrestore(&(intf->seq_lock), flags); | 1652 | spin_unlock_irqrestore(&(intf->seq_lock), flags); |
1637 | } | 1653 | } |
1638 | } else if (addr->addr_type == IPMI_LAN_ADDR_TYPE) { | 1654 | } else if (is_lan_addr(addr)) { |
1639 | struct ipmi_lan_addr *lan_addr; | 1655 | struct ipmi_lan_addr *lan_addr; |
1640 | unsigned char ipmb_seq; | 1656 | unsigned char ipmb_seq; |
1641 | long seqid; | 1657 | long seqid; |
@@ -1696,8 +1712,6 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1696 | 1712 | ||
1697 | spin_lock_irqsave(&(intf->seq_lock), flags); | 1713 | spin_lock_irqsave(&(intf->seq_lock), flags); |
1698 | 1714 | ||
1699 | ipmi_inc_stat(intf, sent_lan_commands); | ||
1700 | |||
1701 | /* | 1715 | /* |
1702 | * Create a sequence number with a 1 second | 1716 | * Create a sequence number with a 1 second |
1703 | * timeout and 4 retries. | 1717 | * timeout and 4 retries. |
@@ -1719,6 +1733,8 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1719 | goto out_err; | 1733 | goto out_err; |
1720 | } | 1734 | } |
1721 | 1735 | ||
1736 | ipmi_inc_stat(intf, sent_lan_commands); | ||
1737 | |||
1722 | /* | 1738 | /* |
1723 | * Store the sequence number in the message, | 1739 | * Store the sequence number in the message, |
1724 | * so that when the send message response | 1740 | * so that when the send message response |
@@ -1937,6 +1953,10 @@ static int stat_file_read_proc(char *page, char **start, off_t off, | |||
1937 | ipmi_get_stat(intf, invalid_events)); | 1953 | ipmi_get_stat(intf, invalid_events)); |
1938 | out += sprintf(out, "events: %u\n", | 1954 | out += sprintf(out, "events: %u\n", |
1939 | ipmi_get_stat(intf, events)); | 1955 | ipmi_get_stat(intf, events)); |
1956 | out += sprintf(out, "failed rexmit LAN msgs: %u\n", | ||
1957 | ipmi_get_stat(intf, dropped_rexmit_lan_commands)); | ||
1958 | out += sprintf(out, "failed rexmit IPMB msgs: %u\n", | ||
1959 | ipmi_get_stat(intf, dropped_rexmit_ipmb_commands)); | ||
1940 | 1960 | ||
1941 | return (out - ((char *) page)); | 1961 | return (out - ((char *) page)); |
1942 | } | 1962 | } |
@@ -3264,6 +3284,114 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf, | |||
3264 | return rv; | 3284 | return rv; |
3265 | } | 3285 | } |
3266 | 3286 | ||
3287 | /* | ||
3288 | * This routine will handle "Get Message" command responses with | ||
3289 | * channels that use an OEM Medium. The message format belongs to | ||
3290 | * the OEM. See IPMI 2.0 specification, Chapter 6 and | ||
3291 | * Chapter 22, sections 22.6 and 22.24 for more details. | ||
3292 | */ | ||
3293 | static int handle_oem_get_msg_cmd(ipmi_smi_t intf, | ||
3294 | struct ipmi_smi_msg *msg) | ||
3295 | { | ||
3296 | struct cmd_rcvr *rcvr; | ||
3297 | int rv = 0; | ||
3298 | unsigned char netfn; | ||
3299 | unsigned char cmd; | ||
3300 | unsigned char chan; | ||
3301 | ipmi_user_t user = NULL; | ||
3302 | struct ipmi_system_interface_addr *smi_addr; | ||
3303 | struct ipmi_recv_msg *recv_msg; | ||
3304 | |||
3305 | /* | ||
3306 | * We expect the OEM SW to perform error checking | ||
3307 | * so we just do some basic sanity checks | ||
3308 | */ | ||
3309 | if (msg->rsp_size < 4) { | ||
3310 | /* Message not big enough, just ignore it. */ | ||
3311 | ipmi_inc_stat(intf, invalid_commands); | ||
3312 | return 0; | ||
3313 | } | ||
3314 | |||
3315 | if (msg->rsp[2] != 0) { | ||
3316 | /* An error getting the response, just ignore it. */ | ||
3317 | return 0; | ||
3318 | } | ||
3319 | |||
3320 | /* | ||
3321 | * This is an OEM Message so the OEM needs to know how | ||
3322 | * handle the message. We do no interpretation. | ||
3323 | */ | ||
3324 | netfn = msg->rsp[0] >> 2; | ||
3325 | cmd = msg->rsp[1]; | ||
3326 | chan = msg->rsp[3] & 0xf; | ||
3327 | |||
3328 | rcu_read_lock(); | ||
3329 | rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); | ||
3330 | if (rcvr) { | ||
3331 | user = rcvr->user; | ||
3332 | kref_get(&user->refcount); | ||
3333 | } else | ||
3334 | user = NULL; | ||
3335 | rcu_read_unlock(); | ||
3336 | |||
3337 | if (user == NULL) { | ||
3338 | /* We didn't find a user, just give up. */ | ||
3339 | ipmi_inc_stat(intf, unhandled_commands); | ||
3340 | |||
3341 | /* | ||
3342 | * Don't do anything with these messages, just allow | ||
3343 | * them to be freed. | ||
3344 | */ | ||
3345 | |||
3346 | rv = 0; | ||
3347 | } else { | ||
3348 | /* Deliver the message to the user. */ | ||
3349 | ipmi_inc_stat(intf, handled_commands); | ||
3350 | |||
3351 | recv_msg = ipmi_alloc_recv_msg(); | ||
3352 | if (!recv_msg) { | ||
3353 | /* | ||
3354 | * We couldn't allocate memory for the | ||
3355 | * message, so requeue it for handling | ||
3356 | * later. | ||
3357 | */ | ||
3358 | rv = 1; | ||
3359 | kref_put(&user->refcount, free_user); | ||
3360 | } else { | ||
3361 | /* | ||
3362 | * OEM Messages are expected to be delivered via | ||
3363 | * the system interface to SMS software. We might | ||
3364 | * need to visit this again depending on OEM | ||
3365 | * requirements | ||
3366 | */ | ||
3367 | smi_addr = ((struct ipmi_system_interface_addr *) | ||
3368 | &(recv_msg->addr)); | ||
3369 | smi_addr->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; | ||
3370 | smi_addr->channel = IPMI_BMC_CHANNEL; | ||
3371 | smi_addr->lun = msg->rsp[0] & 3; | ||
3372 | |||
3373 | recv_msg->user = user; | ||
3374 | recv_msg->user_msg_data = NULL; | ||
3375 | recv_msg->recv_type = IPMI_OEM_RECV_TYPE; | ||
3376 | recv_msg->msg.netfn = msg->rsp[0] >> 2; | ||
3377 | recv_msg->msg.cmd = msg->rsp[1]; | ||
3378 | recv_msg->msg.data = recv_msg->msg_data; | ||
3379 | |||
3380 | /* | ||
3381 | * The message starts at byte 4 which follows the | ||
3382 | * the Channel Byte in the "GET MESSAGE" command | ||
3383 | */ | ||
3384 | recv_msg->msg.data_len = msg->rsp_size - 4; | ||
3385 | memcpy(recv_msg->msg_data, | ||
3386 | &(msg->rsp[4]), | ||
3387 | msg->rsp_size - 4); | ||
3388 | deliver_response(recv_msg); | ||
3389 | } | ||
3390 | } | ||
3391 | |||
3392 | return rv; | ||
3393 | } | ||
3394 | |||
3267 | static void copy_event_into_recv_msg(struct ipmi_recv_msg *recv_msg, | 3395 | static void copy_event_into_recv_msg(struct ipmi_recv_msg *recv_msg, |
3268 | struct ipmi_smi_msg *msg) | 3396 | struct ipmi_smi_msg *msg) |
3269 | { | 3397 | { |
@@ -3519,6 +3647,17 @@ static int handle_new_recv_msg(ipmi_smi_t intf, | |||
3519 | goto out; | 3647 | goto out; |
3520 | } | 3648 | } |
3521 | 3649 | ||
3650 | /* | ||
3651 | ** We need to make sure the channels have been initialized. | ||
3652 | ** The channel_handler routine will set the "curr_channel" | ||
3653 | ** equal to or greater than IPMI_MAX_CHANNELS when all the | ||
3654 | ** channels for this interface have been initialized. | ||
3655 | */ | ||
3656 | if (intf->curr_channel < IPMI_MAX_CHANNELS) { | ||
3657 | requeue = 1; /* Just put the message back for now */ | ||
3658 | goto out; | ||
3659 | } | ||
3660 | |||
3522 | switch (intf->channels[chan].medium) { | 3661 | switch (intf->channels[chan].medium) { |
3523 | case IPMI_CHANNEL_MEDIUM_IPMB: | 3662 | case IPMI_CHANNEL_MEDIUM_IPMB: |
3524 | if (msg->rsp[4] & 0x04) { | 3663 | if (msg->rsp[4] & 0x04) { |
@@ -3554,11 +3693,20 @@ static int handle_new_recv_msg(ipmi_smi_t intf, | |||
3554 | break; | 3693 | break; |
3555 | 3694 | ||
3556 | default: | 3695 | default: |
3557 | /* | 3696 | /* Check for OEM Channels. Clients had better |
3558 | * We don't handle the channel type, so just | 3697 | register for these commands. */ |
3559 | * free the message. | 3698 | if ((intf->channels[chan].medium |
3560 | */ | 3699 | >= IPMI_CHANNEL_MEDIUM_OEM_MIN) |
3561 | requeue = 0; | 3700 | && (intf->channels[chan].medium |
3701 | <= IPMI_CHANNEL_MEDIUM_OEM_MAX)) { | ||
3702 | requeue = handle_oem_get_msg_cmd(intf, msg); | ||
3703 | } else { | ||
3704 | /* | ||
3705 | * We don't handle the channel type, so just | ||
3706 | * free the message. | ||
3707 | */ | ||
3708 | requeue = 0; | ||
3709 | } | ||
3562 | } | 3710 | } |
3563 | 3711 | ||
3564 | } else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2)) | 3712 | } else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2)) |
@@ -3730,7 +3878,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3730 | list_add_tail(&msg->link, timeouts); | 3878 | list_add_tail(&msg->link, timeouts); |
3731 | if (ent->broadcast) | 3879 | if (ent->broadcast) |
3732 | ipmi_inc_stat(intf, timed_out_ipmb_broadcasts); | 3880 | ipmi_inc_stat(intf, timed_out_ipmb_broadcasts); |
3733 | else if (ent->recv_msg->addr.addr_type == IPMI_LAN_ADDR_TYPE) | 3881 | else if (is_lan_addr(&ent->recv_msg->addr)) |
3734 | ipmi_inc_stat(intf, timed_out_lan_commands); | 3882 | ipmi_inc_stat(intf, timed_out_lan_commands); |
3735 | else | 3883 | else |
3736 | ipmi_inc_stat(intf, timed_out_ipmb_commands); | 3884 | ipmi_inc_stat(intf, timed_out_ipmb_commands); |
@@ -3744,15 +3892,17 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3744 | */ | 3892 | */ |
3745 | ent->timeout = MAX_MSG_TIMEOUT; | 3893 | ent->timeout = MAX_MSG_TIMEOUT; |
3746 | ent->retries_left--; | 3894 | ent->retries_left--; |
3747 | if (ent->recv_msg->addr.addr_type == IPMI_LAN_ADDR_TYPE) | ||
3748 | ipmi_inc_stat(intf, retransmitted_lan_commands); | ||
3749 | else | ||
3750 | ipmi_inc_stat(intf, retransmitted_ipmb_commands); | ||
3751 | |||
3752 | smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, | 3895 | smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, |
3753 | ent->seqid); | 3896 | ent->seqid); |
3754 | if (!smi_msg) | 3897 | if (!smi_msg) { |
3898 | if (is_lan_addr(&ent->recv_msg->addr)) | ||
3899 | ipmi_inc_stat(intf, | ||
3900 | dropped_rexmit_lan_commands); | ||
3901 | else | ||
3902 | ipmi_inc_stat(intf, | ||
3903 | dropped_rexmit_ipmb_commands); | ||
3755 | return; | 3904 | return; |
3905 | } | ||
3756 | 3906 | ||
3757 | spin_unlock_irqrestore(&intf->seq_lock, *flags); | 3907 | spin_unlock_irqrestore(&intf->seq_lock, *flags); |
3758 | 3908 | ||
@@ -3764,10 +3914,17 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, | |||
3764 | * resent. | 3914 | * resent. |
3765 | */ | 3915 | */ |
3766 | handlers = intf->handlers; | 3916 | handlers = intf->handlers; |
3767 | if (handlers) | 3917 | if (handlers) { |
3918 | if (is_lan_addr(&ent->recv_msg->addr)) | ||
3919 | ipmi_inc_stat(intf, | ||
3920 | retransmitted_lan_commands); | ||
3921 | else | ||
3922 | ipmi_inc_stat(intf, | ||
3923 | retransmitted_ipmb_commands); | ||
3924 | |||
3768 | intf->handlers->sender(intf->send_info, | 3925 | intf->handlers->sender(intf->send_info, |
3769 | smi_msg, 0); | 3926 | smi_msg, 0); |
3770 | else | 3927 | } else |
3771 | ipmi_free_smi_msg(smi_msg); | 3928 | ipmi_free_smi_msg(smi_msg); |
3772 | 3929 | ||
3773 | spin_lock_irqsave(&intf->seq_lock, *flags); | 3930 | spin_lock_irqsave(&intf->seq_lock, *flags); |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index e58ea4cd55ce..259644646b82 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -82,12 +82,6 @@ | |||
82 | #define SI_SHORT_TIMEOUT_USEC 250 /* .25ms when the SM request a | 82 | #define SI_SHORT_TIMEOUT_USEC 250 /* .25ms when the SM request a |
83 | short timeout */ | 83 | short timeout */ |
84 | 84 | ||
85 | /* Bit for BMC global enables. */ | ||
86 | #define IPMI_BMC_RCV_MSG_INTR 0x01 | ||
87 | #define IPMI_BMC_EVT_MSG_INTR 0x02 | ||
88 | #define IPMI_BMC_EVT_MSG_BUFF 0x04 | ||
89 | #define IPMI_BMC_SYS_LOG 0x08 | ||
90 | |||
91 | enum si_intf_state { | 85 | enum si_intf_state { |
92 | SI_NORMAL, | 86 | SI_NORMAL, |
93 | SI_GETTING_FLAGS, | 87 | SI_GETTING_FLAGS, |
@@ -220,6 +214,9 @@ struct smi_info { | |||
220 | OEM2_DATA_AVAIL) | 214 | OEM2_DATA_AVAIL) |
221 | unsigned char msg_flags; | 215 | unsigned char msg_flags; |
222 | 216 | ||
217 | /* Does the BMC have an event buffer? */ | ||
218 | char has_event_buffer; | ||
219 | |||
223 | /* | 220 | /* |
224 | * If set to true, this will request events the next time the | 221 | * If set to true, this will request events the next time the |
225 | * state machine is idle. | 222 | * state machine is idle. |
@@ -968,7 +965,8 @@ static void request_events(void *send_info) | |||
968 | { | 965 | { |
969 | struct smi_info *smi_info = send_info; | 966 | struct smi_info *smi_info = send_info; |
970 | 967 | ||
971 | if (atomic_read(&smi_info->stop_operation)) | 968 | if (atomic_read(&smi_info->stop_operation) || |
969 | !smi_info->has_event_buffer) | ||
972 | return; | 970 | return; |
973 | 971 | ||
974 | atomic_set(&smi_info->req_events, 1); | 972 | atomic_set(&smi_info->req_events, 1); |
@@ -2407,26 +2405,9 @@ static struct of_platform_driver ipmi_of_platform_driver = { | |||
2407 | }; | 2405 | }; |
2408 | #endif /* CONFIG_PPC_OF */ | 2406 | #endif /* CONFIG_PPC_OF */ |
2409 | 2407 | ||
2410 | 2408 | static int wait_for_msg_done(struct smi_info *smi_info) | |
2411 | static int try_get_dev_id(struct smi_info *smi_info) | ||
2412 | { | 2409 | { |
2413 | unsigned char msg[2]; | ||
2414 | unsigned char *resp; | ||
2415 | unsigned long resp_len; | ||
2416 | enum si_sm_result smi_result; | 2410 | enum si_sm_result smi_result; |
2417 | int rv = 0; | ||
2418 | |||
2419 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); | ||
2420 | if (!resp) | ||
2421 | return -ENOMEM; | ||
2422 | |||
2423 | /* | ||
2424 | * Do a Get Device ID command, since it comes back with some | ||
2425 | * useful info. | ||
2426 | */ | ||
2427 | msg[0] = IPMI_NETFN_APP_REQUEST << 2; | ||
2428 | msg[1] = IPMI_GET_DEVICE_ID_CMD; | ||
2429 | smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); | ||
2430 | 2411 | ||
2431 | smi_result = smi_info->handlers->event(smi_info->si_sm, 0); | 2412 | smi_result = smi_info->handlers->event(smi_info->si_sm, 0); |
2432 | for (;;) { | 2413 | for (;;) { |
@@ -2441,16 +2422,39 @@ static int try_get_dev_id(struct smi_info *smi_info) | |||
2441 | } else | 2422 | } else |
2442 | break; | 2423 | break; |
2443 | } | 2424 | } |
2444 | if (smi_result == SI_SM_HOSED) { | 2425 | if (smi_result == SI_SM_HOSED) |
2445 | /* | 2426 | /* |
2446 | * We couldn't get the state machine to run, so whatever's at | 2427 | * We couldn't get the state machine to run, so whatever's at |
2447 | * the port is probably not an IPMI SMI interface. | 2428 | * the port is probably not an IPMI SMI interface. |
2448 | */ | 2429 | */ |
2449 | rv = -ENODEV; | 2430 | return -ENODEV; |
2431 | |||
2432 | return 0; | ||
2433 | } | ||
2434 | |||
2435 | static int try_get_dev_id(struct smi_info *smi_info) | ||
2436 | { | ||
2437 | unsigned char msg[2]; | ||
2438 | unsigned char *resp; | ||
2439 | unsigned long resp_len; | ||
2440 | int rv = 0; | ||
2441 | |||
2442 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); | ||
2443 | if (!resp) | ||
2444 | return -ENOMEM; | ||
2445 | |||
2446 | /* | ||
2447 | * Do a Get Device ID command, since it comes back with some | ||
2448 | * useful info. | ||
2449 | */ | ||
2450 | msg[0] = IPMI_NETFN_APP_REQUEST << 2; | ||
2451 | msg[1] = IPMI_GET_DEVICE_ID_CMD; | ||
2452 | smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); | ||
2453 | |||
2454 | rv = wait_for_msg_done(smi_info); | ||
2455 | if (rv) | ||
2450 | goto out; | 2456 | goto out; |
2451 | } | ||
2452 | 2457 | ||
2453 | /* Otherwise, we got some data. */ | ||
2454 | resp_len = smi_info->handlers->get_result(smi_info->si_sm, | 2458 | resp_len = smi_info->handlers->get_result(smi_info->si_sm, |
2455 | resp, IPMI_MAX_MSG_LENGTH); | 2459 | resp, IPMI_MAX_MSG_LENGTH); |
2456 | 2460 | ||
@@ -2462,6 +2466,88 @@ static int try_get_dev_id(struct smi_info *smi_info) | |||
2462 | return rv; | 2466 | return rv; |
2463 | } | 2467 | } |
2464 | 2468 | ||
2469 | static int try_enable_event_buffer(struct smi_info *smi_info) | ||
2470 | { | ||
2471 | unsigned char msg[3]; | ||
2472 | unsigned char *resp; | ||
2473 | unsigned long resp_len; | ||
2474 | int rv = 0; | ||
2475 | |||
2476 | resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); | ||
2477 | if (!resp) | ||
2478 | return -ENOMEM; | ||
2479 | |||
2480 | msg[0] = IPMI_NETFN_APP_REQUEST << 2; | ||
2481 | msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD; | ||
2482 | smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); | ||
2483 | |||
2484 | rv = wait_for_msg_done(smi_info); | ||
2485 | if (rv) { | ||
2486 | printk(KERN_WARNING | ||
2487 | "ipmi_si: Error getting response from get global," | ||
2488 | " enables command, the event buffer is not" | ||
2489 | " enabled.\n"); | ||
2490 | goto out; | ||
2491 | } | ||
2492 | |||
2493 | resp_len = smi_info->handlers->get_result(smi_info->si_sm, | ||
2494 | resp, IPMI_MAX_MSG_LENGTH); | ||
2495 | |||
2496 | if (resp_len < 4 || | ||
2497 | resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || | ||
2498 | resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD || | ||
2499 | resp[2] != 0) { | ||
2500 | printk(KERN_WARNING | ||
2501 | "ipmi_si: Invalid return from get global" | ||
2502 | " enables command, cannot enable the event" | ||
2503 | " buffer.\n"); | ||
2504 | rv = -EINVAL; | ||
2505 | goto out; | ||
2506 | } | ||
2507 | |||
2508 | if (resp[3] & IPMI_BMC_EVT_MSG_BUFF) | ||
2509 | /* buffer is already enabled, nothing to do. */ | ||
2510 | goto out; | ||
2511 | |||
2512 | msg[0] = IPMI_NETFN_APP_REQUEST << 2; | ||
2513 | msg[1] = IPMI_SET_BMC_GLOBAL_ENABLES_CMD; | ||
2514 | msg[2] = resp[3] | IPMI_BMC_EVT_MSG_BUFF; | ||
2515 | smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); | ||
2516 | |||
2517 | rv = wait_for_msg_done(smi_info); | ||
2518 | if (rv) { | ||
2519 | printk(KERN_WARNING | ||
2520 | "ipmi_si: Error getting response from set global," | ||
2521 | " enables command, the event buffer is not" | ||
2522 | " enabled.\n"); | ||
2523 | goto out; | ||
2524 | } | ||
2525 | |||
2526 | resp_len = smi_info->handlers->get_result(smi_info->si_sm, | ||
2527 | resp, IPMI_MAX_MSG_LENGTH); | ||
2528 | |||
2529 | if (resp_len < 3 || | ||
2530 | resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || | ||
2531 | resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { | ||
2532 | printk(KERN_WARNING | ||
2533 | "ipmi_si: Invalid return from get global," | ||
2534 | "enables command, not enable the event" | ||
2535 | " buffer.\n"); | ||
2536 | rv = -EINVAL; | ||
2537 | goto out; | ||
2538 | } | ||
2539 | |||
2540 | if (resp[2] != 0) | ||
2541 | /* | ||
2542 | * An error when setting the event buffer bit means | ||
2543 | * that the event buffer is not supported. | ||
2544 | */ | ||
2545 | rv = -ENOENT; | ||
2546 | out: | ||
2547 | kfree(resp); | ||
2548 | return rv; | ||
2549 | } | ||
2550 | |||
2465 | static int type_file_read_proc(char *page, char **start, off_t off, | 2551 | static int type_file_read_proc(char *page, char **start, off_t off, |
2466 | int count, int *eof, void *data) | 2552 | int count, int *eof, void *data) |
2467 | { | 2553 | { |
@@ -2847,6 +2933,10 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2847 | new_smi->intf_num = smi_num; | 2933 | new_smi->intf_num = smi_num; |
2848 | smi_num++; | 2934 | smi_num++; |
2849 | 2935 | ||
2936 | rv = try_enable_event_buffer(new_smi); | ||
2937 | if (rv == 0) | ||
2938 | new_smi->has_event_buffer = 1; | ||
2939 | |||
2850 | /* | 2940 | /* |
2851 | * Start clearing the flags before we enable interrupts or the | 2941 | * Start clearing the flags before we enable interrupts or the |
2852 | * timer to avoid racing with the timer. | 2942 | * timer to avoid racing with the timer. |
@@ -2863,7 +2953,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2863 | */ | 2953 | */ |
2864 | new_smi->pdev = platform_device_alloc("ipmi_si", | 2954 | new_smi->pdev = platform_device_alloc("ipmi_si", |
2865 | new_smi->intf_num); | 2955 | new_smi->intf_num); |
2866 | if (rv) { | 2956 | if (!new_smi->pdev) { |
2867 | printk(KERN_ERR | 2957 | printk(KERN_ERR |
2868 | "ipmi_si_intf:" | 2958 | "ipmi_si_intf:" |
2869 | " Unable to allocate platform device\n"); | 2959 | " Unable to allocate platform device\n"); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 2c1d133819b5..08151d4de489 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2274,7 +2274,7 @@ rescan_last_byte: | |||
2274 | continue; /* nothing to display */ | 2274 | continue; /* nothing to display */ |
2275 | } | 2275 | } |
2276 | /* Glyph not found */ | 2276 | /* Glyph not found */ |
2277 | if ((!(vc->vc_utf && !vc->vc_disp_ctrl) && c < 128) && !(c & ~charmask)) { | 2277 | if ((!(vc->vc_utf && !vc->vc_disp_ctrl) || c < 128) && !(c & ~charmask)) { |
2278 | /* In legacy mode use the glyph we get by a 1:1 mapping. | 2278 | /* In legacy mode use the glyph we get by a 1:1 mapping. |
2279 | This would make absolutely no sense with Unicode in mind, | 2279 | This would make absolutely no sense with Unicode in mind, |
2280 | but do this for ASCII characters since a font may lack | 2280 | but do this for ASCII characters since a font may lack |
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index ee19b6e8fcb4..40bd8c61c7d7 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
@@ -57,7 +57,7 @@ u32 acpi_pm_read_verified(void) | |||
57 | return v2; | 57 | return v2; |
58 | } | 58 | } |
59 | 59 | ||
60 | static cycle_t acpi_pm_read(void) | 60 | static cycle_t acpi_pm_read(struct clocksource *cs) |
61 | { | 61 | { |
62 | return (cycle_t)read_pmtmr(); | 62 | return (cycle_t)read_pmtmr(); |
63 | } | 63 | } |
@@ -83,7 +83,7 @@ static int __init acpi_pm_good_setup(char *__str) | |||
83 | } | 83 | } |
84 | __setup("acpi_pm_good", acpi_pm_good_setup); | 84 | __setup("acpi_pm_good", acpi_pm_good_setup); |
85 | 85 | ||
86 | static cycle_t acpi_pm_read_slow(void) | 86 | static cycle_t acpi_pm_read_slow(struct clocksource *cs) |
87 | { | 87 | { |
88 | return (cycle_t)acpi_pm_read_verified(); | 88 | return (cycle_t)acpi_pm_read_verified(); |
89 | } | 89 | } |
@@ -156,9 +156,9 @@ static int verify_pmtmr_rate(void) | |||
156 | unsigned long count, delta; | 156 | unsigned long count, delta; |
157 | 157 | ||
158 | mach_prepare_counter(); | 158 | mach_prepare_counter(); |
159 | value1 = clocksource_acpi_pm.read(); | 159 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
160 | mach_countup(&count); | 160 | mach_countup(&count); |
161 | value2 = clocksource_acpi_pm.read(); | 161 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
162 | delta = (value2 - value1) & ACPI_PM_MASK; | 162 | delta = (value2 - value1) & ACPI_PM_MASK; |
163 | 163 | ||
164 | /* Check that the PMTMR delta is within 5% of what we expect */ | 164 | /* Check that the PMTMR delta is within 5% of what we expect */ |
@@ -195,9 +195,9 @@ static int __init init_acpi_pm_clocksource(void) | |||
195 | /* "verify" this timing source: */ | 195 | /* "verify" this timing source: */ |
196 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { | 196 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { |
197 | udelay(100 * j); | 197 | udelay(100 * j); |
198 | value1 = clocksource_acpi_pm.read(); | 198 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
199 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { | 199 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { |
200 | value2 = clocksource_acpi_pm.read(); | 200 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
201 | if (value2 == value1) | 201 | if (value2 == value1) |
202 | continue; | 202 | continue; |
203 | if (value2 > value1) | 203 | if (value2 > value1) |
diff --git a/drivers/clocksource/cyclone.c b/drivers/clocksource/cyclone.c index 8615059a8729..64e528e8bfa6 100644 --- a/drivers/clocksource/cyclone.c +++ b/drivers/clocksource/cyclone.c | |||
@@ -19,7 +19,7 @@ | |||
19 | int use_cyclone = 0; | 19 | int use_cyclone = 0; |
20 | static void __iomem *cyclone_ptr; | 20 | static void __iomem *cyclone_ptr; |
21 | 21 | ||
22 | static cycle_t read_cyclone(void) | 22 | static cycle_t read_cyclone(struct clocksource *cs) |
23 | { | 23 | { |
24 | return (cycle_t)readl(cyclone_ptr); | 24 | return (cycle_t)readl(cyclone_ptr); |
25 | } | 25 | } |
diff --git a/drivers/clocksource/scx200_hrt.c b/drivers/clocksource/scx200_hrt.c index b92da677aa5d..27f4d9637b62 100644 --- a/drivers/clocksource/scx200_hrt.c +++ b/drivers/clocksource/scx200_hrt.c | |||
@@ -43,7 +43,7 @@ MODULE_PARM_DESC(ppm, "+-adjust to actual XO freq (ppm)"); | |||
43 | /* The base timer frequency, * 27 if selected */ | 43 | /* The base timer frequency, * 27 if selected */ |
44 | #define HRT_FREQ 1000000 | 44 | #define HRT_FREQ 1000000 |
45 | 45 | ||
46 | static cycle_t read_hrt(void) | 46 | static cycle_t read_hrt(struct clocksource *cs) |
47 | { | 47 | { |
48 | /* Read the timer value */ | 48 | /* Read the timer value */ |
49 | return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET); | 49 | return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET); |
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c index 254f1064d973..01b886e68822 100644 --- a/drivers/clocksource/tcb_clksrc.c +++ b/drivers/clocksource/tcb_clksrc.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | static void __iomem *tcaddr; | 40 | static void __iomem *tcaddr; |
41 | 41 | ||
42 | static cycle_t tc_get_cycles(void) | 42 | static cycle_t tc_get_cycles(struct clocksource *cs) |
43 | { | 43 | { |
44 | unsigned long flags; | 44 | unsigned long flags; |
45 | u32 lower, upper; | 45 | u32 lower, upper; |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 4637a4a757df..7c8c2d72916f 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -674,7 +674,7 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci) | |||
674 | int row_index; | 674 | int row_index; |
675 | 675 | ||
676 | err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT); | 676 | err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT); |
677 | if (err_detect) | 677 | if (!err_detect) |
678 | return; | 678 | return; |
679 | 679 | ||
680 | mpc85xx_mc_printk(mci, KERN_ERR, "Err Detect Register: %#8.8x\n", | 680 | mpc85xx_mc_printk(mci, KERN_ERR, "Err Detect Register: %#8.8x\n", |
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index d009661781bc..ef878615c49f 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -159,6 +159,9 @@ void drm_master_put(struct drm_master **master) | |||
159 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 159 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
160 | struct drm_file *file_priv) | 160 | struct drm_file *file_priv) |
161 | { | 161 | { |
162 | if (file_priv->is_master) | ||
163 | return 0; | ||
164 | |||
162 | if (file_priv->minor->master && file_priv->minor->master != file_priv->master) | 165 | if (file_priv->minor->master && file_priv->minor->master != file_priv->master) |
163 | return -EINVAL; | 166 | return -EINVAL; |
164 | 167 | ||
@@ -169,6 +172,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
169 | file_priv->minor->master != file_priv->master) { | 172 | file_priv->minor->master != file_priv->master) { |
170 | mutex_lock(&dev->struct_mutex); | 173 | mutex_lock(&dev->struct_mutex); |
171 | file_priv->minor->master = drm_master_get(file_priv->master); | 174 | file_priv->minor->master = drm_master_get(file_priv->master); |
175 | file_priv->is_master = 1; | ||
172 | mutex_unlock(&dev->struct_mutex); | 176 | mutex_unlock(&dev->struct_mutex); |
173 | } | 177 | } |
174 | 178 | ||
@@ -178,10 +182,15 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
178 | int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | 182 | int drm_dropmaster_ioctl(struct drm_device *dev, void *data, |
179 | struct drm_file *file_priv) | 183 | struct drm_file *file_priv) |
180 | { | 184 | { |
181 | if (!file_priv->master) | 185 | if (!file_priv->is_master) |
182 | return -EINVAL; | 186 | return -EINVAL; |
187 | |||
188 | if (!file_priv->minor->master) | ||
189 | return -EINVAL; | ||
190 | |||
183 | mutex_lock(&dev->struct_mutex); | 191 | mutex_lock(&dev->struct_mutex); |
184 | drm_master_put(&file_priv->minor->master); | 192 | drm_master_put(&file_priv->minor->master); |
193 | file_priv->is_master = 0; | ||
185 | mutex_unlock(&dev->struct_mutex); | 194 | mutex_unlock(&dev->struct_mutex); |
186 | return 0; | 195 | return 0; |
187 | } | 196 | } |
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index bc0c6849360c..022876ae34f0 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -132,6 +132,7 @@ void drm_sysfs_destroy(void) | |||
132 | */ | 132 | */ |
133 | static void drm_sysfs_device_release(struct device *dev) | 133 | static void drm_sysfs_device_release(struct device *dev) |
134 | { | 134 | { |
135 | memset(dev, 0, sizeof(struct device)); | ||
135 | return; | 136 | return; |
136 | } | 137 | } |
137 | 138 | ||
diff --git a/drivers/gpu/drm/via/via_dma.c b/drivers/gpu/drm/via/via_dma.c index 7a339dba6a69..bfb92d283260 100644 --- a/drivers/gpu/drm/via/via_dma.c +++ b/drivers/gpu/drm/via/via_dma.c | |||
@@ -481,11 +481,13 @@ static int via_wait_idle(drm_via_private_t * dev_priv) | |||
481 | { | 481 | { |
482 | int count = 10000000; | 482 | int count = 10000000; |
483 | 483 | ||
484 | while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && count--); | 484 | while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && --count) |
485 | ; | ||
485 | 486 | ||
486 | while (count-- && (VIA_READ(VIA_REG_STATUS) & | 487 | while (count && (VIA_READ(VIA_REG_STATUS) & |
487 | (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | | 488 | (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | |
488 | VIA_3D_ENG_BUSY))) ; | 489 | VIA_3D_ENG_BUSY))) |
490 | --count; | ||
489 | return count; | 491 | return count; |
490 | } | 492 | } |
491 | 493 | ||
@@ -705,7 +707,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * | |||
705 | switch (d_siz->func) { | 707 | switch (d_siz->func) { |
706 | case VIA_CMDBUF_SPACE: | 708 | case VIA_CMDBUF_SPACE: |
707 | while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size) | 709 | while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size) |
708 | && count--) { | 710 | && --count) { |
709 | if (!d_siz->wait) { | 711 | if (!d_siz->wait) { |
710 | break; | 712 | break; |
711 | } | 713 | } |
@@ -717,7 +719,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * | |||
717 | break; | 719 | break; |
718 | case VIA_CMDBUF_LAG: | 720 | case VIA_CMDBUF_LAG: |
719 | while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size) | 721 | while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size) |
720 | && count--) { | 722 | && --count) { |
721 | if (!d_siz->wait) { | 723 | if (!d_siz->wait) { |
722 | break; | 724 | break; |
723 | } | 725 | } |
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c index bfe49243f38b..1c9410d1822c 100644 --- a/drivers/input/serio/hp_sdc.c +++ b/drivers/input/serio/hp_sdc.c | |||
@@ -819,6 +819,7 @@ static const struct parisc_device_id hp_sdc_tbl[] = { | |||
819 | MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); | 819 | MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); |
820 | 820 | ||
821 | static int __init hp_sdc_init_hppa(struct parisc_device *d); | 821 | static int __init hp_sdc_init_hppa(struct parisc_device *d); |
822 | static struct delayed_work moduleloader_work; | ||
822 | 823 | ||
823 | static struct parisc_driver hp_sdc_driver = { | 824 | static struct parisc_driver hp_sdc_driver = { |
824 | .name = "hp_sdc", | 825 | .name = "hp_sdc", |
@@ -930,8 +931,15 @@ static int __init hp_sdc_init(void) | |||
930 | 931 | ||
931 | #if defined(__hppa__) | 932 | #if defined(__hppa__) |
932 | 933 | ||
934 | static void request_module_delayed(struct work_struct *work) | ||
935 | { | ||
936 | request_module("hp_sdc_mlc"); | ||
937 | } | ||
938 | |||
933 | static int __init hp_sdc_init_hppa(struct parisc_device *d) | 939 | static int __init hp_sdc_init_hppa(struct parisc_device *d) |
934 | { | 940 | { |
941 | int ret; | ||
942 | |||
935 | if (!d) | 943 | if (!d) |
936 | return 1; | 944 | return 1; |
937 | if (hp_sdc.dev != NULL) | 945 | if (hp_sdc.dev != NULL) |
@@ -944,13 +952,26 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d) | |||
944 | hp_sdc.data_io = d->hpa.start + 0x800; | 952 | hp_sdc.data_io = d->hpa.start + 0x800; |
945 | hp_sdc.status_io = d->hpa.start + 0x801; | 953 | hp_sdc.status_io = d->hpa.start + 0x801; |
946 | 954 | ||
947 | return hp_sdc_init(); | 955 | INIT_DELAYED_WORK(&moduleloader_work, request_module_delayed); |
956 | |||
957 | ret = hp_sdc_init(); | ||
958 | /* after sucessfull initialization give SDC some time to settle | ||
959 | * and then load the hp_sdc_mlc upper layer driver */ | ||
960 | if (!ret) | ||
961 | schedule_delayed_work(&moduleloader_work, | ||
962 | msecs_to_jiffies(2000)); | ||
963 | |||
964 | return ret; | ||
948 | } | 965 | } |
949 | 966 | ||
950 | #endif /* __hppa__ */ | 967 | #endif /* __hppa__ */ |
951 | 968 | ||
952 | static void hp_sdc_exit(void) | 969 | static void hp_sdc_exit(void) |
953 | { | 970 | { |
971 | /* do nothing if we don't have a SDC */ | ||
972 | if (!hp_sdc.dev) | ||
973 | return; | ||
974 | |||
954 | write_lock_irq(&hp_sdc.lock); | 975 | write_lock_irq(&hp_sdc.lock); |
955 | 976 | ||
956 | /* Turn off all maskable "sub-function" irq's. */ | 977 | /* Turn off all maskable "sub-function" irq's. */ |
@@ -969,6 +990,7 @@ static void hp_sdc_exit(void) | |||
969 | tasklet_kill(&hp_sdc.task); | 990 | tasklet_kill(&hp_sdc.task); |
970 | 991 | ||
971 | #if defined(__hppa__) | 992 | #if defined(__hppa__) |
993 | cancel_delayed_work_sync(&moduleloader_work); | ||
972 | if (unregister_parisc_driver(&hp_sdc_driver)) | 994 | if (unregister_parisc_driver(&hp_sdc_driver)) |
973 | printk(KERN_WARNING PREFIX "Error unregistering HP SDC"); | 995 | printk(KERN_WARNING PREFIX "Error unregistering HP SDC"); |
974 | #endif | 996 | #endif |
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index ac8a4a3741b8..af92a176697f 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -158,7 +158,8 @@ void free_interrupts(void); | |||
158 | /* segments.c: */ | 158 | /* segments.c: */ |
159 | void setup_default_gdt_entries(struct lguest_ro_state *state); | 159 | void setup_default_gdt_entries(struct lguest_ro_state *state); |
160 | void setup_guest_gdt(struct lg_cpu *cpu); | 160 | void setup_guest_gdt(struct lg_cpu *cpu); |
161 | void load_guest_gdt(struct lg_cpu *cpu, unsigned long table, u32 num); | 161 | void load_guest_gdt_entry(struct lg_cpu *cpu, unsigned int i, |
162 | u32 low, u32 hi); | ||
162 | void guest_load_tls(struct lg_cpu *cpu, unsigned long tls_array); | 163 | void guest_load_tls(struct lg_cpu *cpu, unsigned long tls_array); |
163 | void copy_gdt(const struct lg_cpu *cpu, struct desc_struct *gdt); | 164 | void copy_gdt(const struct lg_cpu *cpu, struct desc_struct *gdt); |
164 | void copy_gdt_tls(const struct lg_cpu *cpu, struct desc_struct *gdt); | 165 | void copy_gdt_tls(const struct lg_cpu *cpu, struct desc_struct *gdt); |
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c index 4f15439b7f12..7ede64ffeef9 100644 --- a/drivers/lguest/segments.c +++ b/drivers/lguest/segments.c | |||
@@ -144,18 +144,19 @@ void copy_gdt(const struct lg_cpu *cpu, struct desc_struct *gdt) | |||
144 | gdt[i] = cpu->arch.gdt[i]; | 144 | gdt[i] = cpu->arch.gdt[i]; |
145 | } | 145 | } |
146 | 146 | ||
147 | /*H:620 This is where the Guest asks us to load a new GDT (LHCALL_LOAD_GDT). | 147 | /*H:620 This is where the Guest asks us to load a new GDT entry |
148 | * We copy it from the Guest and tweak the entries. */ | 148 | * (LHCALL_LOAD_GDT_ENTRY). We tweak the entry and copy it in. */ |
149 | void load_guest_gdt(struct lg_cpu *cpu, unsigned long table, u32 num) | 149 | void load_guest_gdt_entry(struct lg_cpu *cpu, u32 num, u32 lo, u32 hi) |
150 | { | 150 | { |
151 | /* We assume the Guest has the same number of GDT entries as the | 151 | /* We assume the Guest has the same number of GDT entries as the |
152 | * Host, otherwise we'd have to dynamically allocate the Guest GDT. */ | 152 | * Host, otherwise we'd have to dynamically allocate the Guest GDT. */ |
153 | if (num > ARRAY_SIZE(cpu->arch.gdt)) | 153 | if (num > ARRAY_SIZE(cpu->arch.gdt)) |
154 | kill_guest(cpu, "too many gdt entries %i", num); | 154 | kill_guest(cpu, "too many gdt entries %i", num); |
155 | 155 | ||
156 | /* We read the whole thing in, then fix it up. */ | 156 | /* Set it up, then fix it. */ |
157 | __lgread(cpu, cpu->arch.gdt, table, num * sizeof(cpu->arch.gdt[0])); | 157 | cpu->arch.gdt[num].a = lo; |
158 | fixup_gdt_table(cpu, 0, ARRAY_SIZE(cpu->arch.gdt)); | 158 | cpu->arch.gdt[num].b = hi; |
159 | fixup_gdt_table(cpu, num, num+1); | ||
159 | /* Mark that the GDT changed so the core knows it has to copy it again, | 160 | /* Mark that the GDT changed so the core knows it has to copy it again, |
160 | * even if the Guest is run on the same CPU. */ | 161 | * even if the Guest is run on the same CPU. */ |
161 | cpu->changed |= CHANGED_GDT; | 162 | cpu->changed |= CHANGED_GDT; |
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c index a6b717644be0..1a83910f674f 100644 --- a/drivers/lguest/x86/core.c +++ b/drivers/lguest/x86/core.c | |||
@@ -324,6 +324,11 @@ static void rewrite_hypercall(struct lg_cpu *cpu) | |||
324 | u8 insn[3] = {0xcd, 0x1f, 0x90}; | 324 | u8 insn[3] = {0xcd, 0x1f, 0x90}; |
325 | 325 | ||
326 | __lgwrite(cpu, guest_pa(cpu, cpu->regs->eip), insn, sizeof(insn)); | 326 | __lgwrite(cpu, guest_pa(cpu, cpu->regs->eip), insn, sizeof(insn)); |
327 | /* The above write might have caused a copy of that page to be made | ||
328 | * (if it was read-only). We need to make sure the Guest has | ||
329 | * up-to-date pagetables. As this doesn't happen often, we can just | ||
330 | * drop them all. */ | ||
331 | guest_pagetable_clear_all(cpu); | ||
327 | } | 332 | } |
328 | 333 | ||
329 | static bool is_hypercall(struct lg_cpu *cpu) | 334 | static bool is_hypercall(struct lg_cpu *cpu) |
@@ -563,8 +568,8 @@ void __exit lguest_arch_host_fini(void) | |||
563 | int lguest_arch_do_hcall(struct lg_cpu *cpu, struct hcall_args *args) | 568 | int lguest_arch_do_hcall(struct lg_cpu *cpu, struct hcall_args *args) |
564 | { | 569 | { |
565 | switch (args->arg0) { | 570 | switch (args->arg0) { |
566 | case LHCALL_LOAD_GDT: | 571 | case LHCALL_LOAD_GDT_ENTRY: |
567 | load_guest_gdt(cpu, args->arg1, args->arg2); | 572 | load_guest_gdt_entry(cpu, args->arg1, args->arg2, args->arg3); |
568 | break; | 573 | break; |
569 | case LHCALL_LOAD_IDT_ENTRY: | 574 | case LHCALL_LOAD_IDT_ENTRY: |
570 | load_guest_idt_entry(cpu, args->arg1, args->arg2, args->arg3); | 575 | load_guest_idt_entry(cpu, args->arg1, args->arg2, args->arg3); |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 173cf55c64d0..3d906833948d 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -123,7 +123,7 @@ config PMAC_APM_EMU | |||
123 | 123 | ||
124 | config PMAC_MEDIABAY | 124 | config PMAC_MEDIABAY |
125 | bool "Support PowerBook hotswap media bay" | 125 | bool "Support PowerBook hotswap media bay" |
126 | depends on PPC_PMAC && PPC32 | 126 | depends on PPC_PMAC && PPC32 && BLOCK |
127 | help | 127 | help |
128 | This option adds support for older PowerBook's hotswap media bay | 128 | This option adds support for older PowerBook's hotswap media bay |
129 | that can contains batteries, floppy drives, or IDE devices. PCI | 129 | that can contains batteries, floppy drives, or IDE devices. PCI |
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index eca55ef185b5..029ad8ce8a7e 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -446,6 +446,7 @@ int check_media_bay_by_base(unsigned long base, int what) | |||
446 | 446 | ||
447 | return -ENODEV; | 447 | return -ENODEV; |
448 | } | 448 | } |
449 | EXPORT_SYMBOL_GPL(check_media_bay_by_base); | ||
449 | 450 | ||
450 | int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, | 451 | int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, |
451 | int irq, ide_hwif_t *hwif) | 452 | int irq, ide_hwif_t *hwif) |
@@ -485,6 +486,7 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, | |||
485 | 486 | ||
486 | return -ENODEV; | 487 | return -ENODEV; |
487 | } | 488 | } |
489 | EXPORT_SYMBOL_GPL(media_bay_set_ide_infos); | ||
488 | #endif /* CONFIG_BLK_DEV_IDE_PMAC */ | 490 | #endif /* CONFIG_BLK_DEV_IDE_PMAC */ |
489 | 491 | ||
490 | static void media_bay_step(int i) | 492 | static void media_bay_step(int i) |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index f8a9f7ab2cb8..1fb91edc7de2 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1479,6 +1479,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) | |||
1479 | s += blocks; | 1479 | s += blocks; |
1480 | } | 1480 | } |
1481 | bitmap->last_end_sync = jiffies; | 1481 | bitmap->last_end_sync = jiffies; |
1482 | sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed"); | ||
1482 | } | 1483 | } |
1483 | 1484 | ||
1484 | static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed) | 1485 | static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed) |
@@ -1589,7 +1590,7 @@ void bitmap_destroy(mddev_t *mddev) | |||
1589 | int bitmap_create(mddev_t *mddev) | 1590 | int bitmap_create(mddev_t *mddev) |
1590 | { | 1591 | { |
1591 | struct bitmap *bitmap; | 1592 | struct bitmap *bitmap; |
1592 | unsigned long blocks = mddev->resync_max_sectors; | 1593 | sector_t blocks = mddev->resync_max_sectors; |
1593 | unsigned long chunks; | 1594 | unsigned long chunks; |
1594 | unsigned long pages; | 1595 | unsigned long pages; |
1595 | struct file *file = mddev->bitmap_file; | 1596 | struct file *file = mddev->bitmap_file; |
@@ -1631,8 +1632,8 @@ int bitmap_create(mddev_t *mddev) | |||
1631 | bitmap->chunkshift = ffz(~bitmap->chunksize); | 1632 | bitmap->chunkshift = ffz(~bitmap->chunksize); |
1632 | 1633 | ||
1633 | /* now that chunksize and chunkshift are set, we can use these macros */ | 1634 | /* now that chunksize and chunkshift are set, we can use these macros */ |
1634 | chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) / | 1635 | chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) >> |
1635 | CHUNK_BLOCK_RATIO(bitmap); | 1636 | CHUNK_BLOCK_SHIFT(bitmap); |
1636 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; | 1637 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; |
1637 | 1638 | ||
1638 | BUG_ON(!pages); | 1639 | BUG_ON(!pages); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index ed5727c089a9..612343fdde94 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2017,6 +2017,8 @@ repeat: | |||
2017 | clear_bit(MD_CHANGE_PENDING, &mddev->flags); | 2017 | clear_bit(MD_CHANGE_PENDING, &mddev->flags); |
2018 | spin_unlock_irq(&mddev->write_lock); | 2018 | spin_unlock_irq(&mddev->write_lock); |
2019 | wake_up(&mddev->sb_wait); | 2019 | wake_up(&mddev->sb_wait); |
2020 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) | ||
2021 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
2020 | 2022 | ||
2021 | } | 2023 | } |
2022 | 2024 | ||
@@ -2086,6 +2088,7 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2086 | * -writemostly - clears write_mostly | 2088 | * -writemostly - clears write_mostly |
2087 | * blocked - sets the Blocked flag | 2089 | * blocked - sets the Blocked flag |
2088 | * -blocked - clears the Blocked flag | 2090 | * -blocked - clears the Blocked flag |
2091 | * insync - sets Insync providing device isn't active | ||
2089 | */ | 2092 | */ |
2090 | int err = -EINVAL; | 2093 | int err = -EINVAL; |
2091 | if (cmd_match(buf, "faulty") && rdev->mddev->pers) { | 2094 | if (cmd_match(buf, "faulty") && rdev->mddev->pers) { |
@@ -2118,6 +2121,9 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2118 | md_wakeup_thread(rdev->mddev->thread); | 2121 | md_wakeup_thread(rdev->mddev->thread); |
2119 | 2122 | ||
2120 | err = 0; | 2123 | err = 0; |
2124 | } else if (cmd_match(buf, "insync") && rdev->raid_disk == -1) { | ||
2125 | set_bit(In_sync, &rdev->flags); | ||
2126 | err = 0; | ||
2121 | } | 2127 | } |
2122 | if (!err && rdev->sysfs_state) | 2128 | if (!err && rdev->sysfs_state) |
2123 | sysfs_notify_dirent(rdev->sysfs_state); | 2129 | sysfs_notify_dirent(rdev->sysfs_state); |
@@ -2190,7 +2196,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2190 | } else if (rdev->mddev->pers) { | 2196 | } else if (rdev->mddev->pers) { |
2191 | mdk_rdev_t *rdev2; | 2197 | mdk_rdev_t *rdev2; |
2192 | /* Activating a spare .. or possibly reactivating | 2198 | /* Activating a spare .. or possibly reactivating |
2193 | * if we every get bitmaps working here. | 2199 | * if we ever get bitmaps working here. |
2194 | */ | 2200 | */ |
2195 | 2201 | ||
2196 | if (rdev->raid_disk != -1) | 2202 | if (rdev->raid_disk != -1) |
@@ -3482,12 +3488,15 @@ sync_completed_show(mddev_t *mddev, char *page) | |||
3482 | { | 3488 | { |
3483 | unsigned long max_sectors, resync; | 3489 | unsigned long max_sectors, resync; |
3484 | 3490 | ||
3491 | if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) | ||
3492 | return sprintf(page, "none\n"); | ||
3493 | |||
3485 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) | 3494 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) |
3486 | max_sectors = mddev->resync_max_sectors; | 3495 | max_sectors = mddev->resync_max_sectors; |
3487 | else | 3496 | else |
3488 | max_sectors = mddev->dev_sectors; | 3497 | max_sectors = mddev->dev_sectors; |
3489 | 3498 | ||
3490 | resync = (mddev->curr_resync - atomic_read(&mddev->recovery_active)); | 3499 | resync = mddev->curr_resync_completed; |
3491 | return sprintf(page, "%lu / %lu\n", resync, max_sectors); | 3500 | return sprintf(page, "%lu / %lu\n", resync, max_sectors); |
3492 | } | 3501 | } |
3493 | 3502 | ||
@@ -6334,18 +6343,13 @@ void md_do_sync(mddev_t *mddev) | |||
6334 | sector_t sectors; | 6343 | sector_t sectors; |
6335 | 6344 | ||
6336 | skipped = 0; | 6345 | skipped = 0; |
6337 | if (j >= mddev->resync_max) { | ||
6338 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
6339 | wait_event(mddev->recovery_wait, | ||
6340 | mddev->resync_max > j | ||
6341 | || kthread_should_stop()); | ||
6342 | } | ||
6343 | if (kthread_should_stop()) | ||
6344 | goto interrupted; | ||
6345 | 6346 | ||
6346 | if (mddev->curr_resync > mddev->curr_resync_completed && | 6347 | if ((mddev->curr_resync > mddev->curr_resync_completed && |
6347 | (mddev->curr_resync - mddev->curr_resync_completed) | 6348 | (mddev->curr_resync - mddev->curr_resync_completed) |
6348 | > (max_sectors >> 4)) { | 6349 | > (max_sectors >> 4)) || |
6350 | (j - mddev->curr_resync_completed)*2 | ||
6351 | >= mddev->resync_max - mddev->curr_resync_completed | ||
6352 | ) { | ||
6349 | /* time to update curr_resync_completed */ | 6353 | /* time to update curr_resync_completed */ |
6350 | blk_unplug(mddev->queue); | 6354 | blk_unplug(mddev->queue); |
6351 | wait_event(mddev->recovery_wait, | 6355 | wait_event(mddev->recovery_wait, |
@@ -6353,7 +6357,17 @@ void md_do_sync(mddev_t *mddev) | |||
6353 | mddev->curr_resync_completed = | 6357 | mddev->curr_resync_completed = |
6354 | mddev->curr_resync; | 6358 | mddev->curr_resync; |
6355 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); | 6359 | set_bit(MD_CHANGE_CLEAN, &mddev->flags); |
6360 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
6356 | } | 6361 | } |
6362 | |||
6363 | if (j >= mddev->resync_max) | ||
6364 | wait_event(mddev->recovery_wait, | ||
6365 | mddev->resync_max > j | ||
6366 | || kthread_should_stop()); | ||
6367 | |||
6368 | if (kthread_should_stop()) | ||
6369 | goto interrupted; | ||
6370 | |||
6357 | sectors = mddev->pers->sync_request(mddev, j, &skipped, | 6371 | sectors = mddev->pers->sync_request(mddev, j, &skipped, |
6358 | currspeed < speed_min(mddev)); | 6372 | currspeed < speed_min(mddev)); |
6359 | if (sectors == 0) { | 6373 | if (sectors == 0) { |
@@ -6461,6 +6475,7 @@ void md_do_sync(mddev_t *mddev) | |||
6461 | 6475 | ||
6462 | skip: | 6476 | skip: |
6463 | mddev->curr_resync = 0; | 6477 | mddev->curr_resync = 0; |
6478 | mddev->curr_resync_completed = 0; | ||
6464 | mddev->resync_min = 0; | 6479 | mddev->resync_min = 0; |
6465 | mddev->resync_max = MaxSector; | 6480 | mddev->resync_max = MaxSector; |
6466 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | 6481 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); |
diff --git a/drivers/md/md.h b/drivers/md/md.h index e9b7f54c24d6..8227ab909d44 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -12,10 +12,17 @@ | |||
12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef _MD_K_H | 15 | #ifndef _MD_MD_H |
16 | #define _MD_K_H | 16 | #define _MD_MD_H |
17 | 17 | ||
18 | #ifdef CONFIG_BLOCK | 18 | #include <linux/blkdev.h> |
19 | #include <linux/kobject.h> | ||
20 | #include <linux/list.h> | ||
21 | #include <linux/mm.h> | ||
22 | #include <linux/mutex.h> | ||
23 | #include <linux/timer.h> | ||
24 | #include <linux/wait.h> | ||
25 | #include <linux/workqueue.h> | ||
19 | 26 | ||
20 | #define MaxSector (~(sector_t)0) | 27 | #define MaxSector (~(sector_t)0) |
21 | 28 | ||
@@ -408,10 +415,6 @@ static inline void safe_put_page(struct page *p) | |||
408 | if (p) put_page(p); | 415 | if (p) put_page(p); |
409 | } | 416 | } |
410 | 417 | ||
411 | #endif /* CONFIG_BLOCK */ | ||
412 | #endif | ||
413 | |||
414 | |||
415 | extern int register_md_personality(struct mdk_personality *p); | 418 | extern int register_md_personality(struct mdk_personality *p); |
416 | extern int unregister_md_personality(struct mdk_personality *p); | 419 | extern int unregister_md_personality(struct mdk_personality *p); |
417 | extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev), | 420 | extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev), |
@@ -434,3 +437,5 @@ extern void md_new_event(mddev_t *mddev); | |||
434 | extern int md_allow_write(mddev_t *mddev); | 437 | extern int md_allow_write(mddev_t *mddev); |
435 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | 438 | extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); |
436 | extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); | 439 | extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); |
440 | |||
441 | #endif /* _MD_MD_H */ | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3bbc6d647044..4616bc3a6e71 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3845,6 +3845,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3845 | wait_event(conf->wait_for_overlap, | 3845 | wait_event(conf->wait_for_overlap, |
3846 | atomic_read(&conf->reshape_stripes)==0); | 3846 | atomic_read(&conf->reshape_stripes)==0); |
3847 | mddev->reshape_position = conf->reshape_progress; | 3847 | mddev->reshape_position = conf->reshape_progress; |
3848 | mddev->curr_resync_completed = mddev->curr_resync; | ||
3848 | conf->reshape_checkpoint = jiffies; | 3849 | conf->reshape_checkpoint = jiffies; |
3849 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 3850 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
3850 | md_wakeup_thread(mddev->thread); | 3851 | md_wakeup_thread(mddev->thread); |
@@ -3854,6 +3855,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3854 | conf->reshape_safe = mddev->reshape_position; | 3855 | conf->reshape_safe = mddev->reshape_position; |
3855 | spin_unlock_irq(&conf->device_lock); | 3856 | spin_unlock_irq(&conf->device_lock); |
3856 | wake_up(&conf->wait_for_overlap); | 3857 | wake_up(&conf->wait_for_overlap); |
3858 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
3857 | } | 3859 | } |
3858 | 3860 | ||
3859 | if (mddev->delta_disks < 0) { | 3861 | if (mddev->delta_disks < 0) { |
@@ -3938,11 +3940,13 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3938 | * then we need to write out the superblock. | 3940 | * then we need to write out the superblock. |
3939 | */ | 3941 | */ |
3940 | sector_nr += reshape_sectors; | 3942 | sector_nr += reshape_sectors; |
3941 | if (sector_nr >= mddev->resync_max) { | 3943 | if ((sector_nr - mddev->curr_resync_completed) * 2 |
3944 | >= mddev->resync_max - mddev->curr_resync_completed) { | ||
3942 | /* Cannot proceed until we've updated the superblock... */ | 3945 | /* Cannot proceed until we've updated the superblock... */ |
3943 | wait_event(conf->wait_for_overlap, | 3946 | wait_event(conf->wait_for_overlap, |
3944 | atomic_read(&conf->reshape_stripes) == 0); | 3947 | atomic_read(&conf->reshape_stripes) == 0); |
3945 | mddev->reshape_position = conf->reshape_progress; | 3948 | mddev->reshape_position = conf->reshape_progress; |
3949 | mddev->curr_resync_completed = mddev->curr_resync; | ||
3946 | conf->reshape_checkpoint = jiffies; | 3950 | conf->reshape_checkpoint = jiffies; |
3947 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 3951 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
3948 | md_wakeup_thread(mddev->thread); | 3952 | md_wakeup_thread(mddev->thread); |
@@ -3953,6 +3957,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3953 | conf->reshape_safe = mddev->reshape_position; | 3957 | conf->reshape_safe = mddev->reshape_position; |
3954 | spin_unlock_irq(&conf->device_lock); | 3958 | spin_unlock_irq(&conf->device_lock); |
3955 | wake_up(&conf->wait_for_overlap); | 3959 | wake_up(&conf->wait_for_overlap); |
3960 | sysfs_notify(&mddev->kobj, NULL, "sync_completed"); | ||
3956 | } | 3961 | } |
3957 | return reshape_sectors; | 3962 | return reshape_sectors; |
3958 | } | 3963 | } |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 92c297796a9f..bd945d04dc90 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -1200,7 +1200,7 @@ static int si470x_fops_release(struct file *file) | |||
1200 | video_unregister_device(radio->videodev); | 1200 | video_unregister_device(radio->videodev); |
1201 | kfree(radio->buffer); | 1201 | kfree(radio->buffer); |
1202 | kfree(radio); | 1202 | kfree(radio); |
1203 | goto unlock; | 1203 | goto done; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | /* stop rds reception */ | 1206 | /* stop rds reception */ |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index d0d126c69354..5d496a99e034 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -5934,7 +5934,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | |||
5934 | 5934 | ||
5935 | /* Initalize the timer | 5935 | /* Initalize the timer |
5936 | */ | 5936 | */ |
5937 | init_timer(&pCfg->timer); | 5937 | init_timer_on_stack(&pCfg->timer); |
5938 | pCfg->timer.data = (unsigned long) ioc; | 5938 | pCfg->timer.data = (unsigned long) ioc; |
5939 | pCfg->timer.function = mpt_timer_expired; | 5939 | pCfg->timer.function = mpt_timer_expired; |
5940 | pCfg->wait_done = 0; | 5940 | pCfg->wait_done = 0; |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 3e6e42d2f01b..bbefe77c67a9 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -375,7 +375,7 @@ static int __init gru_init(void) | |||
375 | void *gru_start_vaddr; | 375 | void *gru_start_vaddr; |
376 | 376 | ||
377 | if (!is_uv_system()) | 377 | if (!is_uv_system()) |
378 | return -ENODEV; | 378 | return 0; |
379 | 379 | ||
380 | #if defined CONFIG_IA64 | 380 | #if defined CONFIG_IA64 |
381 | gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */ | 381 | gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */ |
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c index 16f8dcab2da4..7896849b16dc 100644 --- a/drivers/misc/sgi-xp/xp_main.c +++ b/drivers/misc/sgi-xp/xp_main.c | |||
@@ -248,19 +248,19 @@ xp_init(void) | |||
248 | enum xp_retval ret; | 248 | enum xp_retval ret; |
249 | int ch_number; | 249 | int ch_number; |
250 | 250 | ||
251 | /* initialize the connection registration mutex */ | ||
252 | for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) | ||
253 | mutex_init(&xpc_registrations[ch_number].mutex); | ||
254 | |||
251 | if (is_shub()) | 255 | if (is_shub()) |
252 | ret = xp_init_sn2(); | 256 | ret = xp_init_sn2(); |
253 | else if (is_uv()) | 257 | else if (is_uv()) |
254 | ret = xp_init_uv(); | 258 | ret = xp_init_uv(); |
255 | else | 259 | else |
256 | ret = xpUnsupported; | 260 | ret = 0; |
257 | 261 | ||
258 | if (ret != xpSuccess) | 262 | if (ret != xpSuccess) |
259 | return -ENODEV; | 263 | return ret; |
260 | |||
261 | /* initialize the connection registration mutex */ | ||
262 | for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) | ||
263 | mutex_init(&xpc_registrations[ch_number].mutex); | ||
264 | 264 | ||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index 7c5b257ce8e4..29acd06b1c39 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c | |||
@@ -332,7 +332,7 @@ static void cafe_select_chip(struct mtd_info *mtd, int chipnr) | |||
332 | cafe->ctl1 &= ~CTRL1_CHIPSELECT; | 332 | cafe->ctl1 &= ~CTRL1_CHIPSELECT; |
333 | } | 333 | } |
334 | 334 | ||
335 | static int cafe_nand_interrupt(int irq, void *id) | 335 | static irqreturn_t cafe_nand_interrupt(int irq, void *id) |
336 | { | 336 | { |
337 | struct mtd_info *mtd = id; | 337 | struct mtd_info *mtd = id; |
338 | struct cafe_priv *cafe = mtd->priv; | 338 | struct cafe_priv *cafe = mtd->priv; |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index 29df398b7727..1fc45431a620 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -1383,6 +1383,11 @@ static void rtl8139_hw_start (struct net_device *dev) | |||
1383 | RTL_W32_F (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0))); | 1383 | RTL_W32_F (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0))); |
1384 | RTL_W32_F (MAC0 + 4, le16_to_cpu (*(__le16 *) (dev->dev_addr + 4))); | 1384 | RTL_W32_F (MAC0 + 4, le16_to_cpu (*(__le16 *) (dev->dev_addr + 4))); |
1385 | 1385 | ||
1386 | tp->cur_rx = 0; | ||
1387 | |||
1388 | /* init Rx ring buffer DMA address */ | ||
1389 | RTL_W32_F (RxBuf, tp->rx_ring_dma); | ||
1390 | |||
1386 | /* Must enable Tx/Rx before setting transfer thresholds! */ | 1391 | /* Must enable Tx/Rx before setting transfer thresholds! */ |
1387 | RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb); | 1392 | RTL_W8 (ChipCmd, CmdRxEnb | CmdTxEnb); |
1388 | 1393 | ||
@@ -1390,8 +1395,6 @@ static void rtl8139_hw_start (struct net_device *dev) | |||
1390 | RTL_W32 (RxConfig, tp->rx_config); | 1395 | RTL_W32 (RxConfig, tp->rx_config); |
1391 | RTL_W32 (TxConfig, rtl8139_tx_config); | 1396 | RTL_W32 (TxConfig, rtl8139_tx_config); |
1392 | 1397 | ||
1393 | tp->cur_rx = 0; | ||
1394 | |||
1395 | rtl_check_media (dev, 1); | 1398 | rtl_check_media (dev, 1); |
1396 | 1399 | ||
1397 | if (tp->chipset >= CH_8139B) { | 1400 | if (tp->chipset >= CH_8139B) { |
@@ -1406,9 +1409,6 @@ static void rtl8139_hw_start (struct net_device *dev) | |||
1406 | /* Lock Config[01234] and BMCR register writes */ | 1409 | /* Lock Config[01234] and BMCR register writes */ |
1407 | RTL_W8 (Cfg9346, Cfg9346_Lock); | 1410 | RTL_W8 (Cfg9346, Cfg9346_Lock); |
1408 | 1411 | ||
1409 | /* init Rx ring buffer DMA address */ | ||
1410 | RTL_W32_F (RxBuf, tp->rx_ring_dma); | ||
1411 | |||
1412 | /* init Tx buffer DMA addresses */ | 1412 | /* init Tx buffer DMA addresses */ |
1413 | for (i = 0; i < NUM_TX_DESC; i++) | 1413 | for (i = 0; i < NUM_TX_DESC; i++) |
1414 | RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)); | 1414 | RTL_W32_F (TxAddr0 + (i * 4), tp->tx_bufs_dma + (tp->tx_buf[i] - tp->tx_bufs)); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9e921544ba20..214a92d1ef75 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -28,9 +28,9 @@ if NETDEVICES | |||
28 | 28 | ||
29 | config COMPAT_NET_DEV_OPS | 29 | config COMPAT_NET_DEV_OPS |
30 | default y | 30 | default y |
31 | bool "Enable older network device API compatiablity" | 31 | bool "Enable older network device API compatibility" |
32 | ---help--- | 32 | ---help--- |
33 | This option enables kernel compatiability with older network devices | 33 | This option enables kernel compatibility with older network devices |
34 | that do not use net_device_ops interface. | 34 | that do not use net_device_ops interface. |
35 | 35 | ||
36 | If unsure, say Y. | 36 | If unsure, say Y. |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index ab0e5febef83..7ea48414c6cb 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -1117,8 +1117,8 @@ static void cxgb_down(struct adapter *adapter) | |||
1117 | spin_unlock_irq(&adapter->work_lock); | 1117 | spin_unlock_irq(&adapter->work_lock); |
1118 | 1118 | ||
1119 | free_irq_resources(adapter); | 1119 | free_irq_resources(adapter); |
1120 | flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ | ||
1121 | quiesce_rx(adapter); | 1120 | quiesce_rx(adapter); |
1121 | flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ | ||
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | static void schedule_chk_task(struct adapter *adap) | 1124 | static void schedule_chk_task(struct adapter *adap) |
@@ -1187,6 +1187,9 @@ static int offload_close(struct t3cdev *tdev) | |||
1187 | 1187 | ||
1188 | sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group); | 1188 | sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group); |
1189 | 1189 | ||
1190 | /* Flush work scheduled while releasing TIDs */ | ||
1191 | flush_scheduled_work(); | ||
1192 | |||
1190 | tdev->lldev = NULL; | 1193 | tdev->lldev = NULL; |
1191 | cxgb3_set_dummy_ops(tdev); | 1194 | cxgb3_set_dummy_ops(tdev); |
1192 | t3_tp_set_offload_mode(adapter, 0); | 1195 | t3_tp_set_offload_mode(adapter, 0); |
@@ -1232,6 +1235,10 @@ static int cxgb_close(struct net_device *dev) | |||
1232 | struct port_info *pi = netdev_priv(dev); | 1235 | struct port_info *pi = netdev_priv(dev); |
1233 | struct adapter *adapter = pi->adapter; | 1236 | struct adapter *adapter = pi->adapter; |
1234 | 1237 | ||
1238 | |||
1239 | if (!adapter->open_device_map) | ||
1240 | return 0; | ||
1241 | |||
1235 | /* Stop link fault interrupts */ | 1242 | /* Stop link fault interrupts */ |
1236 | t3_xgm_intr_disable(adapter, pi->port_id); | 1243 | t3_xgm_intr_disable(adapter, pi->port_id); |
1237 | t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset); | 1244 | t3_read_reg(adapter, A_XGM_INT_STATUS + pi->mac.offset); |
@@ -1247,8 +1254,7 @@ static int cxgb_close(struct net_device *dev) | |||
1247 | spin_unlock_irq(&adapter->work_lock); | 1254 | spin_unlock_irq(&adapter->work_lock); |
1248 | 1255 | ||
1249 | if (!(adapter->open_device_map & PORT_MASK)) | 1256 | if (!(adapter->open_device_map & PORT_MASK)) |
1250 | cancel_rearming_delayed_workqueue(cxgb3_wq, | 1257 | cancel_delayed_work_sync(&adapter->adap_check_task); |
1251 | &adapter->adap_check_task); | ||
1252 | 1258 | ||
1253 | if (!adapter->open_device_map) | 1259 | if (!adapter->open_device_map) |
1254 | cxgb_down(adapter); | 1260 | cxgb_down(adapter); |
@@ -2493,6 +2499,7 @@ static void check_link_status(struct adapter *adapter) | |||
2493 | 2499 | ||
2494 | spin_lock_irq(&adapter->work_lock); | 2500 | spin_lock_irq(&adapter->work_lock); |
2495 | if (p->link_fault) { | 2501 | if (p->link_fault) { |
2502 | t3_link_fault(adapter, i); | ||
2496 | spin_unlock_irq(&adapter->work_lock); | 2503 | spin_unlock_irq(&adapter->work_lock); |
2497 | continue; | 2504 | continue; |
2498 | } | 2505 | } |
@@ -2554,9 +2561,7 @@ static void t3_adap_check_task(struct work_struct *work) | |||
2554 | 2561 | ||
2555 | adapter->check_task_cnt++; | 2562 | adapter->check_task_cnt++; |
2556 | 2563 | ||
2557 | /* Check link status for PHYs without interrupts */ | 2564 | check_link_status(adapter); |
2558 | if (p->linkpoll_period) | ||
2559 | check_link_status(adapter); | ||
2560 | 2565 | ||
2561 | /* Accumulate MAC stats if needed */ | 2566 | /* Accumulate MAC stats if needed */ |
2562 | if (!p->linkpoll_period || | 2567 | if (!p->linkpoll_period || |
@@ -2680,21 +2685,6 @@ void t3_os_ext_intr_handler(struct adapter *adapter) | |||
2680 | spin_unlock(&adapter->work_lock); | 2685 | spin_unlock(&adapter->work_lock); |
2681 | } | 2686 | } |
2682 | 2687 | ||
2683 | static void link_fault_task(struct work_struct *work) | ||
2684 | { | ||
2685 | struct adapter *adapter = container_of(work, struct adapter, | ||
2686 | link_fault_handler_task); | ||
2687 | int i; | ||
2688 | |||
2689 | for_each_port(adapter, i) { | ||
2690 | struct net_device *netdev = adapter->port[i]; | ||
2691 | struct port_info *pi = netdev_priv(netdev); | ||
2692 | |||
2693 | if (pi->link_fault) | ||
2694 | t3_link_fault(adapter, i); | ||
2695 | } | ||
2696 | } | ||
2697 | |||
2698 | void t3_os_link_fault_handler(struct adapter *adapter, int port_id) | 2688 | void t3_os_link_fault_handler(struct adapter *adapter, int port_id) |
2699 | { | 2689 | { |
2700 | struct net_device *netdev = adapter->port[port_id]; | 2690 | struct net_device *netdev = adapter->port[port_id]; |
@@ -2702,7 +2692,6 @@ void t3_os_link_fault_handler(struct adapter *adapter, int port_id) | |||
2702 | 2692 | ||
2703 | spin_lock(&adapter->work_lock); | 2693 | spin_lock(&adapter->work_lock); |
2704 | pi->link_fault = 1; | 2694 | pi->link_fault = 1; |
2705 | queue_work(cxgb3_wq, &adapter->link_fault_handler_task); | ||
2706 | spin_unlock(&adapter->work_lock); | 2695 | spin_unlock(&adapter->work_lock); |
2707 | } | 2696 | } |
2708 | 2697 | ||
@@ -2838,6 +2827,9 @@ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev, | |||
2838 | struct adapter *adapter = pci_get_drvdata(pdev); | 2827 | struct adapter *adapter = pci_get_drvdata(pdev); |
2839 | int ret; | 2828 | int ret; |
2840 | 2829 | ||
2830 | if (state == pci_channel_io_perm_failure) | ||
2831 | return PCI_ERS_RESULT_DISCONNECT; | ||
2832 | |||
2841 | ret = t3_adapter_error(adapter, 0); | 2833 | ret = t3_adapter_error(adapter, 0); |
2842 | 2834 | ||
2843 | /* Request a slot reset. */ | 2835 | /* Request a slot reset. */ |
@@ -2932,8 +2924,13 @@ static int __devinit cxgb_enable_msix(struct adapter *adap) | |||
2932 | while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0) | 2924 | while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0) |
2933 | vectors = err; | 2925 | vectors = err; |
2934 | 2926 | ||
2935 | if (!err && vectors < (adap->params.nports + 1)) | 2927 | if (err < 0) |
2928 | pci_disable_msix(adap->pdev); | ||
2929 | |||
2930 | if (!err && vectors < (adap->params.nports + 1)) { | ||
2931 | pci_disable_msix(adap->pdev); | ||
2936 | err = -1; | 2932 | err = -1; |
2933 | } | ||
2937 | 2934 | ||
2938 | if (!err) { | 2935 | if (!err) { |
2939 | for (i = 0; i < vectors; ++i) | 2936 | for (i = 0; i < vectors; ++i) |
@@ -3082,7 +3079,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3082 | 3079 | ||
3083 | INIT_LIST_HEAD(&adapter->adapter_list); | 3080 | INIT_LIST_HEAD(&adapter->adapter_list); |
3084 | INIT_WORK(&adapter->ext_intr_handler_task, ext_intr_task); | 3081 | INIT_WORK(&adapter->ext_intr_handler_task, ext_intr_task); |
3085 | INIT_WORK(&adapter->link_fault_handler_task, link_fault_task); | ||
3086 | INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task); | 3082 | INIT_WORK(&adapter->fatal_error_handler_task, fatal_error_task); |
3087 | INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task); | 3083 | INIT_DELAYED_WORK(&adapter->adap_check_task, t3_adap_check_task); |
3088 | 3084 | ||
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 31ed31a3428b..e1bd690ff831 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -1202,7 +1202,6 @@ void t3_link_changed(struct adapter *adapter, int port_id) | |||
1202 | struct cphy *phy = &pi->phy; | 1202 | struct cphy *phy = &pi->phy; |
1203 | struct cmac *mac = &pi->mac; | 1203 | struct cmac *mac = &pi->mac; |
1204 | struct link_config *lc = &pi->link_config; | 1204 | struct link_config *lc = &pi->link_config; |
1205 | int force_link_down = 0; | ||
1206 | 1205 | ||
1207 | phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); | 1206 | phy->ops->get_link_status(phy, &link_ok, &speed, &duplex, &fc); |
1208 | 1207 | ||
@@ -1218,14 +1217,9 @@ void t3_link_changed(struct adapter *adapter, int port_id) | |||
1218 | status = t3_read_reg(adapter, A_XGM_INT_STATUS + mac->offset); | 1217 | status = t3_read_reg(adapter, A_XGM_INT_STATUS + mac->offset); |
1219 | if (status & F_LINKFAULTCHANGE) { | 1218 | if (status & F_LINKFAULTCHANGE) { |
1220 | mac->stats.link_faults++; | 1219 | mac->stats.link_faults++; |
1221 | force_link_down = 1; | 1220 | pi->link_fault = 1; |
1222 | } | 1221 | } |
1223 | t3_open_rx_traffic(mac, rx_cfg, rx_hash_high, rx_hash_low); | 1222 | t3_open_rx_traffic(mac, rx_cfg, rx_hash_high, rx_hash_low); |
1224 | |||
1225 | if (force_link_down) { | ||
1226 | t3_os_link_fault_handler(adapter, port_id); | ||
1227 | return; | ||
1228 | } | ||
1229 | } | 1223 | } |
1230 | 1224 | ||
1231 | if (lc->requested_fc & PAUSE_AUTONEG) | 1225 | if (lc->requested_fc & PAUSE_AUTONEG) |
@@ -1292,9 +1286,6 @@ void t3_link_fault(struct adapter *adapter, int port_id) | |||
1292 | /* Account link faults only when the phy reports a link up */ | 1286 | /* Account link faults only when the phy reports a link up */ |
1293 | if (link_ok) | 1287 | if (link_ok) |
1294 | mac->stats.link_faults++; | 1288 | mac->stats.link_faults++; |
1295 | |||
1296 | msleep(1000); | ||
1297 | t3_os_link_fault_handler(adapter, port_id); | ||
1298 | } else { | 1289 | } else { |
1299 | if (link_ok) | 1290 | if (link_ok) |
1300 | t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset, | 1291 | t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset, |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index ef12931d302a..6a46ceed9436 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -3834,7 +3834,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3834 | struct e1000_buffer *buffer_info; | 3834 | struct e1000_buffer *buffer_info; |
3835 | unsigned int i, eop; | 3835 | unsigned int i, eop; |
3836 | unsigned int count = 0; | 3836 | unsigned int count = 0; |
3837 | bool cleaned = false; | ||
3838 | unsigned int total_tx_bytes=0, total_tx_packets=0; | 3837 | unsigned int total_tx_bytes=0, total_tx_packets=0; |
3839 | 3838 | ||
3840 | i = tx_ring->next_to_clean; | 3839 | i = tx_ring->next_to_clean; |
@@ -3843,7 +3842,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3843 | 3842 | ||
3844 | while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && | 3843 | while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && |
3845 | (count < tx_ring->count)) { | 3844 | (count < tx_ring->count)) { |
3846 | for (cleaned = false; !cleaned; count++) { | 3845 | bool cleaned = false; |
3846 | for ( ; !cleaned; count++) { | ||
3847 | tx_desc = E1000_TX_DESC(*tx_ring, i); | 3847 | tx_desc = E1000_TX_DESC(*tx_ring, i); |
3848 | buffer_info = &tx_ring->buffer_info[i]; | 3848 | buffer_info = &tx_ring->buffer_info[i]; |
3849 | cleaned = (i == eop); | 3849 | cleaned = (i == eop); |
@@ -3871,7 +3871,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3871 | tx_ring->next_to_clean = i; | 3871 | tx_ring->next_to_clean = i; |
3872 | 3872 | ||
3873 | #define TX_WAKE_THRESHOLD 32 | 3873 | #define TX_WAKE_THRESHOLD 32 |
3874 | if (unlikely(cleaned && netif_carrier_ok(netdev) && | 3874 | if (unlikely(count && netif_carrier_ok(netdev) && |
3875 | E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) { | 3875 | E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) { |
3876 | /* Make sure that anybody stopping the queue after this | 3876 | /* Make sure that anybody stopping the queue after this |
3877 | * sees the new next_to_clean. | 3877 | * sees the new next_to_clean. |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 1693ed116b16..ca82f19a7ed1 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -621,7 +621,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
621 | struct e1000_buffer *buffer_info; | 621 | struct e1000_buffer *buffer_info; |
622 | unsigned int i, eop; | 622 | unsigned int i, eop; |
623 | unsigned int count = 0; | 623 | unsigned int count = 0; |
624 | bool cleaned = false; | ||
625 | unsigned int total_tx_bytes = 0, total_tx_packets = 0; | 624 | unsigned int total_tx_bytes = 0, total_tx_packets = 0; |
626 | 625 | ||
627 | i = tx_ring->next_to_clean; | 626 | i = tx_ring->next_to_clean; |
@@ -630,7 +629,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
630 | 629 | ||
631 | while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && | 630 | while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) && |
632 | (count < tx_ring->count)) { | 631 | (count < tx_ring->count)) { |
633 | for (cleaned = 0; !cleaned; count++) { | 632 | bool cleaned = false; |
633 | for (; !cleaned; count++) { | ||
634 | tx_desc = E1000_TX_DESC(*tx_ring, i); | 634 | tx_desc = E1000_TX_DESC(*tx_ring, i); |
635 | buffer_info = &tx_ring->buffer_info[i]; | 635 | buffer_info = &tx_ring->buffer_info[i]; |
636 | cleaned = (i == eop); | 636 | cleaned = (i == eop); |
@@ -661,8 +661,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) | |||
661 | tx_ring->next_to_clean = i; | 661 | tx_ring->next_to_clean = i; |
662 | 662 | ||
663 | #define TX_WAKE_THRESHOLD 32 | 663 | #define TX_WAKE_THRESHOLD 32 |
664 | if (cleaned && netif_carrier_ok(netdev) && | 664 | if (count && netif_carrier_ok(netdev) && |
665 | e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) { | 665 | e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) { |
666 | /* Make sure that anybody stopping the queue after this | 666 | /* Make sure that anybody stopping the queue after this |
667 | * sees the new next_to_clean. | 667 | * sees the new next_to_clean. |
668 | */ | 668 | */ |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_82599.c b/drivers/net/ixgbe/ixgbe_dcb_82599.c index 470b676c1dae..f4417fc3b0fd 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_82599.c +++ b/drivers/net/ixgbe/ixgbe_dcb_82599.c | |||
@@ -290,7 +290,7 @@ s32 ixgbe_dcb_config_tx_data_arbiter_82599(struct ixgbe_hw *hw, | |||
290 | s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, | 290 | s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, |
291 | struct ixgbe_dcb_config *dcb_config) | 291 | struct ixgbe_dcb_config *dcb_config) |
292 | { | 292 | { |
293 | u32 i, reg; | 293 | u32 i, reg, rx_pba_size; |
294 | 294 | ||
295 | /* If PFC is disabled globally then fall back to LFC. */ | 295 | /* If PFC is disabled globally then fall back to LFC. */ |
296 | if (!dcb_config->pfc_mode_enable) { | 296 | if (!dcb_config->pfc_mode_enable) { |
@@ -301,17 +301,23 @@ s32 ixgbe_dcb_config_pfc_82599(struct ixgbe_hw *hw, | |||
301 | 301 | ||
302 | /* Configure PFC Tx thresholds per TC */ | 302 | /* Configure PFC Tx thresholds per TC */ |
303 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { | 303 | for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { |
304 | /* Config and remember Tx */ | 304 | if (dcb_config->rx_pba_cfg == pba_equal) |
305 | rx_pba_size = IXGBE_RXPBSIZE_64KB; | ||
306 | else | ||
307 | rx_pba_size = (i < 4) ? IXGBE_RXPBSIZE_80KB | ||
308 | : IXGBE_RXPBSIZE_48KB; | ||
309 | |||
310 | reg = ((rx_pba_size >> 5) & 0xFFE0); | ||
305 | if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || | 311 | if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || |
306 | dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx) { | 312 | dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx) |
307 | reg = hw->fc.high_water | IXGBE_FCRTH_FCEN; | 313 | reg |= IXGBE_FCRTL_XONE; |
308 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); | 314 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); |
309 | reg = hw->fc.low_water | IXGBE_FCRTL_XONE; | 315 | |
310 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), reg); | 316 | reg = ((rx_pba_size >> 2) & 0xFFE0); |
311 | } else { | 317 | if (dcb_config->tc_config[i].dcb_pfc == pfc_enabled_full || |
312 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), 0); | 318 | dcb_config->tc_config[i].dcb_pfc == pfc_enabled_tx) |
313 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(i), 0); | 319 | reg |= IXGBE_FCRTH_FCEN; |
314 | } | 320 | IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(i), reg); |
315 | } | 321 | } |
316 | 322 | ||
317 | /* Configure pause time (2 TCs per register) */ | 323 | /* Configure pause time (2 TCs per register) */ |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index febde45cf9fa..01884256f4c9 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2841,11 +2841,55 @@ static inline bool ixgbe_cache_ring_dcb(struct ixgbe_adapter *adapter) | |||
2841 | } | 2841 | } |
2842 | ret = true; | 2842 | ret = true; |
2843 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 2843 | } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { |
2844 | for (i = 0; i < dcb_i; i++) { | 2844 | if (dcb_i == 8) { |
2845 | adapter->rx_ring[i].reg_idx = i << 4; | 2845 | /* |
2846 | adapter->tx_ring[i].reg_idx = i << 4; | 2846 | * Tx TC0 starts at: descriptor queue 0 |
2847 | * Tx TC1 starts at: descriptor queue 32 | ||
2848 | * Tx TC2 starts at: descriptor queue 64 | ||
2849 | * Tx TC3 starts at: descriptor queue 80 | ||
2850 | * Tx TC4 starts at: descriptor queue 96 | ||
2851 | * Tx TC5 starts at: descriptor queue 104 | ||
2852 | * Tx TC6 starts at: descriptor queue 112 | ||
2853 | * Tx TC7 starts at: descriptor queue 120 | ||
2854 | * | ||
2855 | * Rx TC0-TC7 are offset by 16 queues each | ||
2856 | */ | ||
2857 | for (i = 0; i < 3; i++) { | ||
2858 | adapter->tx_ring[i].reg_idx = i << 5; | ||
2859 | adapter->rx_ring[i].reg_idx = i << 4; | ||
2860 | } | ||
2861 | for ( ; i < 5; i++) { | ||
2862 | adapter->tx_ring[i].reg_idx = | ||
2863 | ((i + 2) << 4); | ||
2864 | adapter->rx_ring[i].reg_idx = i << 4; | ||
2865 | } | ||
2866 | for ( ; i < dcb_i; i++) { | ||
2867 | adapter->tx_ring[i].reg_idx = | ||
2868 | ((i + 8) << 3); | ||
2869 | adapter->rx_ring[i].reg_idx = i << 4; | ||
2870 | } | ||
2871 | |||
2872 | ret = true; | ||
2873 | } else if (dcb_i == 4) { | ||
2874 | /* | ||
2875 | * Tx TC0 starts at: descriptor queue 0 | ||
2876 | * Tx TC1 starts at: descriptor queue 64 | ||
2877 | * Tx TC2 starts at: descriptor queue 96 | ||
2878 | * Tx TC3 starts at: descriptor queue 112 | ||
2879 | * | ||
2880 | * Rx TC0-TC3 are offset by 32 queues each | ||
2881 | */ | ||
2882 | adapter->tx_ring[0].reg_idx = 0; | ||
2883 | adapter->tx_ring[1].reg_idx = 64; | ||
2884 | adapter->tx_ring[2].reg_idx = 96; | ||
2885 | adapter->tx_ring[3].reg_idx = 112; | ||
2886 | for (i = 0 ; i < dcb_i; i++) | ||
2887 | adapter->rx_ring[i].reg_idx = i << 5; | ||
2888 | |||
2889 | ret = true; | ||
2890 | } else { | ||
2891 | ret = false; | ||
2847 | } | 2892 | } |
2848 | ret = true; | ||
2849 | } else { | 2893 | } else { |
2850 | ret = false; | 2894 | ret = false; |
2851 | } | 2895 | } |
@@ -3946,7 +3990,7 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) | |||
3946 | } | 3990 | } |
3947 | hw->mac.ops.setup_sfp(hw); | 3991 | hw->mac.ops.setup_sfp(hw); |
3948 | 3992 | ||
3949 | if (!adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK) | 3993 | if (!(adapter->flags & IXGBE_FLAG_IN_SFP_LINK_TASK)) |
3950 | /* This will also work for DA Twinax connections */ | 3994 | /* This will also work for DA Twinax connections */ |
3951 | schedule_work(&adapter->multispeed_fiber_task); | 3995 | schedule_work(&adapter->multispeed_fiber_task); |
3952 | adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK; | 3996 | adapter->flags &= ~IXGBE_FLAG_IN_SFP_MOD_TASK; |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 46073de290cf..e82aee41d77e 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -316,10 +316,11 @@ static void macb_tx(struct macb *bp) | |||
316 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", | 316 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", |
317 | (unsigned long)status); | 317 | (unsigned long)status); |
318 | 318 | ||
319 | if (status & MACB_BIT(UND)) { | 319 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { |
320 | int i; | 320 | int i; |
321 | printk(KERN_ERR "%s: TX underrun, resetting buffers\n", | 321 | printk(KERN_ERR "%s: TX %s, resetting buffers\n", |
322 | bp->dev->name); | 322 | bp->dev->name, status & MACB_BIT(UND) ? |
323 | "underrun" : "retry limit exceeded"); | ||
323 | 324 | ||
324 | /* Transfer ongoing, disable transmitter, to avoid confusion */ | 325 | /* Transfer ongoing, disable transmitter, to avoid confusion */ |
325 | if (status & MACB_BIT(TGO)) | 326 | if (status & MACB_BIT(TGO)) |
@@ -520,27 +521,10 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
520 | macb_writel(bp, RSR, status); | 521 | macb_writel(bp, RSR, status); |
521 | 522 | ||
522 | work_done = 0; | 523 | work_done = 0; |
523 | if (!status) { | ||
524 | /* | ||
525 | * This may happen if an interrupt was pending before | ||
526 | * this function was called last time, and no packets | ||
527 | * have been received since. | ||
528 | */ | ||
529 | napi_complete(napi); | ||
530 | goto out; | ||
531 | } | ||
532 | 524 | ||
533 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", | 525 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", |
534 | (unsigned long)status, budget); | 526 | (unsigned long)status, budget); |
535 | 527 | ||
536 | if (!(status & MACB_BIT(REC))) { | ||
537 | dev_warn(&bp->pdev->dev, | ||
538 | "No RX buffers complete, status = %02lx\n", | ||
539 | (unsigned long)status); | ||
540 | napi_complete(napi); | ||
541 | goto out; | ||
542 | } | ||
543 | |||
544 | work_done = macb_rx(bp, budget); | 528 | work_done = macb_rx(bp, budget); |
545 | if (work_done < budget) | 529 | if (work_done < budget) |
546 | napi_complete(napi); | 530 | napi_complete(napi); |
@@ -549,7 +533,6 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
549 | * We've done what we can to clean the buffers. Make sure we | 533 | * We've done what we can to clean the buffers. Make sure we |
550 | * get notified when new packets arrive. | 534 | * get notified when new packets arrive. |
551 | */ | 535 | */ |
552 | out: | ||
553 | macb_writel(bp, IER, MACB_RX_INT_FLAGS); | 536 | macb_writel(bp, IER, MACB_RX_INT_FLAGS); |
554 | 537 | ||
555 | /* TODO: Handle errors */ | 538 | /* TODO: Handle errors */ |
@@ -590,7 +573,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
590 | } | 573 | } |
591 | } | 574 | } |
592 | 575 | ||
593 | if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND))) | 576 | if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND) | |
577 | MACB_BIT(ISR_RLE))) | ||
594 | macb_tx(bp); | 578 | macb_tx(bp); |
595 | 579 | ||
596 | /* | 580 | /* |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 70d3ef4a2c5f..214a8cf2b708 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -376,7 +376,8 @@ static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev) | |||
376 | const struct macvlan_dev *vlan = netdev_priv(dev); | 376 | const struct macvlan_dev *vlan = netdev_priv(dev); |
377 | struct net_device *lowerdev = vlan->lowerdev; | 377 | struct net_device *lowerdev = vlan->lowerdev; |
378 | 378 | ||
379 | if (lowerdev->ethtool_ops->get_rx_csum == NULL) | 379 | if (lowerdev->ethtool_ops == NULL || |
380 | lowerdev->ethtool_ops->get_rx_csum == NULL) | ||
380 | return 0; | 381 | return 0; |
381 | return lowerdev->ethtool_ops->get_rx_csum(lowerdev); | 382 | return lowerdev->ethtool_ops->get_rx_csum(lowerdev); |
382 | } | 383 | } |
@@ -387,7 +388,8 @@ static int macvlan_ethtool_get_settings(struct net_device *dev, | |||
387 | const struct macvlan_dev *vlan = netdev_priv(dev); | 388 | const struct macvlan_dev *vlan = netdev_priv(dev); |
388 | struct net_device *lowerdev = vlan->lowerdev; | 389 | struct net_device *lowerdev = vlan->lowerdev; |
389 | 390 | ||
390 | if (!lowerdev->ethtool_ops->get_settings) | 391 | if (!lowerdev->ethtool_ops || |
392 | !lowerdev->ethtool_ops->get_settings) | ||
391 | return -EOPNOTSUPP; | 393 | return -EOPNOTSUPP; |
392 | 394 | ||
393 | return lowerdev->ethtool_ops->get_settings(lowerdev, cmd); | 395 | return lowerdev->ethtool_ops->get_settings(lowerdev, cmd); |
@@ -398,7 +400,8 @@ static u32 macvlan_ethtool_get_flags(struct net_device *dev) | |||
398 | const struct macvlan_dev *vlan = netdev_priv(dev); | 400 | const struct macvlan_dev *vlan = netdev_priv(dev); |
399 | struct net_device *lowerdev = vlan->lowerdev; | 401 | struct net_device *lowerdev = vlan->lowerdev; |
400 | 402 | ||
401 | if (!lowerdev->ethtool_ops->get_flags) | 403 | if (!lowerdev->ethtool_ops || |
404 | !lowerdev->ethtool_ops->get_flags) | ||
402 | return 0; | 405 | return 0; |
403 | return lowerdev->ethtool_ops->get_flags(lowerdev); | 406 | return lowerdev->ethtool_ops->get_flags(lowerdev); |
404 | } | 407 | } |
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c index eda72dd2120f..510633fd57f6 100644 --- a/drivers/net/mlx4/en_main.c +++ b/drivers/net/mlx4/en_main.c | |||
@@ -181,7 +181,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev) | |||
181 | mdev->workqueue = create_singlethread_workqueue("mlx4_en"); | 181 | mdev->workqueue = create_singlethread_workqueue("mlx4_en"); |
182 | if (!mdev->workqueue) { | 182 | if (!mdev->workqueue) { |
183 | err = -ENOMEM; | 183 | err = -ENOMEM; |
184 | goto err_close_nic; | 184 | goto err_mr; |
185 | } | 185 | } |
186 | 186 | ||
187 | /* At this stage all non-port specific tasks are complete: | 187 | /* At this stage all non-port specific tasks are complete: |
@@ -214,9 +214,8 @@ err_free_netdev: | |||
214 | flush_workqueue(mdev->workqueue); | 214 | flush_workqueue(mdev->workqueue); |
215 | 215 | ||
216 | /* Stop event queue before we drop down to release shared SW state */ | 216 | /* Stop event queue before we drop down to release shared SW state */ |
217 | |||
218 | err_close_nic: | ||
219 | destroy_workqueue(mdev->workqueue); | 217 | destroy_workqueue(mdev->workqueue); |
218 | |||
220 | err_mr: | 219 | err_mr: |
221 | mlx4_mr_free(dev, &mdev->mr); | 220 | mlx4_mr_free(dev, &mdev->mr); |
222 | err_uar: | 221 | err_uar: |
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c index 303c23de6cac..438678ab2a10 100644 --- a/drivers/net/mlx4/en_netdev.c +++ b/drivers/net/mlx4/en_netdev.c | |||
@@ -348,11 +348,9 @@ static void mlx4_en_tx_timeout(struct net_device *dev) | |||
348 | if (netif_msg_timer(priv)) | 348 | if (netif_msg_timer(priv)) |
349 | mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port); | 349 | mlx4_warn(mdev, "Tx timeout called on port:%d\n", priv->port); |
350 | 350 | ||
351 | if (netif_carrier_ok(dev)) { | 351 | priv->port_stats.tx_timeout++; |
352 | priv->port_stats.tx_timeout++; | 352 | mlx4_dbg(DRV, priv, "Scheduling watchdog\n"); |
353 | mlx4_dbg(DRV, priv, "Scheduling watchdog\n"); | 353 | queue_work(mdev->workqueue, &priv->watchdog_task); |
354 | queue_work(mdev->workqueue, &priv->watchdog_task); | ||
355 | } | ||
356 | } | 354 | } |
357 | 355 | ||
358 | 356 | ||
@@ -761,9 +759,14 @@ static void mlx4_en_restart(struct work_struct *work) | |||
761 | struct net_device *dev = priv->dev; | 759 | struct net_device *dev = priv->dev; |
762 | 760 | ||
763 | mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port); | 761 | mlx4_dbg(DRV, priv, "Watchdog task called for port %d\n", priv->port); |
764 | mlx4_en_stop_port(dev); | 762 | |
765 | if (mlx4_en_start_port(dev)) | 763 | mutex_lock(&mdev->state_lock); |
766 | mlx4_err(mdev, "Failed restarting port %d\n", priv->port); | 764 | if (priv->port_up) { |
765 | mlx4_en_stop_port(dev); | ||
766 | if (mlx4_en_start_port(dev)) | ||
767 | mlx4_err(mdev, "Failed restarting port %d\n", priv->port); | ||
768 | } | ||
769 | mutex_unlock(&mdev->state_lock); | ||
767 | } | 770 | } |
768 | 771 | ||
769 | 772 | ||
@@ -1054,7 +1057,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
1054 | * Set driver features | 1057 | * Set driver features |
1055 | */ | 1058 | */ |
1056 | dev->features |= NETIF_F_SG; | 1059 | dev->features |= NETIF_F_SG; |
1057 | dev->features |= NETIF_F_HW_CSUM; | 1060 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
1058 | dev->features |= NETIF_F_HIGHDMA; | 1061 | dev->features |= NETIF_F_HIGHDMA; |
1059 | dev->features |= NETIF_F_HW_VLAN_TX | | 1062 | dev->features |= NETIF_F_HW_VLAN_TX | |
1060 | NETIF_F_HW_VLAN_RX | | 1063 | NETIF_F_HW_VLAN_RX | |
diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c index c5a4c0389752..a29abe845d2e 100644 --- a/drivers/net/mlx4/en_port.c +++ b/drivers/net/mlx4/en_port.c | |||
@@ -151,6 +151,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
151 | struct mlx4_cmd_mailbox *mailbox; | 151 | struct mlx4_cmd_mailbox *mailbox; |
152 | u64 in_mod = reset << 8 | port; | 152 | u64 in_mod = reset << 8 | port; |
153 | int err; | 153 | int err; |
154 | int i; | ||
154 | 155 | ||
155 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); | 156 | mailbox = mlx4_alloc_cmd_mailbox(mdev->dev); |
156 | if (IS_ERR(mailbox)) | 157 | if (IS_ERR(mailbox)) |
@@ -165,38 +166,18 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) | |||
165 | 166 | ||
166 | spin_lock_bh(&priv->stats_lock); | 167 | spin_lock_bh(&priv->stats_lock); |
167 | 168 | ||
168 | stats->rx_packets = be32_to_cpu(mlx4_en_stats->RTOTFRMS) - | 169 | stats->rx_packets = 0; |
169 | be32_to_cpu(mlx4_en_stats->RDROP); | 170 | stats->rx_bytes = 0; |
170 | stats->tx_packets = be64_to_cpu(mlx4_en_stats->TTOT_prio_0) + | 171 | for (i = 0; i < priv->rx_ring_num; i++) { |
171 | be64_to_cpu(mlx4_en_stats->TTOT_prio_1) + | 172 | stats->rx_packets += priv->rx_ring[i].packets; |
172 | be64_to_cpu(mlx4_en_stats->TTOT_prio_2) + | 173 | stats->rx_bytes += priv->rx_ring[i].bytes; |
173 | be64_to_cpu(mlx4_en_stats->TTOT_prio_3) + | 174 | } |
174 | be64_to_cpu(mlx4_en_stats->TTOT_prio_4) + | 175 | stats->tx_packets = 0; |
175 | be64_to_cpu(mlx4_en_stats->TTOT_prio_5) + | 176 | stats->tx_bytes = 0; |
176 | be64_to_cpu(mlx4_en_stats->TTOT_prio_6) + | 177 | for (i = 0; i <= priv->tx_ring_num; i++) { |
177 | be64_to_cpu(mlx4_en_stats->TTOT_prio_7) + | 178 | stats->tx_packets += priv->tx_ring[i].packets; |
178 | be64_to_cpu(mlx4_en_stats->TTOT_novlan) + | 179 | stats->tx_bytes += priv->tx_ring[i].bytes; |
179 | be64_to_cpu(mlx4_en_stats->TTOT_loopbk); | 180 | } |
180 | stats->rx_bytes = be64_to_cpu(mlx4_en_stats->ROCT_prio_0) + | ||
181 | be64_to_cpu(mlx4_en_stats->ROCT_prio_1) + | ||
182 | be64_to_cpu(mlx4_en_stats->ROCT_prio_2) + | ||
183 | be64_to_cpu(mlx4_en_stats->ROCT_prio_3) + | ||
184 | be64_to_cpu(mlx4_en_stats->ROCT_prio_4) + | ||
185 | be64_to_cpu(mlx4_en_stats->ROCT_prio_5) + | ||
186 | be64_to_cpu(mlx4_en_stats->ROCT_prio_6) + | ||
187 | be64_to_cpu(mlx4_en_stats->ROCT_prio_7) + | ||
188 | be64_to_cpu(mlx4_en_stats->ROCT_novlan); | ||
189 | |||
190 | stats->tx_bytes = be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_0) + | ||
191 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_1) + | ||
192 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_2) + | ||
193 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_3) + | ||
194 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_4) + | ||
195 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_5) + | ||
196 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_6) + | ||
197 | be64_to_cpu(mlx4_en_stats->TTTLOCT_prio_7) + | ||
198 | be64_to_cpu(mlx4_en_stats->TTTLOCT_novlan) + | ||
199 | be64_to_cpu(mlx4_en_stats->TTTLOCT_loopbk); | ||
200 | 181 | ||
201 | stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + | 182 | stats->rx_errors = be64_to_cpu(mlx4_en_stats->PCS) + |
202 | be32_to_cpu(mlx4_en_stats->RdropLength) + | 183 | be32_to_cpu(mlx4_en_stats->RdropLength) + |
diff --git a/drivers/net/mlx4/en_resources.c b/drivers/net/mlx4/en_resources.c index a0545209e507..65ca706c04bb 100644 --- a/drivers/net/mlx4/en_resources.c +++ b/drivers/net/mlx4/en_resources.c | |||
@@ -94,3 +94,9 @@ void mlx4_en_unmap_buffer(struct mlx4_buf *buf) | |||
94 | 94 | ||
95 | vunmap(buf->direct.buf); | 95 | vunmap(buf->direct.buf); |
96 | } | 96 | } |
97 | |||
98 | void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event) | ||
99 | { | ||
100 | return; | ||
101 | } | ||
102 | |||
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index 7e40741fb7d8..0cbb78ca7b29 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c | |||
@@ -436,8 +436,9 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) | |||
436 | /* Initialize page allocators */ | 436 | /* Initialize page allocators */ |
437 | err = mlx4_en_init_allocator(priv, ring); | 437 | err = mlx4_en_init_allocator(priv, ring); |
438 | if (err) { | 438 | if (err) { |
439 | mlx4_err(mdev, "Failed initializing ring allocator\n"); | 439 | mlx4_err(mdev, "Failed initializing ring allocator\n"); |
440 | goto err_allocator; | 440 | ring_ind--; |
441 | goto err_allocator; | ||
441 | } | 442 | } |
442 | 443 | ||
443 | /* Fill Rx buffers */ | 444 | /* Fill Rx buffers */ |
@@ -467,6 +468,7 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) | |||
467 | ring->wqres.db.dma, &ring->srq); | 468 | ring->wqres.db.dma, &ring->srq); |
468 | if (err){ | 469 | if (err){ |
469 | mlx4_err(mdev, "Failed to allocate srq\n"); | 470 | mlx4_err(mdev, "Failed to allocate srq\n"); |
471 | ring_ind--; | ||
470 | goto err_srq; | 472 | goto err_srq; |
471 | } | 473 | } |
472 | ring->srq.event = mlx4_en_srq_event; | 474 | ring->srq.event = mlx4_en_srq_event; |
@@ -926,12 +928,6 @@ void mlx4_en_set_default_rss_map(struct mlx4_en_priv *priv, | |||
926 | } | 928 | } |
927 | } | 929 | } |
928 | 930 | ||
929 | static void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event) | ||
930 | { | ||
931 | return; | ||
932 | } | ||
933 | |||
934 | |||
935 | static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, | 931 | static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, |
936 | int qpn, int srqn, int cqn, | 932 | int qpn, int srqn, int cqn, |
937 | enum mlx4_qp_state *state, | 933 | enum mlx4_qp_state *state, |
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c index 4afd5993e31c..ac6fc499b280 100644 --- a/drivers/net/mlx4/en_tx.c +++ b/drivers/net/mlx4/en_tx.c | |||
@@ -112,6 +112,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, | |||
112 | mlx4_err(mdev, "Failed allocating qp %d\n", ring->qpn); | 112 | mlx4_err(mdev, "Failed allocating qp %d\n", ring->qpn); |
113 | goto err_reserve; | 113 | goto err_reserve; |
114 | } | 114 | } |
115 | ring->qp.event = mlx4_en_sqp_event; | ||
115 | 116 | ||
116 | return 0; | 117 | return 0; |
117 | 118 | ||
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h index e9af32d41ca4..ef840abbcd39 100644 --- a/drivers/net/mlx4/mlx4_en.h +++ b/drivers/net/mlx4/mlx4_en.h | |||
@@ -538,6 +538,7 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget); | |||
538 | void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, | 538 | void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, |
539 | int is_tx, int rss, int qpn, int cqn, int srqn, | 539 | int is_tx, int rss, int qpn, int cqn, int srqn, |
540 | struct mlx4_qp_context *context); | 540 | struct mlx4_qp_context *context); |
541 | void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event); | ||
541 | int mlx4_en_map_buffer(struct mlx4_buf *buf); | 542 | int mlx4_en_map_buffer(struct mlx4_buf *buf); |
542 | void mlx4_en_unmap_buffer(struct mlx4_buf *buf); | 543 | void mlx4_en_unmap_buffer(struct mlx4_buf *buf); |
543 | 544 | ||
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 2fbf9f9ddd37..652a36888361 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1758,7 +1758,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1758 | PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), | 1758 | PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), |
1759 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), | 1759 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), |
1760 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"), | 1760 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"), |
1761 | PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "LA-PCM.cis"), | 1761 | PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "cis/LA-PCM.cis"), |
1762 | PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), | 1762 | PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), |
1763 | PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), | 1763 | PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), |
1764 | PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), | 1764 | PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), |
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index a5ac2bd58b5b..4f3ada622f9b 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -2101,6 +2101,9 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl, | |||
2101 | if (ret) { | 2101 | if (ret) { |
2102 | pr_debug("%s: WEP/WPA setup failed %d\n", __func__, | 2102 | pr_debug("%s: WEP/WPA setup failed %d\n", __func__, |
2103 | ret); | 2103 | ret); |
2104 | ret = -EPERM; | ||
2105 | gelic_wl_send_iwap_event(wl, NULL); | ||
2106 | goto out; | ||
2104 | } | 2107 | } |
2105 | 2108 | ||
2106 | /* start association */ | 2109 | /* start association */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7a837c465960..201be425643a 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -2190,7 +2190,14 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp, | |||
2190 | if (!(tmp & EEPROM_ADDR_COMPLETE)) | 2190 | if (!(tmp & EEPROM_ADDR_COMPLETE)) |
2191 | return -EBUSY; | 2191 | return -EBUSY; |
2192 | 2192 | ||
2193 | *val = tr32(GRC_EEPROM_DATA); | 2193 | tmp = tr32(GRC_EEPROM_DATA); |
2194 | |||
2195 | /* | ||
2196 | * The data will always be opposite the native endian | ||
2197 | * format. Perform a blind byteswap to compensate. | ||
2198 | */ | ||
2199 | *val = swab32(tmp); | ||
2200 | |||
2194 | return 0; | 2201 | return 0; |
2195 | } | 2202 | } |
2196 | 2203 | ||
@@ -10663,7 +10670,13 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp, | |||
10663 | 10670 | ||
10664 | memcpy(&data, buf + i, 4); | 10671 | memcpy(&data, buf + i, 4); |
10665 | 10672 | ||
10666 | tw32(GRC_EEPROM_DATA, be32_to_cpu(data)); | 10673 | /* |
10674 | * The SEEPROM interface expects the data to always be opposite | ||
10675 | * the native endian format. We accomplish this by reversing | ||
10676 | * all the operations that would have been performed on the | ||
10677 | * data from a call to tg3_nvram_read_be32(). | ||
10678 | */ | ||
10679 | tw32(GRC_EEPROM_DATA, swab32(be32_to_cpu(data))); | ||
10667 | 10680 | ||
10668 | val = tr32(GRC_EEPROM_ADDR); | 10681 | val = tr32(GRC_EEPROM_ADDR); |
10669 | tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); | 10682 | tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); |
@@ -12443,13 +12456,8 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
12443 | /* Next, try NVRAM. */ | 12456 | /* Next, try NVRAM. */ |
12444 | if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && | 12457 | if (!tg3_nvram_read_be32(tp, mac_offset + 0, &hi) && |
12445 | !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { | 12458 | !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) { |
12446 | dev->dev_addr[0] = ((hi >> 16) & 0xff); | 12459 | memcpy(&dev->dev_addr[0], ((char *)&hi) + 2, 2); |
12447 | dev->dev_addr[1] = ((hi >> 24) & 0xff); | 12460 | memcpy(&dev->dev_addr[2], (char *)&lo, sizeof(lo)); |
12448 | dev->dev_addr[2] = ((lo >> 0) & 0xff); | ||
12449 | dev->dev_addr[3] = ((lo >> 8) & 0xff); | ||
12450 | dev->dev_addr[4] = ((lo >> 16) & 0xff); | ||
12451 | dev->dev_addr[5] = ((lo >> 24) & 0xff); | ||
12452 | |||
12453 | } | 12461 | } |
12454 | /* Finally just fetch it out of the MAC control regs. */ | 12462 | /* Finally just fetch it out of the MAC control regs. */ |
12455 | else { | 12463 | else { |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 16716aef184c..735bf41c654a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -93,7 +93,6 @@ struct tun_file { | |||
93 | atomic_t count; | 93 | atomic_t count; |
94 | struct tun_struct *tun; | 94 | struct tun_struct *tun; |
95 | struct net *net; | 95 | struct net *net; |
96 | wait_queue_head_t read_wait; | ||
97 | }; | 96 | }; |
98 | 97 | ||
99 | struct tun_sock; | 98 | struct tun_sock; |
@@ -156,6 +155,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file) | |||
156 | tfile->tun = tun; | 155 | tfile->tun = tun; |
157 | tun->tfile = tfile; | 156 | tun->tfile = tfile; |
158 | dev_hold(tun->dev); | 157 | dev_hold(tun->dev); |
158 | sock_hold(tun->sk); | ||
159 | atomic_inc(&tfile->count); | 159 | atomic_inc(&tfile->count); |
160 | 160 | ||
161 | out: | 161 | out: |
@@ -165,11 +165,8 @@ out: | |||
165 | 165 | ||
166 | static void __tun_detach(struct tun_struct *tun) | 166 | static void __tun_detach(struct tun_struct *tun) |
167 | { | 167 | { |
168 | struct tun_file *tfile = tun->tfile; | ||
169 | |||
170 | /* Detach from net device */ | 168 | /* Detach from net device */ |
171 | netif_tx_lock_bh(tun->dev); | 169 | netif_tx_lock_bh(tun->dev); |
172 | tfile->tun = NULL; | ||
173 | tun->tfile = NULL; | 170 | tun->tfile = NULL; |
174 | netif_tx_unlock_bh(tun->dev); | 171 | netif_tx_unlock_bh(tun->dev); |
175 | 172 | ||
@@ -333,12 +330,19 @@ static void tun_net_uninit(struct net_device *dev) | |||
333 | /* Inform the methods they need to stop using the dev. | 330 | /* Inform the methods they need to stop using the dev. |
334 | */ | 331 | */ |
335 | if (tfile) { | 332 | if (tfile) { |
336 | wake_up_all(&tfile->read_wait); | 333 | wake_up_all(&tun->socket.wait); |
337 | if (atomic_dec_and_test(&tfile->count)) | 334 | if (atomic_dec_and_test(&tfile->count)) |
338 | __tun_detach(tun); | 335 | __tun_detach(tun); |
339 | } | 336 | } |
340 | } | 337 | } |
341 | 338 | ||
339 | static void tun_free_netdev(struct net_device *dev) | ||
340 | { | ||
341 | struct tun_struct *tun = netdev_priv(dev); | ||
342 | |||
343 | sock_put(tun->sk); | ||
344 | } | ||
345 | |||
342 | /* Net device open. */ | 346 | /* Net device open. */ |
343 | static int tun_net_open(struct net_device *dev) | 347 | static int tun_net_open(struct net_device *dev) |
344 | { | 348 | { |
@@ -393,7 +397,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev) | |||
393 | /* Notify and wake up reader process */ | 397 | /* Notify and wake up reader process */ |
394 | if (tun->flags & TUN_FASYNC) | 398 | if (tun->flags & TUN_FASYNC) |
395 | kill_fasync(&tun->fasync, SIGIO, POLL_IN); | 399 | kill_fasync(&tun->fasync, SIGIO, POLL_IN); |
396 | wake_up_interruptible(&tun->tfile->read_wait); | 400 | wake_up_interruptible(&tun->socket.wait); |
397 | return 0; | 401 | return 0; |
398 | 402 | ||
399 | drop: | 403 | drop: |
@@ -490,7 +494,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait) | |||
490 | 494 | ||
491 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); | 495 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); |
492 | 496 | ||
493 | poll_wait(file, &tfile->read_wait, wait); | 497 | poll_wait(file, &tun->socket.wait, wait); |
494 | 498 | ||
495 | if (!skb_queue_empty(&tun->readq)) | 499 | if (!skb_queue_empty(&tun->readq)) |
496 | mask |= POLLIN | POLLRDNORM; | 500 | mask |= POLLIN | POLLRDNORM; |
@@ -763,7 +767,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
763 | goto out; | 767 | goto out; |
764 | } | 768 | } |
765 | 769 | ||
766 | add_wait_queue(&tfile->read_wait, &wait); | 770 | add_wait_queue(&tun->socket.wait, &wait); |
767 | while (len) { | 771 | while (len) { |
768 | current->state = TASK_INTERRUPTIBLE; | 772 | current->state = TASK_INTERRUPTIBLE; |
769 | 773 | ||
@@ -794,7 +798,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
794 | } | 798 | } |
795 | 799 | ||
796 | current->state = TASK_RUNNING; | 800 | current->state = TASK_RUNNING; |
797 | remove_wait_queue(&tfile->read_wait, &wait); | 801 | remove_wait_queue(&tun->socket.wait, &wait); |
798 | 802 | ||
799 | out: | 803 | out: |
800 | tun_put(tun); | 804 | tun_put(tun); |
@@ -811,7 +815,7 @@ static void tun_setup(struct net_device *dev) | |||
811 | tun->group = -1; | 815 | tun->group = -1; |
812 | 816 | ||
813 | dev->ethtool_ops = &tun_ethtool_ops; | 817 | dev->ethtool_ops = &tun_ethtool_ops; |
814 | dev->destructor = free_netdev; | 818 | dev->destructor = tun_free_netdev; |
815 | } | 819 | } |
816 | 820 | ||
817 | /* Trivial set of netlink ops to allow deleting tun or tap | 821 | /* Trivial set of netlink ops to allow deleting tun or tap |
@@ -848,7 +852,7 @@ static void tun_sock_write_space(struct sock *sk) | |||
848 | 852 | ||
849 | static void tun_sock_destruct(struct sock *sk) | 853 | static void tun_sock_destruct(struct sock *sk) |
850 | { | 854 | { |
851 | dev_put(container_of(sk, struct tun_sock, sk)->tun->dev); | 855 | free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev); |
852 | } | 856 | } |
853 | 857 | ||
854 | static struct proto tun_proto = { | 858 | static struct proto tun_proto = { |
@@ -862,7 +866,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
862 | struct sock *sk; | 866 | struct sock *sk; |
863 | struct tun_struct *tun; | 867 | struct tun_struct *tun; |
864 | struct net_device *dev; | 868 | struct net_device *dev; |
865 | struct tun_file *tfile = file->private_data; | ||
866 | int err; | 869 | int err; |
867 | 870 | ||
868 | dev = __dev_get_by_name(net, ifr->ifr_name); | 871 | dev = __dev_get_by_name(net, ifr->ifr_name); |
@@ -920,13 +923,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
920 | if (!sk) | 923 | if (!sk) |
921 | goto err_free_dev; | 924 | goto err_free_dev; |
922 | 925 | ||
923 | /* This ref count is for tun->sk. */ | 926 | init_waitqueue_head(&tun->socket.wait); |
924 | dev_hold(dev); | ||
925 | sock_init_data(&tun->socket, sk); | 927 | sock_init_data(&tun->socket, sk); |
926 | sk->sk_write_space = tun_sock_write_space; | 928 | sk->sk_write_space = tun_sock_write_space; |
927 | sk->sk_destruct = tun_sock_destruct; | ||
928 | sk->sk_sndbuf = INT_MAX; | 929 | sk->sk_sndbuf = INT_MAX; |
929 | sk->sk_sleep = &tfile->read_wait; | ||
930 | 930 | ||
931 | tun->sk = sk; | 931 | tun->sk = sk; |
932 | container_of(sk, struct tun_sock, sk)->tun = tun; | 932 | container_of(sk, struct tun_sock, sk)->tun = tun; |
@@ -942,11 +942,13 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
942 | err = -EINVAL; | 942 | err = -EINVAL; |
943 | err = register_netdevice(tun->dev); | 943 | err = register_netdevice(tun->dev); |
944 | if (err < 0) | 944 | if (err < 0) |
945 | goto err_free_dev; | 945 | goto err_free_sk; |
946 | |||
947 | sk->sk_destruct = tun_sock_destruct; | ||
946 | 948 | ||
947 | err = tun_attach(tun, file); | 949 | err = tun_attach(tun, file); |
948 | if (err < 0) | 950 | if (err < 0) |
949 | goto err_free_dev; | 951 | goto failed; |
950 | } | 952 | } |
951 | 953 | ||
952 | DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name); | 954 | DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name); |
@@ -1266,7 +1268,6 @@ static int tun_chr_open(struct inode *inode, struct file * file) | |||
1266 | atomic_set(&tfile->count, 0); | 1268 | atomic_set(&tfile->count, 0); |
1267 | tfile->tun = NULL; | 1269 | tfile->tun = NULL; |
1268 | tfile->net = get_net(current->nsproxy->net_ns); | 1270 | tfile->net = get_net(current->nsproxy->net_ns); |
1269 | init_waitqueue_head(&tfile->read_wait); | ||
1270 | file->private_data = tfile; | 1271 | file->private_data = tfile; |
1271 | return 0; | 1272 | return 0; |
1272 | } | 1273 | } |
@@ -1284,14 +1285,16 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
1284 | __tun_detach(tun); | 1285 | __tun_detach(tun); |
1285 | 1286 | ||
1286 | /* If desireable, unregister the netdevice. */ | 1287 | /* If desireable, unregister the netdevice. */ |
1287 | if (!(tun->flags & TUN_PERSIST)) { | 1288 | if (!(tun->flags & TUN_PERSIST)) |
1288 | sock_put(tun->sk); | ||
1289 | unregister_netdevice(tun->dev); | 1289 | unregister_netdevice(tun->dev); |
1290 | } | ||
1291 | 1290 | ||
1292 | rtnl_unlock(); | 1291 | rtnl_unlock(); |
1293 | } | 1292 | } |
1294 | 1293 | ||
1294 | tun = tfile->tun; | ||
1295 | if (tun) | ||
1296 | sock_put(tun->sk); | ||
1297 | |||
1295 | put_net(tfile->net); | 1298 | put_net(tfile->net); |
1296 | kfree(tfile); | 1299 | kfree(tfile); |
1297 | 1300 | ||
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index d3f39e86eb95..44f8392da117 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -1394,7 +1394,8 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth) | |||
1394 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || | 1394 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
1395 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || | 1395 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) || |
1396 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { | 1396 | (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) { |
1397 | upsmr |= UCC_GETH_UPSMR_RPM; | 1397 | if (ugeth->phy_interface != PHY_INTERFACE_MODE_RMII) |
1398 | upsmr |= UCC_GETH_UPSMR_RPM; | ||
1398 | switch (ugeth->max_speed) { | 1399 | switch (ugeth->max_speed) { |
1399 | case SPEED_10: | 1400 | case SPEED_10: |
1400 | upsmr |= UCC_GETH_UPSMR_R10M; | 1401 | upsmr |= UCC_GETH_UPSMR_R10M; |
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index a8228d87c8cf..2138535f2339 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -899,6 +899,7 @@ static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
899 | /* cleanup should already have been scheduled */ | 899 | /* cleanup should already have been scheduled */ |
900 | break; | 900 | break; |
901 | case -ENODEV: /* disconnect() upcoming */ | 901 | case -ENODEV: /* disconnect() upcoming */ |
902 | case -EPERM: | ||
902 | netif_device_detach(pegasus->net); | 903 | netif_device_detach(pegasus->net); |
903 | break; | 904 | break; |
904 | default: | 905 | default: |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index f21a6171c691..c36d3a3d655f 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -6713,11 +6713,11 @@ static int airo_set_auth(struct net_device *dev, | |||
6713 | local->config.authType = AUTH_ENCRYPT; | 6713 | local->config.authType = AUTH_ENCRYPT; |
6714 | } else | 6714 | } else |
6715 | return -EINVAL; | 6715 | return -EINVAL; |
6716 | break; | ||
6717 | 6716 | ||
6718 | /* Commit the changes to flags if needed */ | 6717 | /* Commit the changes to flags if needed */ |
6719 | if (local->config.authType != currentAuthType) | 6718 | if (local->config.authType != currentAuthType) |
6720 | set_bit (FLAG_COMMIT, &local->flags); | 6719 | set_bit (FLAG_COMMIT, &local->flags); |
6720 | break; | ||
6721 | } | 6721 | } |
6722 | 6722 | ||
6723 | case IW_AUTH_WPA_ENABLED: | 6723 | case IW_AUTH_WPA_ENABLED: |
diff --git a/drivers/net/wireless/ar9170/hw.h b/drivers/net/wireless/ar9170/hw.h index 13091bd9d815..53e250a4278f 100644 --- a/drivers/net/wireless/ar9170/hw.h +++ b/drivers/net/wireless/ar9170/hw.h | |||
@@ -310,7 +310,7 @@ struct ar9170_tx_control { | |||
310 | 310 | ||
311 | struct ar9170_rx_head { | 311 | struct ar9170_rx_head { |
312 | u8 plcp[12]; | 312 | u8 plcp[12]; |
313 | }; | 313 | } __packed; |
314 | 314 | ||
315 | struct ar9170_rx_tail { | 315 | struct ar9170_rx_tail { |
316 | union { | 316 | union { |
@@ -318,16 +318,16 @@ struct ar9170_rx_tail { | |||
318 | u8 rssi_ant0, rssi_ant1, rssi_ant2, | 318 | u8 rssi_ant0, rssi_ant1, rssi_ant2, |
319 | rssi_ant0x, rssi_ant1x, rssi_ant2x, | 319 | rssi_ant0x, rssi_ant1x, rssi_ant2x, |
320 | rssi_combined; | 320 | rssi_combined; |
321 | }; | 321 | } __packed; |
322 | u8 rssi[7]; | 322 | u8 rssi[7]; |
323 | }; | 323 | } __packed; |
324 | 324 | ||
325 | u8 evm_stream0[6], evm_stream1[6]; | 325 | u8 evm_stream0[6], evm_stream1[6]; |
326 | u8 phy_err; | 326 | u8 phy_err; |
327 | u8 SAidx, DAidx; | 327 | u8 SAidx, DAidx; |
328 | u8 error; | 328 | u8 error; |
329 | u8 status; | 329 | u8 status; |
330 | }; | 330 | } __packed; |
331 | 331 | ||
332 | #define AR9170_ENC_ALG_NONE 0x0 | 332 | #define AR9170_ENC_ALG_NONE 0x0 |
333 | #define AR9170_ENC_ALG_WEP64 0x1 | 333 | #define AR9170_ENC_ALG_WEP64 0x1 |
diff --git a/drivers/net/wireless/ar9170/usb.c b/drivers/net/wireless/ar9170/usb.c index ad296840893e..fddda477095c 100644 --- a/drivers/net/wireless/ar9170/usb.c +++ b/drivers/net/wireless/ar9170/usb.c | |||
@@ -59,6 +59,8 @@ static struct usb_device_id ar9170_usb_ids[] = { | |||
59 | { USB_DEVICE(0x0cf3, 0x9170) }, | 59 | { USB_DEVICE(0x0cf3, 0x9170) }, |
60 | /* Atheros TG121N */ | 60 | /* Atheros TG121N */ |
61 | { USB_DEVICE(0x0cf3, 0x1001) }, | 61 | { USB_DEVICE(0x0cf3, 0x1001) }, |
62 | /* Cace Airpcap NX */ | ||
63 | { USB_DEVICE(0xcace, 0x0300) }, | ||
62 | /* D-Link DWA 160A */ | 64 | /* D-Link DWA 160A */ |
63 | { USB_DEVICE(0x07d1, 0x3c10) }, | 65 | { USB_DEVICE(0x07d1, 0x3c10) }, |
64 | /* Netgear WNDA3100 */ | 66 | /* Netgear WNDA3100 */ |
@@ -67,6 +69,8 @@ static struct usb_device_id ar9170_usb_ids[] = { | |||
67 | { USB_DEVICE(0x0846, 0x9001) }, | 69 | { USB_DEVICE(0x0846, 0x9001) }, |
68 | /* Zydas ZD1221 */ | 70 | /* Zydas ZD1221 */ |
69 | { USB_DEVICE(0x0ace, 0x1221) }, | 71 | { USB_DEVICE(0x0ace, 0x1221) }, |
72 | /* ZyXEL NWD271N */ | ||
73 | { USB_DEVICE(0x0586, 0x3417) }, | ||
70 | /* Z-Com UB81 BG */ | 74 | /* Z-Com UB81 BG */ |
71 | { USB_DEVICE(0x0cde, 0x0023) }, | 75 | { USB_DEVICE(0x0cde, 0x0023) }, |
72 | /* Z-Com UB82 ABG */ | 76 | /* Z-Com UB82 ABG */ |
@@ -619,6 +623,39 @@ static int ar9170_usb_open(struct ar9170 *ar) | |||
619 | return 0; | 623 | return 0; |
620 | } | 624 | } |
621 | 625 | ||
626 | static int ar9170_usb_init_device(struct ar9170_usb *aru) | ||
627 | { | ||
628 | int err; | ||
629 | |||
630 | err = ar9170_usb_alloc_rx_irq_urb(aru); | ||
631 | if (err) | ||
632 | goto err_out; | ||
633 | |||
634 | err = ar9170_usb_alloc_rx_bulk_urbs(aru); | ||
635 | if (err) | ||
636 | goto err_unrx; | ||
637 | |||
638 | err = ar9170_usb_upload_firmware(aru); | ||
639 | if (err) { | ||
640 | err = ar9170_echo_test(&aru->common, 0x60d43110); | ||
641 | if (err) { | ||
642 | /* force user invention, by disabling the device */ | ||
643 | err = usb_driver_set_configuration(aru->udev, -1); | ||
644 | dev_err(&aru->udev->dev, "device is in a bad state. " | ||
645 | "please reconnect it!\n"); | ||
646 | goto err_unrx; | ||
647 | } | ||
648 | } | ||
649 | |||
650 | return 0; | ||
651 | |||
652 | err_unrx: | ||
653 | ar9170_usb_cancel_urbs(aru); | ||
654 | |||
655 | err_out: | ||
656 | return err; | ||
657 | } | ||
658 | |||
622 | static int ar9170_usb_probe(struct usb_interface *intf, | 659 | static int ar9170_usb_probe(struct usb_interface *intf, |
623 | const struct usb_device_id *id) | 660 | const struct usb_device_id *id) |
624 | { | 661 | { |
@@ -654,32 +691,16 @@ static int ar9170_usb_probe(struct usb_interface *intf, | |||
654 | 691 | ||
655 | err = ar9170_usb_reset(aru); | 692 | err = ar9170_usb_reset(aru); |
656 | if (err) | 693 | if (err) |
657 | goto err_unlock; | 694 | goto err_freehw; |
658 | 695 | ||
659 | err = ar9170_usb_request_firmware(aru); | 696 | err = ar9170_usb_request_firmware(aru); |
660 | if (err) | 697 | if (err) |
661 | goto err_unlock; | 698 | goto err_freehw; |
662 | 699 | ||
663 | err = ar9170_usb_alloc_rx_irq_urb(aru); | 700 | err = ar9170_usb_init_device(aru); |
664 | if (err) | 701 | if (err) |
665 | goto err_freefw; | 702 | goto err_freefw; |
666 | 703 | ||
667 | err = ar9170_usb_alloc_rx_bulk_urbs(aru); | ||
668 | if (err) | ||
669 | goto err_unrx; | ||
670 | |||
671 | err = ar9170_usb_upload_firmware(aru); | ||
672 | if (err) { | ||
673 | err = ar9170_echo_test(&aru->common, 0x60d43110); | ||
674 | if (err) { | ||
675 | /* force user invention, by disabling the device */ | ||
676 | err = usb_driver_set_configuration(aru->udev, -1); | ||
677 | dev_err(&aru->udev->dev, "device is in a bad state. " | ||
678 | "please reconnect it!\n"); | ||
679 | goto err_unrx; | ||
680 | } | ||
681 | } | ||
682 | |||
683 | err = ar9170_usb_open(ar); | 704 | err = ar9170_usb_open(ar); |
684 | if (err) | 705 | if (err) |
685 | goto err_unrx; | 706 | goto err_unrx; |
@@ -699,7 +720,7 @@ err_freefw: | |||
699 | release_firmware(aru->init_values); | 720 | release_firmware(aru->init_values); |
700 | release_firmware(aru->firmware); | 721 | release_firmware(aru->firmware); |
701 | 722 | ||
702 | err_unlock: | 723 | err_freehw: |
703 | usb_set_intfdata(intf, NULL); | 724 | usb_set_intfdata(intf, NULL); |
704 | usb_put_dev(udev); | 725 | usb_put_dev(udev); |
705 | ieee80211_free_hw(ar->hw); | 726 | ieee80211_free_hw(ar->hw); |
@@ -726,12 +747,65 @@ static void ar9170_usb_disconnect(struct usb_interface *intf) | |||
726 | ieee80211_free_hw(aru->common.hw); | 747 | ieee80211_free_hw(aru->common.hw); |
727 | } | 748 | } |
728 | 749 | ||
750 | #ifdef CONFIG_PM | ||
751 | static int ar9170_suspend(struct usb_interface *intf, | ||
752 | pm_message_t message) | ||
753 | { | ||
754 | struct ar9170_usb *aru = usb_get_intfdata(intf); | ||
755 | |||
756 | if (!aru) | ||
757 | return -ENODEV; | ||
758 | |||
759 | aru->common.state = AR9170_IDLE; | ||
760 | ar9170_usb_cancel_urbs(aru); | ||
761 | |||
762 | return 0; | ||
763 | } | ||
764 | |||
765 | static int ar9170_resume(struct usb_interface *intf) | ||
766 | { | ||
767 | struct ar9170_usb *aru = usb_get_intfdata(intf); | ||
768 | int err; | ||
769 | |||
770 | if (!aru) | ||
771 | return -ENODEV; | ||
772 | |||
773 | usb_unpoison_anchored_urbs(&aru->rx_submitted); | ||
774 | usb_unpoison_anchored_urbs(&aru->tx_submitted); | ||
775 | |||
776 | /* | ||
777 | * FIXME: firmware upload will fail on resume. | ||
778 | * but this is better than a hang! | ||
779 | */ | ||
780 | |||
781 | err = ar9170_usb_init_device(aru); | ||
782 | if (err) | ||
783 | goto err_unrx; | ||
784 | |||
785 | err = ar9170_usb_open(&aru->common); | ||
786 | if (err) | ||
787 | goto err_unrx; | ||
788 | |||
789 | return 0; | ||
790 | |||
791 | err_unrx: | ||
792 | aru->common.state = AR9170_IDLE; | ||
793 | ar9170_usb_cancel_urbs(aru); | ||
794 | |||
795 | return err; | ||
796 | } | ||
797 | #endif /* CONFIG_PM */ | ||
798 | |||
729 | static struct usb_driver ar9170_driver = { | 799 | static struct usb_driver ar9170_driver = { |
730 | .name = "ar9170usb", | 800 | .name = "ar9170usb", |
731 | .probe = ar9170_usb_probe, | 801 | .probe = ar9170_usb_probe, |
732 | .disconnect = ar9170_usb_disconnect, | 802 | .disconnect = ar9170_usb_disconnect, |
733 | .id_table = ar9170_usb_ids, | 803 | .id_table = ar9170_usb_ids, |
734 | .soft_unbind = 1, | 804 | .soft_unbind = 1, |
805 | #ifdef CONFIG_PM | ||
806 | .suspend = ar9170_suspend, | ||
807 | .resume = ar9170_resume, | ||
808 | #endif /* CONFIG_PM */ | ||
735 | }; | 809 | }; |
736 | 810 | ||
737 | static int __init ar9170_init(void) | 811 | static int __init ar9170_init(void) |
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 0c02f1c2bd94..744f4f4dd3d1 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -250,6 +250,8 @@ static struct usb_device_id dev_table[] = { | |||
250 | { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) }, | 250 | { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) }, |
251 | /* Siemens Gigaset USB WLAN Adapter 11 */ | 251 | /* Siemens Gigaset USB WLAN Adapter 11 */ |
252 | { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) }, | 252 | { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) }, |
253 | /* OQO Model 01+ Internal Wi-Fi */ | ||
254 | { USB_DEVICE(0x1557, 0x0002), USB_DEVICE_DATA(BOARD_505A) }, | ||
253 | /* | 255 | /* |
254 | * at76c505amx-rfmd | 256 | * at76c505amx-rfmd |
255 | */ | 257 | */ |
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 71cb18d6757d..dd1f30156740 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -493,6 +493,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
493 | int hdrlen, padsize, retval; | 493 | int hdrlen, padsize, retval; |
494 | bool decrypt_error = false; | 494 | bool decrypt_error = false; |
495 | u8 keyix; | 495 | u8 keyix; |
496 | __le16 fc; | ||
496 | 497 | ||
497 | spin_lock_bh(&sc->rx.rxbuflock); | 498 | spin_lock_bh(&sc->rx.rxbuflock); |
498 | 499 | ||
@@ -606,6 +607,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
606 | /* see if any padding is done by the hw and remove it */ | 607 | /* see if any padding is done by the hw and remove it */ |
607 | hdr = (struct ieee80211_hdr *)skb->data; | 608 | hdr = (struct ieee80211_hdr *)skb->data; |
608 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 609 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
610 | fc = hdr->frame_control; | ||
609 | 611 | ||
610 | /* The MAC header is padded to have 32-bit boundary if the | 612 | /* The MAC header is padded to have 32-bit boundary if the |
611 | * packet payload is non-zero. The general calculation for | 613 | * packet payload is non-zero. The general calculation for |
@@ -690,7 +692,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
690 | sc->rx.rxotherant = 0; | 692 | sc->rx.rxotherant = 0; |
691 | } | 693 | } |
692 | 694 | ||
693 | if (ieee80211_is_beacon(hdr->frame_control) && | 695 | if (ieee80211_is_beacon(fc) && |
694 | (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) { | 696 | (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) { |
695 | sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON; | 697 | sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON; |
696 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); | 698 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 857d84148b1d..27eef8fb7107 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -1502,7 +1502,6 @@ static const struct net_device_ops atmel_netdev_ops = { | |||
1502 | .ndo_set_mac_address = atmel_set_mac_address, | 1502 | .ndo_set_mac_address = atmel_set_mac_address, |
1503 | .ndo_start_xmit = start_tx, | 1503 | .ndo_start_xmit = start_tx, |
1504 | .ndo_do_ioctl = atmel_ioctl, | 1504 | .ndo_do_ioctl = atmel_ioctl, |
1505 | .ndo_change_mtu = eth_change_mtu, | ||
1506 | .ndo_validate_addr = eth_validate_addr, | 1505 | .ndo_validate_addr = eth_validate_addr, |
1507 | }; | 1506 | }; |
1508 | 1507 | ||
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index e228c1de6e11..eae680b53052 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -555,11 +555,32 @@ address_error: | |||
555 | return 1; | 555 | return 1; |
556 | } | 556 | } |
557 | 557 | ||
558 | static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) | ||
559 | { | ||
560 | unsigned char *f = skb->data + ring->frameoffset; | ||
561 | |||
562 | return ((f[0] & f[1] & f[2] & f[3] & f[4] & f[5] & f[6] & f[7]) == 0xFF); | ||
563 | } | ||
564 | |||
565 | static void b43_poison_rx_buffer(struct b43_dmaring *ring, struct sk_buff *skb) | ||
566 | { | ||
567 | struct b43_rxhdr_fw4 *rxhdr; | ||
568 | unsigned char *frame; | ||
569 | |||
570 | /* This poisons the RX buffer to detect DMA failures. */ | ||
571 | |||
572 | rxhdr = (struct b43_rxhdr_fw4 *)(skb->data); | ||
573 | rxhdr->frame_len = 0; | ||
574 | |||
575 | B43_WARN_ON(ring->rx_buffersize < ring->frameoffset + sizeof(struct b43_plcp_hdr6) + 2); | ||
576 | frame = skb->data + ring->frameoffset; | ||
577 | memset(frame, 0xFF, sizeof(struct b43_plcp_hdr6) + 2 /* padding */); | ||
578 | } | ||
579 | |||
558 | static int setup_rx_descbuffer(struct b43_dmaring *ring, | 580 | static int setup_rx_descbuffer(struct b43_dmaring *ring, |
559 | struct b43_dmadesc_generic *desc, | 581 | struct b43_dmadesc_generic *desc, |
560 | struct b43_dmadesc_meta *meta, gfp_t gfp_flags) | 582 | struct b43_dmadesc_meta *meta, gfp_t gfp_flags) |
561 | { | 583 | { |
562 | struct b43_rxhdr_fw4 *rxhdr; | ||
563 | dma_addr_t dmaaddr; | 584 | dma_addr_t dmaaddr; |
564 | struct sk_buff *skb; | 585 | struct sk_buff *skb; |
565 | 586 | ||
@@ -568,6 +589,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
568 | skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); | 589 | skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); |
569 | if (unlikely(!skb)) | 590 | if (unlikely(!skb)) |
570 | return -ENOMEM; | 591 | return -ENOMEM; |
592 | b43_poison_rx_buffer(ring, skb); | ||
571 | dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); | 593 | dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); |
572 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { | 594 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { |
573 | /* ugh. try to realloc in zone_dma */ | 595 | /* ugh. try to realloc in zone_dma */ |
@@ -578,6 +600,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
578 | skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); | 600 | skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); |
579 | if (unlikely(!skb)) | 601 | if (unlikely(!skb)) |
580 | return -ENOMEM; | 602 | return -ENOMEM; |
603 | b43_poison_rx_buffer(ring, skb); | ||
581 | dmaaddr = map_descbuffer(ring, skb->data, | 604 | dmaaddr = map_descbuffer(ring, skb->data, |
582 | ring->rx_buffersize, 0); | 605 | ring->rx_buffersize, 0); |
583 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { | 606 | if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { |
@@ -592,9 +615,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring, | |||
592 | ring->ops->fill_descriptor(ring, desc, dmaaddr, | 615 | ring->ops->fill_descriptor(ring, desc, dmaaddr, |
593 | ring->rx_buffersize, 0, 0, 0); | 616 | ring->rx_buffersize, 0, 0, 0); |
594 | 617 | ||
595 | rxhdr = (struct b43_rxhdr_fw4 *)(skb->data); | ||
596 | rxhdr->frame_len = 0; | ||
597 | |||
598 | return 0; | 618 | return 0; |
599 | } | 619 | } |
600 | 620 | ||
@@ -1483,12 +1503,17 @@ static void dma_rx(struct b43_dmaring *ring, int *slot) | |||
1483 | len = le16_to_cpu(rxhdr->frame_len); | 1503 | len = le16_to_cpu(rxhdr->frame_len); |
1484 | } while (len == 0 && i++ < 5); | 1504 | } while (len == 0 && i++ < 5); |
1485 | if (unlikely(len == 0)) { | 1505 | if (unlikely(len == 0)) { |
1486 | /* recycle the descriptor buffer. */ | 1506 | dmaaddr = meta->dmaaddr; |
1487 | sync_descbuffer_for_device(ring, meta->dmaaddr, | 1507 | goto drop_recycle_buffer; |
1488 | ring->rx_buffersize); | ||
1489 | goto drop; | ||
1490 | } | 1508 | } |
1491 | } | 1509 | } |
1510 | if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) { | ||
1511 | /* Something went wrong with the DMA. | ||
1512 | * The device did not touch the buffer and did not overwrite the poison. */ | ||
1513 | b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n"); | ||
1514 | dmaaddr = meta->dmaaddr; | ||
1515 | goto drop_recycle_buffer; | ||
1516 | } | ||
1492 | if (unlikely(len > ring->rx_buffersize)) { | 1517 | if (unlikely(len > ring->rx_buffersize)) { |
1493 | /* The data did not fit into one descriptor buffer | 1518 | /* The data did not fit into one descriptor buffer |
1494 | * and is split over multiple buffers. | 1519 | * and is split over multiple buffers. |
@@ -1501,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot) | |||
1501 | while (1) { | 1526 | while (1) { |
1502 | desc = ops->idx2desc(ring, *slot, &meta); | 1527 | desc = ops->idx2desc(ring, *slot, &meta); |
1503 | /* recycle the descriptor buffer. */ | 1528 | /* recycle the descriptor buffer. */ |
1529 | b43_poison_rx_buffer(ring, meta->skb); | ||
1504 | sync_descbuffer_for_device(ring, meta->dmaaddr, | 1530 | sync_descbuffer_for_device(ring, meta->dmaaddr, |
1505 | ring->rx_buffersize); | 1531 | ring->rx_buffersize); |
1506 | *slot = next_slot(ring, *slot); | 1532 | *slot = next_slot(ring, *slot); |
@@ -1519,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot) | |||
1519 | err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); | 1545 | err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); |
1520 | if (unlikely(err)) { | 1546 | if (unlikely(err)) { |
1521 | b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); | 1547 | b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); |
1522 | sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); | 1548 | goto drop_recycle_buffer; |
1523 | goto drop; | ||
1524 | } | 1549 | } |
1525 | 1550 | ||
1526 | unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); | 1551 | unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); |
@@ -1530,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *ring, int *slot) | |||
1530 | b43_rx(ring->dev, skb, rxhdr); | 1555 | b43_rx(ring->dev, skb, rxhdr); |
1531 | drop: | 1556 | drop: |
1532 | return; | 1557 | return; |
1558 | |||
1559 | drop_recycle_buffer: | ||
1560 | /* Poison and recycle the RX buffer. */ | ||
1561 | b43_poison_rx_buffer(ring, skb); | ||
1562 | sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); | ||
1533 | } | 1563 | } |
1534 | 1564 | ||
1535 | void b43_dma_rx(struct b43_dmaring *ring) | 1565 | void b43_dma_rx(struct b43_dmaring *ring) |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 4896e0831114..79b685e300c7 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3974,6 +3974,11 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev, | |||
3974 | phy->next_txpwr_check_time = jiffies; | 3974 | phy->next_txpwr_check_time = jiffies; |
3975 | /* PHY TX errors counter. */ | 3975 | /* PHY TX errors counter. */ |
3976 | atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); | 3976 | atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); |
3977 | |||
3978 | #if B43_DEBUG | ||
3979 | phy->phy_locked = 0; | ||
3980 | phy->radio_locked = 0; | ||
3981 | #endif | ||
3977 | } | 3982 | } |
3978 | 3983 | ||
3979 | static void setup_struct_wldev_for_init(struct b43_wldev *dev) | 3984 | static void setup_struct_wldev_for_init(struct b43_wldev *dev) |
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index 026b61c03fb9..e176b6e0d9cf 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -131,12 +131,16 @@ void b43_radio_lock(struct b43_wldev *dev) | |||
131 | { | 131 | { |
132 | u32 macctl; | 132 | u32 macctl; |
133 | 133 | ||
134 | #if B43_DEBUG | ||
135 | B43_WARN_ON(dev->phy.radio_locked); | ||
136 | dev->phy.radio_locked = 1; | ||
137 | #endif | ||
138 | |||
134 | macctl = b43_read32(dev, B43_MMIO_MACCTL); | 139 | macctl = b43_read32(dev, B43_MMIO_MACCTL); |
135 | B43_WARN_ON(macctl & B43_MACCTL_RADIOLOCK); | ||
136 | macctl |= B43_MACCTL_RADIOLOCK; | 140 | macctl |= B43_MACCTL_RADIOLOCK; |
137 | b43_write32(dev, B43_MMIO_MACCTL, macctl); | 141 | b43_write32(dev, B43_MMIO_MACCTL, macctl); |
138 | /* Commit the write and wait for the device | 142 | /* Commit the write and wait for the firmware |
139 | * to exit any radio register access. */ | 143 | * to finish any radio register access. */ |
140 | b43_read32(dev, B43_MMIO_MACCTL); | 144 | b43_read32(dev, B43_MMIO_MACCTL); |
141 | udelay(10); | 145 | udelay(10); |
142 | } | 146 | } |
@@ -145,11 +149,15 @@ void b43_radio_unlock(struct b43_wldev *dev) | |||
145 | { | 149 | { |
146 | u32 macctl; | 150 | u32 macctl; |
147 | 151 | ||
152 | #if B43_DEBUG | ||
153 | B43_WARN_ON(!dev->phy.radio_locked); | ||
154 | dev->phy.radio_locked = 0; | ||
155 | #endif | ||
156 | |||
148 | /* Commit any write */ | 157 | /* Commit any write */ |
149 | b43_read16(dev, B43_MMIO_PHY_VER); | 158 | b43_read16(dev, B43_MMIO_PHY_VER); |
150 | /* unlock */ | 159 | /* unlock */ |
151 | macctl = b43_read32(dev, B43_MMIO_MACCTL); | 160 | macctl = b43_read32(dev, B43_MMIO_MACCTL); |
152 | B43_WARN_ON(!(macctl & B43_MACCTL_RADIOLOCK)); | ||
153 | macctl &= ~B43_MACCTL_RADIOLOCK; | 161 | macctl &= ~B43_MACCTL_RADIOLOCK; |
154 | b43_write32(dev, B43_MMIO_MACCTL, macctl); | 162 | b43_write32(dev, B43_MMIO_MACCTL, macctl); |
155 | } | 163 | } |
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h index c9f5430d1d7d..b2d99101947b 100644 --- a/drivers/net/wireless/b43/phy_common.h +++ b/drivers/net/wireless/b43/phy_common.h | |||
@@ -245,8 +245,10 @@ struct b43_phy { | |||
245 | atomic_t txerr_cnt; | 245 | atomic_t txerr_cnt; |
246 | 246 | ||
247 | #ifdef CONFIG_B43_DEBUG | 247 | #ifdef CONFIG_B43_DEBUG |
248 | /* PHY registers locked by b43_phy_lock()? */ | 248 | /* PHY registers locked (w.r.t. firmware) */ |
249 | bool phy_locked; | 249 | bool phy_locked; |
250 | /* Radio registers locked (w.r.t. firmware) */ | ||
251 | bool radio_locked; | ||
250 | #endif /* B43_DEBUG */ | 252 | #endif /* B43_DEBUG */ |
251 | }; | 253 | }; |
252 | 254 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 2399328e8de7..527525cc0919 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -1192,7 +1192,7 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv) | |||
1192 | return -ENOMEM; | 1192 | return -ENOMEM; |
1193 | } | 1193 | } |
1194 | } else | 1194 | } else |
1195 | iwl_rx_queue_reset(priv, rxq); | 1195 | iwl3945_rx_queue_reset(priv, rxq); |
1196 | 1196 | ||
1197 | iwl3945_rx_replenish(priv); | 1197 | iwl3945_rx_replenish(priv); |
1198 | 1198 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index ab7aaf6872c7..55188844657b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -215,6 +215,7 @@ extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); | |||
215 | extern int iwl3945_tx_queue_init(struct iwl_priv *priv, | 215 | extern int iwl3945_tx_queue_init(struct iwl_priv *priv, |
216 | struct iwl_tx_queue *txq, int count, u32 id); | 216 | struct iwl_tx_queue *txq, int count, u32 id); |
217 | extern void iwl3945_rx_replenish(void *data); | 217 | extern void iwl3945_rx_replenish(void *data); |
218 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq); | ||
218 | extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); | 219 | extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq); |
219 | extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, | 220 | extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, |
220 | const void *data); | 221 | const void *data); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 3889158b359c..1ef4192207a5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -976,11 +976,9 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
976 | 976 | ||
977 | rxq->queue[i] = NULL; | 977 | rxq->queue[i] = NULL; |
978 | 978 | ||
979 | dma_sync_single_range_for_cpu( | 979 | pci_unmap_single(priv->pci_dev, rxb->real_dma_addr, |
980 | &priv->pci_dev->dev, rxb->real_dma_addr, | 980 | priv->hw_params.rx_buf_size + 256, |
981 | rxb->aligned_dma_addr - rxb->real_dma_addr, | 981 | PCI_DMA_FROMDEVICE); |
982 | priv->hw_params.rx_buf_size, | ||
983 | PCI_DMA_FROMDEVICE); | ||
984 | pkt = (struct iwl_rx_packet *)rxb->skb->data; | 982 | pkt = (struct iwl_rx_packet *)rxb->skb->data; |
985 | 983 | ||
986 | /* Reclaim a command buffer only if this packet is a response | 984 | /* Reclaim a command buffer only if this packet is a response |
@@ -1031,9 +1029,6 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
1031 | rxb->skb = NULL; | 1029 | rxb->skb = NULL; |
1032 | } | 1030 | } |
1033 | 1031 | ||
1034 | pci_unmap_single(priv->pci_dev, rxb->real_dma_addr, | ||
1035 | priv->hw_params.rx_buf_size + 256, | ||
1036 | PCI_DMA_FROMDEVICE); | ||
1037 | spin_lock_irqsave(&rxq->lock, flags); | 1032 | spin_lock_irqsave(&rxq->lock, flags); |
1038 | list_add_tail(&rxb->list, &priv->rxq.rx_used); | 1033 | list_add_tail(&rxb->list, &priv->rxq.rx_used); |
1039 | spin_unlock_irqrestore(&rxq->lock, flags); | 1034 | spin_unlock_irqrestore(&rxq->lock, flags); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index 2f1242447b3b..6e983149b83b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -223,7 +223,7 @@ | |||
223 | #define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) | 223 | #define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) |
224 | 224 | ||
225 | /* EEPROM GP */ | 225 | /* EEPROM GP */ |
226 | #define CSR_EEPROM_GP_VALID_MSK (0x00000006) | 226 | #define CSR_EEPROM_GP_VALID_MSK (0x00000007) |
227 | #define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) | 227 | #define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000) |
228 | #define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) | 228 | #define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) |
229 | 229 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index ec9a13846edd..cf7f0db58fcf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -360,12 +360,16 @@ struct iwl_host_cmd { | |||
360 | 360 | ||
361 | /** | 361 | /** |
362 | * struct iwl_rx_queue - Rx queue | 362 | * struct iwl_rx_queue - Rx queue |
363 | * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) | ||
364 | * @dma_addr: bus address of buffer of receive buffer descriptors (rbd) | ||
363 | * @read: Shared index to newest available Rx buffer | 365 | * @read: Shared index to newest available Rx buffer |
364 | * @write: Shared index to oldest written Rx packet | 366 | * @write: Shared index to oldest written Rx packet |
365 | * @free_count: Number of pre-allocated buffers in rx_free | 367 | * @free_count: Number of pre-allocated buffers in rx_free |
366 | * @rx_free: list of free SKBs for use | 368 | * @rx_free: list of free SKBs for use |
367 | * @rx_used: List of Rx buffers with no SKB | 369 | * @rx_used: List of Rx buffers with no SKB |
368 | * @need_update: flag to indicate we need to update read/write index | 370 | * @need_update: flag to indicate we need to update read/write index |
371 | * @rb_stts: driver's pointer to receive buffer status | ||
372 | * @rb_stts_dma: bus address of receive buffer status | ||
369 | * | 373 | * |
370 | * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers | 374 | * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers |
371 | */ | 375 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 1f117a49c569..71d5b8a1a73e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -799,6 +799,22 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
799 | /* Copy MAC header from skb into command buffer */ | 799 | /* Copy MAC header from skb into command buffer */ |
800 | memcpy(tx_cmd->hdr, hdr, hdr_len); | 800 | memcpy(tx_cmd->hdr, hdr, hdr_len); |
801 | 801 | ||
802 | |||
803 | /* Total # bytes to be transmitted */ | ||
804 | len = (u16)skb->len; | ||
805 | tx_cmd->len = cpu_to_le16(len); | ||
806 | |||
807 | if (info->control.hw_key) | ||
808 | iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); | ||
809 | |||
810 | /* TODO need this for burst mode later on */ | ||
811 | iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id); | ||
812 | |||
813 | /* set is_hcca to 0; it probably will never be implemented */ | ||
814 | iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0); | ||
815 | |||
816 | iwl_update_tx_stats(priv, le16_to_cpu(fc), len); | ||
817 | |||
802 | /* | 818 | /* |
803 | * Use the first empty entry in this queue's command buffer array | 819 | * Use the first empty entry in this queue's command buffer array |
804 | * to contain the Tx command and MAC header concatenated together | 820 | * to contain the Tx command and MAC header concatenated together |
@@ -819,21 +835,30 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
819 | else | 835 | else |
820 | len_org = 0; | 836 | len_org = 0; |
821 | 837 | ||
838 | /* Tell NIC about any 2-byte padding after MAC header */ | ||
839 | if (len_org) | ||
840 | tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; | ||
841 | |||
822 | /* Physical address of this Tx command's header (not MAC header!), | 842 | /* Physical address of this Tx command's header (not MAC header!), |
823 | * within command buffer array. */ | 843 | * within command buffer array. */ |
824 | txcmd_phys = pci_map_single(priv->pci_dev, | 844 | txcmd_phys = pci_map_single(priv->pci_dev, |
825 | out_cmd, sizeof(struct iwl_cmd), | 845 | &out_cmd->hdr, len, |
826 | PCI_DMA_BIDIRECTIONAL); | 846 | PCI_DMA_BIDIRECTIONAL); |
827 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); | 847 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); |
828 | pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); | 848 | pci_unmap_len_set(&out_cmd->meta, len, len); |
829 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 849 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
830 | * first entry */ | 850 | * first entry */ |
831 | txcmd_phys += offsetof(struct iwl_cmd, hdr); | ||
832 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 851 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, |
833 | txcmd_phys, len, 1, 0); | 852 | txcmd_phys, len, 1, 0); |
834 | 853 | ||
835 | if (info->control.hw_key) | 854 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
836 | iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); | 855 | txq->need_update = 1; |
856 | if (qc) | ||
857 | priv->stations[sta_id].tid[tid].seq_number = seq_number; | ||
858 | } else { | ||
859 | wait_write_ptr = 1; | ||
860 | txq->need_update = 0; | ||
861 | } | ||
837 | 862 | ||
838 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 863 | /* Set up TFD's 2nd entry to point directly to remainder of skb, |
839 | * if any (802.11 null frames have no payload). */ | 864 | * if any (802.11 null frames have no payload). */ |
@@ -846,41 +871,29 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
846 | 0, 0); | 871 | 0, 0); |
847 | } | 872 | } |
848 | 873 | ||
849 | /* Tell NIC about any 2-byte padding after MAC header */ | ||
850 | if (len_org) | ||
851 | tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; | ||
852 | |||
853 | /* Total # bytes to be transmitted */ | ||
854 | len = (u16)skb->len; | ||
855 | tx_cmd->len = cpu_to_le16(len); | ||
856 | /* TODO need this for burst mode later on */ | ||
857 | iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, sta_id); | ||
858 | |||
859 | /* set is_hcca to 0; it probably will never be implemented */ | ||
860 | iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0); | ||
861 | |||
862 | iwl_update_tx_stats(priv, le16_to_cpu(fc), len); | ||
863 | |||
864 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + | 874 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + |
865 | offsetof(struct iwl_tx_cmd, scratch); | 875 | offsetof(struct iwl_tx_cmd, scratch); |
876 | |||
877 | len = sizeof(struct iwl_tx_cmd) + | ||
878 | sizeof(struct iwl_cmd_header) + hdr_len; | ||
879 | /* take back ownership of DMA buffer to enable update */ | ||
880 | pci_dma_sync_single_for_cpu(priv->pci_dev, txcmd_phys, | ||
881 | len, PCI_DMA_BIDIRECTIONAL); | ||
866 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | 882 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); |
867 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); | 883 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); |
868 | 884 | ||
869 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 885 | IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n", |
870 | txq->need_update = 1; | 886 | le16_to_cpu(out_cmd->hdr.sequence)); |
871 | if (qc) | 887 | IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx_cmd->tx_flags)); |
872 | priv->stations[sta_id].tid[tid].seq_number = seq_number; | ||
873 | } else { | ||
874 | wait_write_ptr = 1; | ||
875 | txq->need_update = 0; | ||
876 | } | ||
877 | |||
878 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); | 888 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); |
879 | |||
880 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); | 889 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); |
881 | 890 | ||
882 | /* Set up entry for this TFD in Tx byte-count array */ | 891 | /* Set up entry for this TFD in Tx byte-count array */ |
883 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, len); | 892 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, |
893 | le16_to_cpu(tx_cmd->len)); | ||
894 | |||
895 | pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys, | ||
896 | len, PCI_DMA_BIDIRECTIONAL); | ||
884 | 897 | ||
885 | /* Tell device the write index *just past* this latest filled TFD */ | 898 | /* Tell device the write index *just past* this latest filled TFD */ |
886 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 899 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); |
@@ -968,18 +981,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
968 | INDEX_TO_SEQ(q->write_ptr)); | 981 | INDEX_TO_SEQ(q->write_ptr)); |
969 | if (out_cmd->meta.flags & CMD_SIZE_HUGE) | 982 | if (out_cmd->meta.flags & CMD_SIZE_HUGE) |
970 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; | 983 | out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; |
971 | len = (idx == TFD_CMD_SLOTS) ? | 984 | len = sizeof(struct iwl_cmd) - sizeof(struct iwl_cmd_meta); |
972 | IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); | 985 | len += (idx == TFD_CMD_SLOTS) ? IWL_MAX_SCAN_SIZE : 0; |
973 | |||
974 | phys_addr = pci_map_single(priv->pci_dev, out_cmd, | ||
975 | len, PCI_DMA_BIDIRECTIONAL); | ||
976 | pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr); | ||
977 | pci_unmap_len_set(&out_cmd->meta, len, len); | ||
978 | phys_addr += offsetof(struct iwl_cmd, hdr); | ||
979 | 986 | ||
980 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | ||
981 | phys_addr, fix_size, 1, | ||
982 | U32_PAD(cmd->len)); | ||
983 | 987 | ||
984 | #ifdef CONFIG_IWLWIFI_DEBUG | 988 | #ifdef CONFIG_IWLWIFI_DEBUG |
985 | switch (out_cmd->hdr.cmd) { | 989 | switch (out_cmd->hdr.cmd) { |
@@ -1007,6 +1011,15 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1007 | /* Set up entry in queue's byte count circular buffer */ | 1011 | /* Set up entry in queue's byte count circular buffer */ |
1008 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0); | 1012 | priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0); |
1009 | 1013 | ||
1014 | phys_addr = pci_map_single(priv->pci_dev, &out_cmd->hdr, | ||
1015 | fix_size, PCI_DMA_BIDIRECTIONAL); | ||
1016 | pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr); | ||
1017 | pci_unmap_len_set(&out_cmd->meta, len, fix_size); | ||
1018 | |||
1019 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | ||
1020 | phys_addr, fix_size, 1, | ||
1021 | U32_PAD(cmd->len)); | ||
1022 | |||
1010 | /* Increment and update queue's write index */ | 1023 | /* Increment and update queue's write index */ |
1011 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 1024 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); |
1012 | ret = iwl_txq_update_write_ptr(priv, txq); | 1025 | ret = iwl_txq_update_write_ptr(priv, txq); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index ce729281ff62..617c4235d971 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -972,7 +972,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
972 | dma_addr_t phys_addr; | 972 | dma_addr_t phys_addr; |
973 | dma_addr_t txcmd_phys; | 973 | dma_addr_t txcmd_phys; |
974 | int txq_id = skb_get_queue_mapping(skb); | 974 | int txq_id = skb_get_queue_mapping(skb); |
975 | u16 len, idx, len_org, hdr_len; | 975 | u16 len, idx, len_org, hdr_len; /* TODO: len_org is not used */ |
976 | u8 id; | 976 | u8 id; |
977 | u8 unicast; | 977 | u8 unicast; |
978 | u8 sta_id; | 978 | u8 sta_id; |
@@ -1074,6 +1074,40 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
1074 | /* Copy MAC header from skb into command buffer */ | 1074 | /* Copy MAC header from skb into command buffer */ |
1075 | memcpy(tx->hdr, hdr, hdr_len); | 1075 | memcpy(tx->hdr, hdr, hdr_len); |
1076 | 1076 | ||
1077 | |||
1078 | if (info->control.hw_key) | ||
1079 | iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); | ||
1080 | |||
1081 | /* TODO need this for burst mode later on */ | ||
1082 | iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); | ||
1083 | |||
1084 | /* set is_hcca to 0; it probably will never be implemented */ | ||
1085 | iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); | ||
1086 | |||
1087 | /* Total # bytes to be transmitted */ | ||
1088 | len = (u16)skb->len; | ||
1089 | tx->len = cpu_to_le16(len); | ||
1090 | |||
1091 | |||
1092 | tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; | ||
1093 | tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; | ||
1094 | |||
1095 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | ||
1096 | txq->need_update = 1; | ||
1097 | if (qc) | ||
1098 | priv->stations_39[sta_id].tid[tid].seq_number = seq_number; | ||
1099 | } else { | ||
1100 | wait_write_ptr = 1; | ||
1101 | txq->need_update = 0; | ||
1102 | } | ||
1103 | |||
1104 | IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n", | ||
1105 | le16_to_cpu(out_cmd->hdr.sequence)); | ||
1106 | IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx->tx_flags)); | ||
1107 | iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx)); | ||
1108 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr, | ||
1109 | ieee80211_hdrlen(fc)); | ||
1110 | |||
1077 | /* | 1111 | /* |
1078 | * Use the first empty entry in this queue's command buffer array | 1112 | * Use the first empty entry in this queue's command buffer array |
1079 | * to contain the Tx command and MAC header concatenated together | 1113 | * to contain the Tx command and MAC header concatenated together |
@@ -1096,22 +1130,18 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
1096 | 1130 | ||
1097 | /* Physical address of this Tx command's header (not MAC header!), | 1131 | /* Physical address of this Tx command's header (not MAC header!), |
1098 | * within command buffer array. */ | 1132 | * within command buffer array. */ |
1099 | txcmd_phys = pci_map_single(priv->pci_dev, | 1133 | txcmd_phys = pci_map_single(priv->pci_dev, &out_cmd->hdr, |
1100 | out_cmd, sizeof(struct iwl_cmd), | 1134 | len, PCI_DMA_TODEVICE); |
1101 | PCI_DMA_TODEVICE); | 1135 | /* we do not map meta data ... so we can safely access address to |
1136 | * provide to unmap command*/ | ||
1102 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); | 1137 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); |
1103 | pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd)); | 1138 | pci_unmap_len_set(&out_cmd->meta, len, len); |
1104 | /* Add buffer containing Tx command and MAC(!) header to TFD's | ||
1105 | * first entry */ | ||
1106 | txcmd_phys += offsetof(struct iwl_cmd, hdr); | ||
1107 | 1139 | ||
1108 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 1140 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
1109 | * first entry */ | 1141 | * first entry */ |
1110 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, | 1142 | priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq, |
1111 | txcmd_phys, len, 1, 0); | 1143 | txcmd_phys, len, 1, 0); |
1112 | 1144 | ||
1113 | if (info->control.hw_key) | ||
1114 | iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, sta_id); | ||
1115 | 1145 | ||
1116 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 1146 | /* Set up TFD's 2nd entry to point directly to remainder of skb, |
1117 | * if any (802.11 null frames have no payload). */ | 1147 | * if any (802.11 null frames have no payload). */ |
@@ -1124,32 +1154,6 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
1124 | 0, U32_PAD(len)); | 1154 | 0, U32_PAD(len)); |
1125 | } | 1155 | } |
1126 | 1156 | ||
1127 | /* Total # bytes to be transmitted */ | ||
1128 | len = (u16)skb->len; | ||
1129 | tx->len = cpu_to_le16(len); | ||
1130 | |||
1131 | /* TODO need this for burst mode later on */ | ||
1132 | iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id); | ||
1133 | |||
1134 | /* set is_hcca to 0; it probably will never be implemented */ | ||
1135 | iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0); | ||
1136 | |||
1137 | tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; | ||
1138 | tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; | ||
1139 | |||
1140 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | ||
1141 | txq->need_update = 1; | ||
1142 | if (qc) | ||
1143 | priv->stations_39[sta_id].tid[tid].seq_number = seq_number; | ||
1144 | } else { | ||
1145 | wait_write_ptr = 1; | ||
1146 | txq->need_update = 0; | ||
1147 | } | ||
1148 | |||
1149 | iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx)); | ||
1150 | |||
1151 | iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr, | ||
1152 | ieee80211_hdrlen(fc)); | ||
1153 | 1157 | ||
1154 | /* Tell device the write index *just past* this latest filled TFD */ | 1158 | /* Tell device the write index *just past* this latest filled TFD */ |
1155 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); | 1159 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); |
@@ -1661,6 +1665,37 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv) | |||
1661 | spin_unlock_irqrestore(&rxq->lock, flags); | 1665 | spin_unlock_irqrestore(&rxq->lock, flags); |
1662 | } | 1666 | } |
1663 | 1667 | ||
1668 | void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | ||
1669 | { | ||
1670 | unsigned long flags; | ||
1671 | int i; | ||
1672 | spin_lock_irqsave(&rxq->lock, flags); | ||
1673 | INIT_LIST_HEAD(&rxq->rx_free); | ||
1674 | INIT_LIST_HEAD(&rxq->rx_used); | ||
1675 | /* Fill the rx_used queue with _all_ of the Rx buffers */ | ||
1676 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { | ||
1677 | /* In the reset function, these buffers may have been allocated | ||
1678 | * to an SKB, so we need to unmap and free potential storage */ | ||
1679 | if (rxq->pool[i].skb != NULL) { | ||
1680 | pci_unmap_single(priv->pci_dev, | ||
1681 | rxq->pool[i].real_dma_addr, | ||
1682 | priv->hw_params.rx_buf_size, | ||
1683 | PCI_DMA_FROMDEVICE); | ||
1684 | priv->alloc_rxb_skb--; | ||
1685 | dev_kfree_skb(rxq->pool[i].skb); | ||
1686 | rxq->pool[i].skb = NULL; | ||
1687 | } | ||
1688 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | ||
1689 | } | ||
1690 | |||
1691 | /* Set us so that we have processed and used all buffers, but have | ||
1692 | * not restocked the Rx queue with fresh buffers */ | ||
1693 | rxq->read = rxq->write = 0; | ||
1694 | rxq->free_count = 0; | ||
1695 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
1696 | } | ||
1697 | EXPORT_SYMBOL(iwl3945_rx_queue_reset); | ||
1698 | |||
1664 | /* | 1699 | /* |
1665 | * this should be called while priv->lock is locked | 1700 | * this should be called while priv->lock is locked |
1666 | */ | 1701 | */ |
@@ -1685,6 +1720,34 @@ void iwl3945_rx_replenish(void *data) | |||
1685 | spin_unlock_irqrestore(&priv->lock, flags); | 1720 | spin_unlock_irqrestore(&priv->lock, flags); |
1686 | } | 1721 | } |
1687 | 1722 | ||
1723 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | ||
1724 | * If an SKB has been detached, the POOL needs to have its SKB set to NULL | ||
1725 | * This free routine walks the list of POOL entries and if SKB is set to | ||
1726 | * non NULL it is unmapped and freed | ||
1727 | */ | ||
1728 | static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | ||
1729 | { | ||
1730 | int i; | ||
1731 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | ||
1732 | if (rxq->pool[i].skb != NULL) { | ||
1733 | pci_unmap_single(priv->pci_dev, | ||
1734 | rxq->pool[i].real_dma_addr, | ||
1735 | priv->hw_params.rx_buf_size, | ||
1736 | PCI_DMA_FROMDEVICE); | ||
1737 | dev_kfree_skb(rxq->pool[i].skb); | ||
1738 | } | ||
1739 | } | ||
1740 | |||
1741 | pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, | ||
1742 | rxq->dma_addr); | ||
1743 | pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), | ||
1744 | rxq->rb_stts, rxq->rb_stts_dma); | ||
1745 | rxq->bd = NULL; | ||
1746 | rxq->rb_stts = NULL; | ||
1747 | } | ||
1748 | EXPORT_SYMBOL(iwl3945_rx_queue_free); | ||
1749 | |||
1750 | |||
1688 | /* Convert linear signal-to-noise ratio into dB */ | 1751 | /* Convert linear signal-to-noise ratio into dB */ |
1689 | static u8 ratio2dB[100] = { | 1752 | static u8 ratio2dB[100] = { |
1690 | /* 0 1 2 3 4 5 6 7 8 9 */ | 1753 | /* 0 1 2 3 4 5 6 7 8 9 */ |
@@ -1802,9 +1865,9 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) | |||
1802 | 1865 | ||
1803 | rxq->queue[i] = NULL; | 1866 | rxq->queue[i] = NULL; |
1804 | 1867 | ||
1805 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->real_dma_addr, | 1868 | pci_unmap_single(priv->pci_dev, rxb->real_dma_addr, |
1806 | priv->hw_params.rx_buf_size, | 1869 | priv->hw_params.rx_buf_size, |
1807 | PCI_DMA_FROMDEVICE); | 1870 | PCI_DMA_FROMDEVICE); |
1808 | pkt = (struct iwl_rx_packet *)rxb->skb->data; | 1871 | pkt = (struct iwl_rx_packet *)rxb->skb->data; |
1809 | 1872 | ||
1810 | /* Reclaim a command buffer only if this packet is a response | 1873 | /* Reclaim a command buffer only if this packet is a response |
@@ -1852,9 +1915,6 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) | |||
1852 | rxb->skb = NULL; | 1915 | rxb->skb = NULL; |
1853 | } | 1916 | } |
1854 | 1917 | ||
1855 | pci_unmap_single(priv->pci_dev, rxb->real_dma_addr, | ||
1856 | priv->hw_params.rx_buf_size, | ||
1857 | PCI_DMA_FROMDEVICE); | ||
1858 | spin_lock_irqsave(&rxq->lock, flags); | 1918 | spin_lock_irqsave(&rxq->lock, flags); |
1859 | list_add_tail(&rxb->list, &priv->rxq.rx_used); | 1919 | list_add_tail(&rxb->list, &priv->rxq.rx_used); |
1860 | spin_unlock_irqrestore(&rxq->lock, flags); | 1920 | spin_unlock_irqrestore(&rxq->lock, flags); |
@@ -4075,7 +4135,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
4075 | if (!static_key) { | 4135 | if (!static_key) { |
4076 | sta_id = iwl3945_hw_find_station(priv, addr); | 4136 | sta_id = iwl3945_hw_find_station(priv, addr); |
4077 | if (sta_id == IWL_INVALID_STATION) { | 4137 | if (sta_id == IWL_INVALID_STATION) { |
4078 | IWL_DEBUG_MAC80211(priv, "leave - %pMnot in station map.\n", | 4138 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", |
4079 | addr); | 4139 | addr); |
4080 | return -EINVAL; | 4140 | return -EINVAL; |
4081 | } | 4141 | } |
@@ -4913,6 +4973,8 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
4913 | 4973 | ||
4914 | hw->wiphy->custom_regulatory = true; | 4974 | hw->wiphy->custom_regulatory = true; |
4915 | 4975 | ||
4976 | hw->wiphy->max_scan_ssids = 1; /* WILL FIX */ | ||
4977 | |||
4916 | /* Default value; 4 EDCA QOS priorities */ | 4978 | /* Default value; 4 EDCA QOS priorities */ |
4917 | hw->queues = 4; | 4979 | hw->queues = 4; |
4918 | 4980 | ||
@@ -5194,12 +5256,12 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
5194 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); | 5256 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); |
5195 | 5257 | ||
5196 | iwl_rfkill_unregister(priv); | 5258 | iwl_rfkill_unregister(priv); |
5197 | cancel_delayed_work(&priv->rfkill_poll); | 5259 | cancel_delayed_work_sync(&priv->rfkill_poll); |
5198 | 5260 | ||
5199 | iwl3945_dealloc_ucode_pci(priv); | 5261 | iwl3945_dealloc_ucode_pci(priv); |
5200 | 5262 | ||
5201 | if (priv->rxq.bd) | 5263 | if (priv->rxq.bd) |
5202 | iwl_rx_queue_free(priv, &priv->rxq); | 5264 | iwl3945_rx_queue_free(priv, &priv->rxq); |
5203 | iwl3945_hw_txq_ctx_free(priv); | 5265 | iwl3945_hw_txq_ctx_free(priv); |
5204 | 5266 | ||
5205 | iwl3945_unset_hw_params(priv); | 5267 | iwl3945_unset_hw_params(priv); |
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index 63d7e19ce9bd..8e669775cb5d 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c | |||
@@ -170,6 +170,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) | |||
170 | lbs_deb_rx("rx err: frame received with bad length\n"); | 170 | lbs_deb_rx("rx err: frame received with bad length\n"); |
171 | dev->stats.rx_length_errors++; | 171 | dev->stats.rx_length_errors++; |
172 | ret = 0; | 172 | ret = 0; |
173 | dev_kfree_skb(skb); | ||
173 | goto done; | 174 | goto done; |
174 | } | 175 | } |
175 | 176 | ||
@@ -181,6 +182,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) | |||
181 | lbs_pr_alert("rxpd not ok\n"); | 182 | lbs_pr_alert("rxpd not ok\n"); |
182 | dev->stats.rx_errors++; | 183 | dev->stats.rx_errors++; |
183 | ret = 0; | 184 | ret = 0; |
185 | dev_kfree_skb(skb); | ||
184 | goto done; | 186 | goto done; |
185 | } | 187 | } |
186 | 188 | ||
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 57a0268d1bae..a9a970469c2a 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -893,8 +893,7 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index) | |||
893 | rx_desc->next_rx_desc_phys_addr = | 893 | rx_desc->next_rx_desc_phys_addr = |
894 | cpu_to_le32(rxq->rx_desc_dma | 894 | cpu_to_le32(rxq->rx_desc_dma |
895 | + nexti * sizeof(*rx_desc)); | 895 | + nexti * sizeof(*rx_desc)); |
896 | rx_desc->rx_ctrl = | 896 | rx_desc->rx_ctrl = MWL8K_RX_CTRL_OWNED_BY_HOST; |
897 | cpu_to_le32(MWL8K_RX_CTRL_OWNED_BY_HOST); | ||
898 | } | 897 | } |
899 | 898 | ||
900 | return 0; | 899 | return 0; |
@@ -3720,12 +3719,12 @@ err_free_reg: | |||
3720 | return rc; | 3719 | return rc; |
3721 | } | 3720 | } |
3722 | 3721 | ||
3723 | static void __devexit mwl8k_remove(struct pci_dev *pdev) | 3722 | static void __devexit mwl8k_shutdown(struct pci_dev *pdev) |
3724 | { | 3723 | { |
3725 | printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__); | 3724 | printk(KERN_ERR "===>%s(%u)\n", __func__, __LINE__); |
3726 | } | 3725 | } |
3727 | 3726 | ||
3728 | static void __devexit mwl8k_shutdown(struct pci_dev *pdev) | 3727 | static void __devexit mwl8k_remove(struct pci_dev *pdev) |
3729 | { | 3728 | { |
3730 | struct ieee80211_hw *hw = pci_get_drvdata(pdev); | 3729 | struct ieee80211_hw *hw = pci_get_drvdata(pdev); |
3731 | struct mwl8k_priv *priv; | 3730 | struct mwl8k_priv *priv; |
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 081428d9409e..632fac86a308 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -372,15 +372,13 @@ int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx, | |||
372 | } | 372 | } |
373 | 373 | ||
374 | /* Wait upto 100ms for tx queue to empty */ | 374 | /* Wait upto 100ms for tx queue to empty */ |
375 | k = 100; | 375 | for (k = 100; k > 0; k--) { |
376 | do { | ||
377 | k--; | ||
378 | udelay(1000); | 376 | udelay(1000); |
379 | ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY, | 377 | ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY, |
380 | &xmitting); | 378 | &xmitting); |
381 | if (ret) | 379 | if (ret || !xmitting) |
382 | break; | 380 | break; |
383 | } while ((k > 0) && xmitting); | 381 | } |
384 | 382 | ||
385 | if (k == 0) | 383 | if (k == 0) |
386 | ret = -ETIMEDOUT; | 384 | ret = -ETIMEDOUT; |
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h index 2dda5fe418b6..ecf8b6ed5a47 100644 --- a/drivers/net/wireless/p54/p54.h +++ b/drivers/net/wireless/p54/p54.h | |||
@@ -14,9 +14,9 @@ | |||
14 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifdef CONFIG_MAC80211_LEDS | 17 | #ifdef CONFIG_P54_LEDS |
18 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
19 | #endif /* CONFIG_MAC80211_LEDS */ | 19 | #endif /* CONFIG_P54_LEDS */ |
20 | 20 | ||
21 | enum p54_control_frame_types { | 21 | enum p54_control_frame_types { |
22 | P54_CONTROL_TYPE_SETUP = 0, | 22 | P54_CONTROL_TYPE_SETUP = 0, |
@@ -116,7 +116,7 @@ enum fw_state { | |||
116 | FW_STATE_RESETTING, | 116 | FW_STATE_RESETTING, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #ifdef CONFIG_MAC80211_LEDS | 119 | #ifdef CONFIG_P54_LEDS |
120 | 120 | ||
121 | #define P54_LED_MAX_NAME_LEN 31 | 121 | #define P54_LED_MAX_NAME_LEN 31 |
122 | 122 | ||
@@ -129,7 +129,7 @@ struct p54_led_dev { | |||
129 | unsigned int registered; | 129 | unsigned int registered; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | #endif /* CONFIG_MAC80211_LEDS */ | 132 | #endif /* CONFIG_P54_LEDS */ |
133 | 133 | ||
134 | struct p54_common { | 134 | struct p54_common { |
135 | struct ieee80211_hw *hw; | 135 | struct ieee80211_hw *hw; |
@@ -177,10 +177,10 @@ struct p54_common { | |||
177 | u8 privacy_caps; | 177 | u8 privacy_caps; |
178 | u8 rx_keycache_size; | 178 | u8 rx_keycache_size; |
179 | /* LED management */ | 179 | /* LED management */ |
180 | #ifdef CONFIG_MAC80211_LEDS | 180 | #ifdef CONFIG_P54_LEDS |
181 | struct p54_led_dev assoc_led; | 181 | struct p54_led_dev assoc_led; |
182 | struct p54_led_dev tx_led; | 182 | struct p54_led_dev tx_led; |
183 | #endif /* CONFIG_MAC80211_LEDS */ | 183 | #endif /* CONFIG_P54_LEDS */ |
184 | u16 softled_state; /* bit field of glowing LEDs */ | 184 | u16 softled_state; /* bit field of glowing LEDs */ |
185 | }; | 185 | }; |
186 | 186 | ||
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index 0c1b0577d4ee..c8f0232ee5e0 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -2543,8 +2543,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len) | |||
2543 | priv->basic_rate_mask = 0x15f; | 2543 | priv->basic_rate_mask = 0x15f; |
2544 | skb_queue_head_init(&priv->tx_queue); | 2544 | skb_queue_head_init(&priv->tx_queue); |
2545 | dev->flags = IEEE80211_HW_RX_INCLUDES_FCS | | 2545 | dev->flags = IEEE80211_HW_RX_INCLUDES_FCS | |
2546 | IEEE80211_HW_SUPPORTS_PS | | ||
2547 | IEEE80211_HW_PS_NULLFUNC_STACK | | ||
2548 | IEEE80211_HW_SIGNAL_DBM | | 2546 | IEEE80211_HW_SIGNAL_DBM | |
2549 | IEEE80211_HW_NOISE_DBM; | 2547 | IEEE80211_HW_NOISE_DBM; |
2550 | 2548 | ||
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index 2b222aaa6f0a..d1fe577de3d4 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
@@ -457,9 +457,10 @@ static int p54spi_wq_tx(struct p54s_priv *priv) | |||
457 | struct ieee80211_tx_info *info; | 457 | struct ieee80211_tx_info *info; |
458 | struct p54_tx_info *minfo; | 458 | struct p54_tx_info *minfo; |
459 | struct p54s_tx_info *dinfo; | 459 | struct p54s_tx_info *dinfo; |
460 | unsigned long flags; | ||
460 | int ret = 0; | 461 | int ret = 0; |
461 | 462 | ||
462 | spin_lock_bh(&priv->tx_lock); | 463 | spin_lock_irqsave(&priv->tx_lock, flags); |
463 | 464 | ||
464 | while (!list_empty(&priv->tx_pending)) { | 465 | while (!list_empty(&priv->tx_pending)) { |
465 | entry = list_entry(priv->tx_pending.next, | 466 | entry = list_entry(priv->tx_pending.next, |
@@ -467,7 +468,7 @@ static int p54spi_wq_tx(struct p54s_priv *priv) | |||
467 | 468 | ||
468 | list_del_init(&entry->tx_list); | 469 | list_del_init(&entry->tx_list); |
469 | 470 | ||
470 | spin_unlock_bh(&priv->tx_lock); | 471 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
471 | 472 | ||
472 | dinfo = container_of((void *) entry, struct p54s_tx_info, | 473 | dinfo = container_of((void *) entry, struct p54s_tx_info, |
473 | tx_list); | 474 | tx_list); |
@@ -479,16 +480,14 @@ static int p54spi_wq_tx(struct p54s_priv *priv) | |||
479 | 480 | ||
480 | ret = p54spi_tx_frame(priv, skb); | 481 | ret = p54spi_tx_frame(priv, skb); |
481 | 482 | ||
482 | spin_lock_bh(&priv->tx_lock); | ||
483 | |||
484 | if (ret < 0) { | 483 | if (ret < 0) { |
485 | p54_free_skb(priv->hw, skb); | 484 | p54_free_skb(priv->hw, skb); |
486 | goto out; | 485 | return ret; |
487 | } | 486 | } |
488 | } | ||
489 | 487 | ||
490 | out: | 488 | spin_lock_irqsave(&priv->tx_lock, flags); |
491 | spin_unlock_bh(&priv->tx_lock); | 489 | } |
490 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
492 | return ret; | 491 | return ret; |
493 | } | 492 | } |
494 | 493 | ||
@@ -498,12 +497,13 @@ static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
498 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 497 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
499 | struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; | 498 | struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; |
500 | struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; | 499 | struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; |
500 | unsigned long flags; | ||
501 | 501 | ||
502 | BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); | 502 | BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); |
503 | 503 | ||
504 | spin_lock_bh(&priv->tx_lock); | 504 | spin_lock_irqsave(&priv->tx_lock, flags); |
505 | list_add_tail(&di->tx_list, &priv->tx_pending); | 505 | list_add_tail(&di->tx_list, &priv->tx_pending); |
506 | spin_unlock_bh(&priv->tx_lock); | 506 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
507 | 507 | ||
508 | queue_work(priv->hw->workqueue, &priv->work); | 508 | queue_work(priv->hw->workqueue, &priv->work); |
509 | } | 509 | } |
@@ -604,6 +604,7 @@ out: | |||
604 | static void p54spi_op_stop(struct ieee80211_hw *dev) | 604 | static void p54spi_op_stop(struct ieee80211_hw *dev) |
605 | { | 605 | { |
606 | struct p54s_priv *priv = dev->priv; | 606 | struct p54s_priv *priv = dev->priv; |
607 | unsigned long flags; | ||
607 | 608 | ||
608 | if (mutex_lock_interruptible(&priv->mutex)) { | 609 | if (mutex_lock_interruptible(&priv->mutex)) { |
609 | /* FIXME: how to handle this error? */ | 610 | /* FIXME: how to handle this error? */ |
@@ -615,9 +616,9 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) | |||
615 | cancel_work_sync(&priv->work); | 616 | cancel_work_sync(&priv->work); |
616 | 617 | ||
617 | p54spi_power_off(priv); | 618 | p54spi_power_off(priv); |
618 | spin_lock_bh(&priv->tx_lock); | 619 | spin_lock_irqsave(&priv->tx_lock, flags); |
619 | INIT_LIST_HEAD(&priv->tx_pending); | 620 | INIT_LIST_HEAD(&priv->tx_pending); |
620 | spin_unlock_bh(&priv->tx_lock); | 621 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
621 | 622 | ||
622 | priv->fw_state = FW_STATE_OFF; | 623 | priv->fw_state = FW_STATE_OFF; |
623 | mutex_unlock(&priv->mutex); | 624 | mutex_unlock(&priv->mutex); |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index da6640afc835..6cc6cbc9234f 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -71,6 +71,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
71 | {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */ | 71 | {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */ |
72 | {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ | 72 | {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ |
73 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ | 73 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ |
74 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ | ||
74 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 75 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
75 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | 76 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ |
76 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ | 77 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 05f94e21b423..5752aaae906b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -646,10 +646,8 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
646 | * Register HW. | 646 | * Register HW. |
647 | */ | 647 | */ |
648 | status = ieee80211_register_hw(rt2x00dev->hw); | 648 | status = ieee80211_register_hw(rt2x00dev->hw); |
649 | if (status) { | 649 | if (status) |
650 | rt2x00lib_remove_hw(rt2x00dev); | ||
651 | return status; | 650 | return status; |
652 | } | ||
653 | 651 | ||
654 | set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); | 652 | set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); |
655 | 653 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 43fa0f849003..9730b4f8fd26 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -369,8 +369,6 @@ int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
369 | if (retval) | 369 | if (retval) |
370 | return retval; | 370 | return retval; |
371 | 371 | ||
372 | rt2x00pci_free_reg(rt2x00dev); | ||
373 | |||
374 | pci_save_state(pci_dev); | 372 | pci_save_state(pci_dev); |
375 | pci_disable_device(pci_dev); | 373 | pci_disable_device(pci_dev); |
376 | return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); | 374 | return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); |
@@ -381,7 +379,6 @@ int rt2x00pci_resume(struct pci_dev *pci_dev) | |||
381 | { | 379 | { |
382 | struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); | 380 | struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); |
383 | struct rt2x00_dev *rt2x00dev = hw->priv; | 381 | struct rt2x00_dev *rt2x00dev = hw->priv; |
384 | int retval; | ||
385 | 382 | ||
386 | if (pci_set_power_state(pci_dev, PCI_D0) || | 383 | if (pci_set_power_state(pci_dev, PCI_D0) || |
387 | pci_enable_device(pci_dev) || | 384 | pci_enable_device(pci_dev) || |
@@ -390,20 +387,7 @@ int rt2x00pci_resume(struct pci_dev *pci_dev) | |||
390 | return -EIO; | 387 | return -EIO; |
391 | } | 388 | } |
392 | 389 | ||
393 | retval = rt2x00pci_alloc_reg(rt2x00dev); | 390 | return rt2x00lib_resume(rt2x00dev); |
394 | if (retval) | ||
395 | return retval; | ||
396 | |||
397 | retval = rt2x00lib_resume(rt2x00dev); | ||
398 | if (retval) | ||
399 | goto exit_free_reg; | ||
400 | |||
401 | return 0; | ||
402 | |||
403 | exit_free_reg: | ||
404 | rt2x00pci_free_reg(rt2x00dev); | ||
405 | |||
406 | return retval; | ||
407 | } | 391 | } |
408 | EXPORT_SYMBOL_GPL(rt2x00pci_resume); | 392 | EXPORT_SYMBOL_GPL(rt2x00pci_resume); |
409 | #endif /* CONFIG_PM */ | 393 | #endif /* CONFIG_PM */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 7d50ca82375e..501544882c2c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -702,8 +702,6 @@ int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state) | |||
702 | if (retval) | 702 | if (retval) |
703 | return retval; | 703 | return retval; |
704 | 704 | ||
705 | rt2x00usb_free_reg(rt2x00dev); | ||
706 | |||
707 | /* | 705 | /* |
708 | * Decrease usbdev refcount. | 706 | * Decrease usbdev refcount. |
709 | */ | 707 | */ |
@@ -717,24 +715,10 @@ int rt2x00usb_resume(struct usb_interface *usb_intf) | |||
717 | { | 715 | { |
718 | struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); | 716 | struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); |
719 | struct rt2x00_dev *rt2x00dev = hw->priv; | 717 | struct rt2x00_dev *rt2x00dev = hw->priv; |
720 | int retval; | ||
721 | 718 | ||
722 | usb_get_dev(interface_to_usbdev(usb_intf)); | 719 | usb_get_dev(interface_to_usbdev(usb_intf)); |
723 | 720 | ||
724 | retval = rt2x00usb_alloc_reg(rt2x00dev); | 721 | return rt2x00lib_resume(rt2x00dev); |
725 | if (retval) | ||
726 | return retval; | ||
727 | |||
728 | retval = rt2x00lib_resume(rt2x00dev); | ||
729 | if (retval) | ||
730 | goto exit_free_reg; | ||
731 | |||
732 | return 0; | ||
733 | |||
734 | exit_free_reg: | ||
735 | rt2x00usb_free_reg(rt2x00dev); | ||
736 | |||
737 | return retval; | ||
738 | } | 722 | } |
739 | EXPORT_SYMBOL_GPL(rt2x00usb_resume); | 723 | EXPORT_SYMBOL_GPL(rt2x00usb_resume); |
740 | #endif /* CONFIG_PM */ | 724 | #endif /* CONFIG_PM */ |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 420fff42c0dd..853b2b279b64 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2369,6 +2369,8 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2369 | /* Buffalo */ | 2369 | /* Buffalo */ |
2370 | { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) }, | 2370 | { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) }, |
2371 | { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, | 2371 | { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, |
2372 | { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2373 | { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2372 | /* CNet */ | 2374 | /* CNet */ |
2373 | { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, | 2375 | { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, |
2374 | { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, | 2376 | { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index ffe34a12f446..4e9851fc1746 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -573,7 +573,7 @@ config RTC_DRV_SA1100 | |||
573 | 573 | ||
574 | config RTC_DRV_SH | 574 | config RTC_DRV_SH |
575 | tristate "SuperH On-Chip RTC" | 575 | tristate "SuperH On-Chip RTC" |
576 | depends on RTC_CLASS && SUPERH | 576 | depends on RTC_CLASS && SUPERH && HAVE_CLK |
577 | help | 577 | help |
578 | Say Y here to enable support for the on-chip RTC found in | 578 | Say Y here to enable support for the on-chip RTC found in |
579 | most SuperH processors. | 579 | most SuperH processors. |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index b6d35f50e404..23e10b6263d6 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -797,17 +797,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
797 | goto cleanup2; | 797 | goto cleanup2; |
798 | } | 798 | } |
799 | 799 | ||
800 | pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n", | 800 | pr_info("%s: %s%s, %zd bytes nvram%s\n", |
801 | dev_name(&cmos_rtc.rtc->dev), | 801 | dev_name(&cmos_rtc.rtc->dev), |
802 | is_valid_irq(rtc_irq) | 802 | !is_valid_irq(rtc_irq) ? "no alarms" : |
803 | ? (cmos_rtc.mon_alrm | 803 | cmos_rtc.mon_alrm ? "alarms up to one year" : |
804 | ? "year" | 804 | cmos_rtc.day_alrm ? "alarms up to one month" : |
805 | : (cmos_rtc.day_alrm | 805 | "alarms up to one day", |
806 | ? "month" : "day")) | 806 | cmos_rtc.century ? ", y3k" : "", |
807 | : "no", | 807 | nvram.size, |
808 | cmos_rtc.century ? ", y3k" : "", | 808 | is_hpet_enabled() ? ", hpet irqs" : ""); |
809 | nvram.size, | ||
810 | is_hpet_enabled() ? ", hpet irqs" : ""); | ||
811 | 809 | ||
812 | return 0; | 810 | return 0; |
813 | 811 | ||
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 9b1ff12bf947..d7310adb7152 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SuperH On-Chip RTC Support | 2 | * SuperH On-Chip RTC Support |
3 | * | 3 | * |
4 | * Copyright (C) 2006, 2007, 2008 Paul Mundt | 4 | * Copyright (C) 2006 - 2009 Paul Mundt |
5 | * Copyright (C) 2006 Jamie Lenehan | 5 | * Copyright (C) 2006 Jamie Lenehan |
6 | * Copyright (C) 2008 Angelo Castello | 6 | * Copyright (C) 2008 Angelo Castello |
7 | * | 7 | * |
@@ -25,10 +25,11 @@ | |||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/log2.h> | 27 | #include <linux/log2.h> |
28 | #include <linux/clk.h> | ||
28 | #include <asm/rtc.h> | 29 | #include <asm/rtc.h> |
29 | 30 | ||
30 | #define DRV_NAME "sh-rtc" | 31 | #define DRV_NAME "sh-rtc" |
31 | #define DRV_VERSION "0.2.1" | 32 | #define DRV_VERSION "0.2.2" |
32 | 33 | ||
33 | #define RTC_REG(r) ((r) * rtc_reg_size) | 34 | #define RTC_REG(r) ((r) * rtc_reg_size) |
34 | 35 | ||
@@ -87,16 +88,17 @@ | |||
87 | #define RCR2_START 0x01 /* Start bit */ | 88 | #define RCR2_START 0x01 /* Start bit */ |
88 | 89 | ||
89 | struct sh_rtc { | 90 | struct sh_rtc { |
90 | void __iomem *regbase; | 91 | void __iomem *regbase; |
91 | unsigned long regsize; | 92 | unsigned long regsize; |
92 | struct resource *res; | 93 | struct resource *res; |
93 | int alarm_irq; | 94 | int alarm_irq; |
94 | int periodic_irq; | 95 | int periodic_irq; |
95 | int carry_irq; | 96 | int carry_irq; |
96 | struct rtc_device *rtc_dev; | 97 | struct clk *clk; |
97 | spinlock_t lock; | 98 | struct rtc_device *rtc_dev; |
98 | unsigned long capabilities; /* See asm-sh/rtc.h for cap bits */ | 99 | spinlock_t lock; |
99 | unsigned short periodic_freq; | 100 | unsigned long capabilities; /* See asm/rtc.h for cap bits */ |
101 | unsigned short periodic_freq; | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | static int __sh_rtc_interrupt(struct sh_rtc *rtc) | 104 | static int __sh_rtc_interrupt(struct sh_rtc *rtc) |
@@ -294,10 +296,10 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable) | |||
294 | 296 | ||
295 | tmp = readb(rtc->regbase + RCR1); | 297 | tmp = readb(rtc->regbase + RCR1); |
296 | 298 | ||
297 | if (!enable) | 299 | if (enable) |
298 | tmp &= ~RCR1_AIE; | ||
299 | else | ||
300 | tmp |= RCR1_AIE; | 300 | tmp |= RCR1_AIE; |
301 | else | ||
302 | tmp &= ~RCR1_AIE; | ||
301 | 303 | ||
302 | writeb(tmp, rtc->regbase + RCR1); | 304 | writeb(tmp, rtc->regbase + RCR1); |
303 | 305 | ||
@@ -618,6 +620,7 @@ static int sh_rtc_irq_set_freq(struct device *dev, int freq) | |||
618 | { | 620 | { |
619 | if (!is_power_of_2(freq)) | 621 | if (!is_power_of_2(freq)) |
620 | return -EINVAL; | 622 | return -EINVAL; |
623 | |||
621 | return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq); | 624 | return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq); |
622 | } | 625 | } |
623 | 626 | ||
@@ -637,7 +640,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
637 | struct sh_rtc *rtc; | 640 | struct sh_rtc *rtc; |
638 | struct resource *res; | 641 | struct resource *res; |
639 | struct rtc_time r; | 642 | struct rtc_time r; |
640 | int ret; | 643 | char clk_name[6]; |
644 | int clk_id, ret; | ||
641 | 645 | ||
642 | rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL); | 646 | rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL); |
643 | if (unlikely(!rtc)) | 647 | if (unlikely(!rtc)) |
@@ -652,6 +656,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
652 | dev_err(&pdev->dev, "No IRQ resource\n"); | 656 | dev_err(&pdev->dev, "No IRQ resource\n"); |
653 | goto err_badres; | 657 | goto err_badres; |
654 | } | 658 | } |
659 | |||
655 | rtc->periodic_irq = ret; | 660 | rtc->periodic_irq = ret; |
656 | rtc->carry_irq = platform_get_irq(pdev, 1); | 661 | rtc->carry_irq = platform_get_irq(pdev, 1); |
657 | rtc->alarm_irq = platform_get_irq(pdev, 2); | 662 | rtc->alarm_irq = platform_get_irq(pdev, 2); |
@@ -663,7 +668,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
663 | goto err_badres; | 668 | goto err_badres; |
664 | } | 669 | } |
665 | 670 | ||
666 | rtc->regsize = res->end - res->start + 1; | 671 | rtc->regsize = resource_size(res); |
667 | 672 | ||
668 | rtc->res = request_mem_region(res->start, rtc->regsize, pdev->name); | 673 | rtc->res = request_mem_region(res->start, rtc->regsize, pdev->name); |
669 | if (unlikely(!rtc->res)) { | 674 | if (unlikely(!rtc->res)) { |
@@ -677,6 +682,26 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
677 | goto err_badmap; | 682 | goto err_badmap; |
678 | } | 683 | } |
679 | 684 | ||
685 | clk_id = pdev->id; | ||
686 | /* With a single device, the clock id is still "rtc0" */ | ||
687 | if (clk_id < 0) | ||
688 | clk_id = 0; | ||
689 | |||
690 | snprintf(clk_name, sizeof(clk_name), "rtc%d", clk_id); | ||
691 | |||
692 | rtc->clk = clk_get(&pdev->dev, clk_name); | ||
693 | if (IS_ERR(rtc->clk)) { | ||
694 | /* | ||
695 | * No error handling for rtc->clk intentionally, not all | ||
696 | * platforms will have a unique clock for the RTC, and | ||
697 | * the clk API can handle the struct clk pointer being | ||
698 | * NULL. | ||
699 | */ | ||
700 | rtc->clk = NULL; | ||
701 | } | ||
702 | |||
703 | clk_enable(rtc->clk); | ||
704 | |||
680 | rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, | 705 | rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, |
681 | &sh_rtc_ops, THIS_MODULE); | 706 | &sh_rtc_ops, THIS_MODULE); |
682 | if (IS_ERR(rtc->rtc_dev)) { | 707 | if (IS_ERR(rtc->rtc_dev)) { |
@@ -759,6 +784,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
759 | return 0; | 784 | return 0; |
760 | 785 | ||
761 | err_unmap: | 786 | err_unmap: |
787 | clk_disable(rtc->clk); | ||
788 | clk_put(rtc->clk); | ||
762 | iounmap(rtc->regbase); | 789 | iounmap(rtc->regbase); |
763 | err_badmap: | 790 | err_badmap: |
764 | release_resource(rtc->res); | 791 | release_resource(rtc->res); |
@@ -780,6 +807,7 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
780 | sh_rtc_setcie(&pdev->dev, 0); | 807 | sh_rtc_setcie(&pdev->dev, 0); |
781 | 808 | ||
782 | free_irq(rtc->periodic_irq, rtc); | 809 | free_irq(rtc->periodic_irq, rtc); |
810 | |||
783 | if (rtc->carry_irq > 0) { | 811 | if (rtc->carry_irq > 0) { |
784 | free_irq(rtc->carry_irq, rtc); | 812 | free_irq(rtc->carry_irq, rtc); |
785 | free_irq(rtc->alarm_irq, rtc); | 813 | free_irq(rtc->alarm_irq, rtc); |
@@ -789,6 +817,9 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
789 | 817 | ||
790 | iounmap(rtc->regbase); | 818 | iounmap(rtc->regbase); |
791 | 819 | ||
820 | clk_disable(rtc->clk); | ||
821 | clk_put(rtc->clk); | ||
822 | |||
792 | platform_set_drvdata(pdev, NULL); | 823 | platform_set_drvdata(pdev, NULL); |
793 | 824 | ||
794 | kfree(rtc); | 825 | kfree(rtc); |
@@ -802,11 +833,11 @@ static void sh_rtc_set_irq_wake(struct device *dev, int enabled) | |||
802 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | 833 | struct sh_rtc *rtc = platform_get_drvdata(pdev); |
803 | 834 | ||
804 | set_irq_wake(rtc->periodic_irq, enabled); | 835 | set_irq_wake(rtc->periodic_irq, enabled); |
836 | |||
805 | if (rtc->carry_irq > 0) { | 837 | if (rtc->carry_irq > 0) { |
806 | set_irq_wake(rtc->carry_irq, enabled); | 838 | set_irq_wake(rtc->carry_irq, enabled); |
807 | set_irq_wake(rtc->alarm_irq, enabled); | 839 | set_irq_wake(rtc->alarm_irq, enabled); |
808 | } | 840 | } |
809 | |||
810 | } | 841 | } |
811 | 842 | ||
812 | static int sh_rtc_suspend(struct device *dev) | 843 | static int sh_rtc_suspend(struct device *dev) |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index a14d245a66b8..6f51ca485f35 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -180,8 +180,6 @@ int scsi_complete_async_scans(void) | |||
180 | spin_unlock(&async_scan_lock); | 180 | spin_unlock(&async_scan_lock); |
181 | 181 | ||
182 | kfree(data); | 182 | kfree(data); |
183 | /* Synchronize async operations globally */ | ||
184 | async_synchronize_full(); | ||
185 | return 0; | 183 | return 0; |
186 | } | 184 | } |
187 | 185 | ||
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c index 2f21af21269a..74708fcaf82f 100644 --- a/drivers/scsi/scsi_wait_scan.c +++ b/drivers/scsi/scsi_wait_scan.c | |||
@@ -11,10 +11,21 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/device.h> | ||
14 | #include <scsi/scsi_scan.h> | 15 | #include <scsi/scsi_scan.h> |
15 | 16 | ||
16 | static int __init wait_scan_init(void) | 17 | static int __init wait_scan_init(void) |
17 | { | 18 | { |
19 | /* | ||
20 | * First we need to wait for device probing to finish; | ||
21 | * the drivers we just loaded might just still be probing | ||
22 | * and might not yet have reached the scsi async scanning | ||
23 | */ | ||
24 | wait_for_device_probe(); | ||
25 | /* | ||
26 | * and then we wait for the actual asynchronous scsi scan | ||
27 | * to finish. | ||
28 | */ | ||
18 | scsi_complete_async_scans(); | 29 | scsi_complete_async_scans(); |
19 | return 0; | 30 | return 0; |
20 | } | 31 | } |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 7ddff3f55087..938bc1b6c3fa 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -771,8 +771,6 @@ static int pci_netmos_init(struct pci_dev *dev) | |||
771 | } | 771 | } |
772 | 772 | ||
773 | /* | 773 | /* |
774 | * ITE support by Niels de Vos <niels.devos@wincor-nixdorf.com> | ||
775 | * | ||
776 | * These chips are available with optionally one parallel port and up to | 774 | * These chips are available with optionally one parallel port and up to |
777 | * two serial ports. Unfortunately they all have the same product id. | 775 | * two serial ports. Unfortunately they all have the same product id. |
778 | * | 776 | * |
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 18ba812a4f84..d86123e03391 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -166,7 +166,7 @@ static void bfin_serial_start_tx(struct uart_port *port) | |||
166 | struct tty_struct *tty = uart->port.info->port.tty; | 166 | struct tty_struct *tty = uart->port.info->port.tty; |
167 | 167 | ||
168 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS | 168 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS |
169 | if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { | 169 | if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { |
170 | uart->scts = 0; | 170 | uart->scts = 0; |
171 | uart_handle_cts_change(&uart->port, uart->scts); | 171 | uart_handle_cts_change(&uart->port, uart->scts); |
172 | } | 172 | } |
@@ -368,7 +368,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id) | |||
368 | struct bfin_serial_port *uart = dev_id; | 368 | struct bfin_serial_port *uart = dev_id; |
369 | 369 | ||
370 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS | 370 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS |
371 | if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { | 371 | if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { |
372 | uart->scts = 0; | 372 | uart->scts = 0; |
373 | uart_handle_cts_change(&uart->port, uart->scts); | 373 | uart_handle_cts_change(&uart->port, uart->scts); |
374 | } | 374 | } |
@@ -504,7 +504,7 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) | |||
504 | struct circ_buf *xmit = &uart->port.info->xmit; | 504 | struct circ_buf *xmit = &uart->port.info->xmit; |
505 | 505 | ||
506 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS | 506 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS |
507 | if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { | 507 | if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { |
508 | uart->scts = 0; | 508 | uart->scts = 0; |
509 | uart_handle_cts_change(&uart->port, uart->scts); | 509 | uart_handle_cts_change(&uart->port, uart->scts); |
510 | } | 510 | } |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index c76feea5fe25..885194a07418 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -213,7 +213,7 @@ static int flush(struct driver_data *drv_data) | |||
213 | while (read_SSSR(reg) & SSSR_RNE) { | 213 | while (read_SSSR(reg) & SSSR_RNE) { |
214 | read_SSDR(reg); | 214 | read_SSDR(reg); |
215 | } | 215 | } |
216 | } while ((read_SSSR(reg) & SSSR_BSY) && limit--); | 216 | } while ((read_SSSR(reg) & SSSR_BSY) && --limit); |
217 | write_SSSR(SSSR_ROR, reg); | 217 | write_SSSR(SSSR_ROR, reg); |
218 | 218 | ||
219 | return limit; | 219 | return limit; |
@@ -484,7 +484,7 @@ static int wait_ssp_rx_stall(void const __iomem *ioaddr) | |||
484 | { | 484 | { |
485 | unsigned long limit = loops_per_jiffy << 1; | 485 | unsigned long limit = loops_per_jiffy << 1; |
486 | 486 | ||
487 | while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--) | 487 | while ((read_SSSR(ioaddr) & SSSR_BSY) && --limit) |
488 | cpu_relax(); | 488 | cpu_relax(); |
489 | 489 | ||
490 | return limit; | 490 | return limit; |
@@ -494,7 +494,7 @@ static int wait_dma_channel_stop(int channel) | |||
494 | { | 494 | { |
495 | unsigned long limit = loops_per_jiffy << 1; | 495 | unsigned long limit = loops_per_jiffy << 1; |
496 | 496 | ||
497 | while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--) | 497 | while (!(DCSR(channel) & DCSR_STOPSTATE) && --limit) |
498 | cpu_relax(); | 498 | cpu_relax(); |
499 | 499 | ||
500 | return limit; | 500 | return limit; |
@@ -1700,6 +1700,13 @@ static int pxa2xx_spi_resume(struct platform_device *pdev) | |||
1700 | struct ssp_device *ssp = drv_data->ssp; | 1700 | struct ssp_device *ssp = drv_data->ssp; |
1701 | int status = 0; | 1701 | int status = 0; |
1702 | 1702 | ||
1703 | if (drv_data->rx_channel != -1) | ||
1704 | DRCMR(drv_data->ssp->drcmr_rx) = | ||
1705 | DRCMR_MAPVLD | drv_data->rx_channel; | ||
1706 | if (drv_data->tx_channel != -1) | ||
1707 | DRCMR(drv_data->ssp->drcmr_tx) = | ||
1708 | DRCMR_MAPVLD | drv_data->tx_channel; | ||
1709 | |||
1703 | /* Enable the SSP clock */ | 1710 | /* Enable the SSP clock */ |
1704 | clk_enable(ssp->clk); | 1711 | clk_enable(ssp->clk); |
1705 | 1712 | ||
diff --git a/drivers/staging/go7007/go7007-driver.c b/drivers/staging/go7007/go7007-driver.c index f47c0ce2849a..77b1e769ac92 100644 --- a/drivers/staging/go7007/go7007-driver.c +++ b/drivers/staging/go7007/go7007-driver.c | |||
@@ -191,8 +191,10 @@ int go7007_reset_encoder(struct go7007 *go) | |||
191 | /* | 191 | /* |
192 | * Attempt to instantiate an I2C client by ID, probably loading a module. | 192 | * Attempt to instantiate an I2C client by ID, probably loading a module. |
193 | */ | 193 | */ |
194 | static int init_i2c_module(struct i2c_adapter *adapter, int id, int addr) | 194 | static int init_i2c_module(struct i2c_adapter *adapter, const char *type, |
195 | int id, int addr) | ||
195 | { | 196 | { |
197 | struct i2c_board_info info; | ||
196 | char *modname; | 198 | char *modname; |
197 | 199 | ||
198 | switch (id) { | 200 | switch (id) { |
@@ -226,7 +228,11 @@ static int init_i2c_module(struct i2c_adapter *adapter, int id, int addr) | |||
226 | } | 228 | } |
227 | if (modname != NULL) | 229 | if (modname != NULL) |
228 | request_module(modname); | 230 | request_module(modname); |
229 | if (wis_i2c_probe_device(adapter, id, addr) == 1) | 231 | |
232 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
233 | info.addr = addr; | ||
234 | strlcpy(info.type, type, I2C_NAME_SIZE); | ||
235 | if (!i2c_new_device(adapter, &info)) | ||
230 | return 0; | 236 | return 0; |
231 | if (modname != NULL) | 237 | if (modname != NULL) |
232 | printk(KERN_INFO | 238 | printk(KERN_INFO |
@@ -266,6 +272,7 @@ int go7007_register_encoder(struct go7007 *go) | |||
266 | if (go->i2c_adapter_online) { | 272 | if (go->i2c_adapter_online) { |
267 | for (i = 0; i < go->board_info->num_i2c_devs; ++i) | 273 | for (i = 0; i < go->board_info->num_i2c_devs; ++i) |
268 | init_i2c_module(&go->i2c_adapter, | 274 | init_i2c_module(&go->i2c_adapter, |
275 | go->board_info->i2c_devs[i].type, | ||
269 | go->board_info->i2c_devs[i].id, | 276 | go->board_info->i2c_devs[i].id, |
270 | go->board_info->i2c_devs[i].addr); | 277 | go->board_info->i2c_devs[i].addr); |
271 | if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) | 278 | if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) |
diff --git a/drivers/staging/go7007/go7007-i2c.c b/drivers/staging/go7007/go7007-i2c.c index cd55b76eabc7..c82867fdd28d 100644 --- a/drivers/staging/go7007/go7007-i2c.c +++ b/drivers/staging/go7007/go7007-i2c.c | |||
@@ -31,87 +31,6 @@ | |||
31 | #include "go7007-priv.h" | 31 | #include "go7007-priv.h" |
32 | #include "wis-i2c.h" | 32 | #include "wis-i2c.h" |
33 | 33 | ||
34 | /************** Registration interface for I2C client drivers **************/ | ||
35 | |||
36 | /* Since there's no way to auto-probe the I2C devices connected to the I2C | ||
37 | * bus on the go7007, we have this silly little registration system that | ||
38 | * client drivers can use to register their I2C driver ID and their | ||
39 | * detect_client function (the one that's normally passed to i2c_probe). | ||
40 | * | ||
41 | * When a new go7007 device is connected, we can look up in a board info | ||
42 | * table by the USB or PCI vendor/product/revision ID to determine | ||
43 | * which I2C client module to load. The client driver module will register | ||
44 | * itself here, and then we can call the registered detect_client function | ||
45 | * to force-load a new client at the address listed in the board info table. | ||
46 | * | ||
47 | * Really the I2C subsystem should have a way to force-load I2C client | ||
48 | * drivers when we have a priori knowledge of what's on the bus, especially | ||
49 | * since the existing I2C auto-probe mechanism is so hokey, but we'll use | ||
50 | * our own mechanism for the time being. */ | ||
51 | |||
52 | struct wis_i2c_client_driver { | ||
53 | unsigned int id; | ||
54 | found_proc found_proc; | ||
55 | struct list_head list; | ||
56 | }; | ||
57 | |||
58 | static LIST_HEAD(i2c_client_drivers); | ||
59 | static DECLARE_MUTEX(i2c_client_driver_list_lock); | ||
60 | |||
61 | /* Client drivers register here by their I2C driver ID */ | ||
62 | int wis_i2c_add_driver(unsigned int id, found_proc found_proc) | ||
63 | { | ||
64 | struct wis_i2c_client_driver *driver; | ||
65 | |||
66 | driver = kmalloc(sizeof(struct wis_i2c_client_driver), GFP_KERNEL); | ||
67 | if (driver == NULL) | ||
68 | return -ENOMEM; | ||
69 | driver->id = id; | ||
70 | driver->found_proc = found_proc; | ||
71 | |||
72 | down(&i2c_client_driver_list_lock); | ||
73 | list_add_tail(&driver->list, &i2c_client_drivers); | ||
74 | up(&i2c_client_driver_list_lock); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | EXPORT_SYMBOL(wis_i2c_add_driver); | ||
79 | |||
80 | void wis_i2c_del_driver(found_proc found_proc) | ||
81 | { | ||
82 | struct wis_i2c_client_driver *driver, *next; | ||
83 | |||
84 | down(&i2c_client_driver_list_lock); | ||
85 | list_for_each_entry_safe(driver, next, &i2c_client_drivers, list) | ||
86 | if (driver->found_proc == found_proc) { | ||
87 | list_del(&driver->list); | ||
88 | kfree(driver); | ||
89 | } | ||
90 | up(&i2c_client_driver_list_lock); | ||
91 | } | ||
92 | EXPORT_SYMBOL(wis_i2c_del_driver); | ||
93 | |||
94 | /* The main go7007 driver calls this to instantiate a client by driver | ||
95 | * ID and bus address, which are both stored in the board info table */ | ||
96 | int wis_i2c_probe_device(struct i2c_adapter *adapter, | ||
97 | unsigned int id, int addr) | ||
98 | { | ||
99 | struct wis_i2c_client_driver *driver; | ||
100 | int found = 0; | ||
101 | |||
102 | if (addr < 0 || addr > 0x7f) | ||
103 | return -1; | ||
104 | down(&i2c_client_driver_list_lock); | ||
105 | list_for_each_entry(driver, &i2c_client_drivers, list) | ||
106 | if (driver->id == id) { | ||
107 | if (driver->found_proc(adapter, addr, 0) == 0) | ||
108 | found = 1; | ||
109 | break; | ||
110 | } | ||
111 | up(&i2c_client_driver_list_lock); | ||
112 | return found; | ||
113 | } | ||
114 | |||
115 | /********************* Driver for on-board I2C adapter *********************/ | 34 | /********************* Driver for on-board I2C adapter *********************/ |
116 | 35 | ||
117 | /* #define GO7007_I2C_DEBUG */ | 36 | /* #define GO7007_I2C_DEBUG */ |
@@ -287,9 +206,7 @@ static struct i2c_algorithm go7007_algo = { | |||
287 | 206 | ||
288 | static struct i2c_adapter go7007_adap_templ = { | 207 | static struct i2c_adapter go7007_adap_templ = { |
289 | .owner = THIS_MODULE, | 208 | .owner = THIS_MODULE, |
290 | .class = I2C_CLASS_TV_ANALOG, | ||
291 | .name = "WIS GO7007SB", | 209 | .name = "WIS GO7007SB", |
292 | .id = I2C_ALGO_GO7007, | ||
293 | .algo = &go7007_algo, | 210 | .algo = &go7007_algo, |
294 | }; | 211 | }; |
295 | 212 | ||
diff --git a/drivers/staging/go7007/go7007-priv.h b/drivers/staging/go7007/go7007-priv.h index 372f1f1c09b2..178d18119faa 100644 --- a/drivers/staging/go7007/go7007-priv.h +++ b/drivers/staging/go7007/go7007-priv.h | |||
@@ -87,6 +87,7 @@ struct go7007_board_info { | |||
87 | int audio_main_div; | 87 | int audio_main_div; |
88 | int num_i2c_devs; | 88 | int num_i2c_devs; |
89 | struct { | 89 | struct { |
90 | const char *type; | ||
90 | int id; | 91 | int id; |
91 | int addr; | 92 | int addr; |
92 | } i2c_devs[4]; | 93 | } i2c_devs[4]; |
diff --git a/drivers/staging/go7007/go7007-usb.c b/drivers/staging/go7007/go7007-usb.c index 83eec920c7d3..aa4a9e0b9954 100644 --- a/drivers/staging/go7007/go7007-usb.c +++ b/drivers/staging/go7007/go7007-usb.c | |||
@@ -91,6 +91,7 @@ static struct go7007_usb_board board_matrix_ii = { | |||
91 | .num_i2c_devs = 1, | 91 | .num_i2c_devs = 1, |
92 | .i2c_devs = { | 92 | .i2c_devs = { |
93 | { | 93 | { |
94 | .type = "wis_saa7115", | ||
94 | .id = I2C_DRIVERID_WIS_SAA7115, | 95 | .id = I2C_DRIVERID_WIS_SAA7115, |
95 | .addr = 0x20, | 96 | .addr = 0x20, |
96 | }, | 97 | }, |
@@ -127,6 +128,7 @@ static struct go7007_usb_board board_matrix_reload = { | |||
127 | .num_i2c_devs = 1, | 128 | .num_i2c_devs = 1, |
128 | .i2c_devs = { | 129 | .i2c_devs = { |
129 | { | 130 | { |
131 | .type = "wis_saa7113", | ||
130 | .id = I2C_DRIVERID_WIS_SAA7113, | 132 | .id = I2C_DRIVERID_WIS_SAA7113, |
131 | .addr = 0x25, | 133 | .addr = 0x25, |
132 | }, | 134 | }, |
@@ -164,6 +166,7 @@ static struct go7007_usb_board board_star_trek = { | |||
164 | .num_i2c_devs = 1, | 166 | .num_i2c_devs = 1, |
165 | .i2c_devs = { | 167 | .i2c_devs = { |
166 | { | 168 | { |
169 | .type = "wis_saa7115", | ||
167 | .id = I2C_DRIVERID_WIS_SAA7115, | 170 | .id = I2C_DRIVERID_WIS_SAA7115, |
168 | .addr = 0x20, | 171 | .addr = 0x20, |
169 | }, | 172 | }, |
@@ -209,14 +212,17 @@ static struct go7007_usb_board board_px_tv402u = { | |||
209 | .num_i2c_devs = 3, | 212 | .num_i2c_devs = 3, |
210 | .i2c_devs = { | 213 | .i2c_devs = { |
211 | { | 214 | { |
215 | .type = "wis_saa7115", | ||
212 | .id = I2C_DRIVERID_WIS_SAA7115, | 216 | .id = I2C_DRIVERID_WIS_SAA7115, |
213 | .addr = 0x20, | 217 | .addr = 0x20, |
214 | }, | 218 | }, |
215 | { | 219 | { |
220 | .type = "wis_uda1342", | ||
216 | .id = I2C_DRIVERID_WIS_UDA1342, | 221 | .id = I2C_DRIVERID_WIS_UDA1342, |
217 | .addr = 0x1a, | 222 | .addr = 0x1a, |
218 | }, | 223 | }, |
219 | { | 224 | { |
225 | .type = "wis_sony_tuner", | ||
220 | .id = I2C_DRIVERID_WIS_SONY_TUNER, | 226 | .id = I2C_DRIVERID_WIS_SONY_TUNER, |
221 | .addr = 0x60, | 227 | .addr = 0x60, |
222 | }, | 228 | }, |
@@ -264,6 +270,7 @@ static struct go7007_usb_board board_xmen = { | |||
264 | .num_i2c_devs = 1, | 270 | .num_i2c_devs = 1, |
265 | .i2c_devs = { | 271 | .i2c_devs = { |
266 | { | 272 | { |
273 | .type = "wis_ov7640", | ||
267 | .id = I2C_DRIVERID_WIS_OV7640, | 274 | .id = I2C_DRIVERID_WIS_OV7640, |
268 | .addr = 0x21, | 275 | .addr = 0x21, |
269 | }, | 276 | }, |
@@ -296,6 +303,7 @@ static struct go7007_usb_board board_matrix_revolution = { | |||
296 | .num_i2c_devs = 1, | 303 | .num_i2c_devs = 1, |
297 | .i2c_devs = { | 304 | .i2c_devs = { |
298 | { | 305 | { |
306 | .type = "wis_tw9903", | ||
299 | .id = I2C_DRIVERID_WIS_TW9903, | 307 | .id = I2C_DRIVERID_WIS_TW9903, |
300 | .addr = 0x44, | 308 | .addr = 0x44, |
301 | }, | 309 | }, |
@@ -385,6 +393,7 @@ static struct go7007_usb_board board_adlink_mpg24 = { | |||
385 | .num_i2c_devs = 1, | 393 | .num_i2c_devs = 1, |
386 | .i2c_devs = { | 394 | .i2c_devs = { |
387 | { | 395 | { |
396 | .type = "wis_twTW2804", | ||
388 | .id = I2C_DRIVERID_WIS_TW2804, | 397 | .id = I2C_DRIVERID_WIS_TW2804, |
389 | .addr = 0x00, /* yes, really */ | 398 | .addr = 0x00, /* yes, really */ |
390 | }, | 399 | }, |
@@ -415,8 +424,9 @@ static struct go7007_usb_board board_sensoray_2250 = { | |||
415 | .num_i2c_devs = 1, | 424 | .num_i2c_devs = 1, |
416 | .i2c_devs = { | 425 | .i2c_devs = { |
417 | { | 426 | { |
427 | .type = "s2250_board", | ||
418 | .id = I2C_DRIVERID_S2250, | 428 | .id = I2C_DRIVERID_S2250, |
419 | .addr = 0x34, | 429 | .addr = 0x43, |
420 | }, | 430 | }, |
421 | }, | 431 | }, |
422 | .num_inputs = 2, | 432 | .num_inputs = 2, |
@@ -943,9 +953,7 @@ static struct i2c_algorithm go7007_usb_algo = { | |||
943 | 953 | ||
944 | static struct i2c_adapter go7007_usb_adap_templ = { | 954 | static struct i2c_adapter go7007_usb_adap_templ = { |
945 | .owner = THIS_MODULE, | 955 | .owner = THIS_MODULE, |
946 | .class = I2C_CLASS_TV_ANALOG, | ||
947 | .name = "WIS GO7007SB EZ-USB", | 956 | .name = "WIS GO7007SB EZ-USB", |
948 | .id = I2C_ALGO_GO7007_USB, | ||
949 | .algo = &go7007_usb_algo, | 957 | .algo = &go7007_usb_algo, |
950 | }; | 958 | }; |
951 | 959 | ||
diff --git a/drivers/staging/go7007/s2250-board.c b/drivers/staging/go7007/s2250-board.c index d333ea2cd774..1706fbf06847 100644 --- a/drivers/staging/go7007/s2250-board.c +++ b/drivers/staging/go7007/s2250-board.c | |||
@@ -28,7 +28,6 @@ extern int s2250loader_init(void); | |||
28 | extern void s2250loader_cleanup(void); | 28 | extern void s2250loader_cleanup(void); |
29 | 29 | ||
30 | #define TLV320_ADDRESS 0x34 | 30 | #define TLV320_ADDRESS 0x34 |
31 | #define S2250_VIDDEC 0x86 | ||
32 | #define VPX322_ADDR_ANALOGCONTROL1 0x02 | 31 | #define VPX322_ADDR_ANALOGCONTROL1 0x02 |
33 | #define VPX322_ADDR_BRIGHTNESS0 0x0127 | 32 | #define VPX322_ADDR_BRIGHTNESS0 0x0127 |
34 | #define VPX322_ADDR_BRIGHTNESS1 0x0131 | 33 | #define VPX322_ADDR_BRIGHTNESS1 0x0131 |
@@ -123,6 +122,7 @@ struct s2250 { | |||
123 | int hue; | 122 | int hue; |
124 | int reg12b_val; | 123 | int reg12b_val; |
125 | int audio_input; | 124 | int audio_input; |
125 | struct i2c_client *audio; | ||
126 | }; | 126 | }; |
127 | 127 | ||
128 | /* from go7007-usb.c which is Copyright (C) 2005-2006 Micronas USA Inc.*/ | 128 | /* from go7007-usb.c which is Copyright (C) 2005-2006 Micronas USA Inc.*/ |
@@ -452,16 +452,15 @@ static int s2250_command(struct i2c_client *client, | |||
452 | { | 452 | { |
453 | struct v4l2_audio *audio = arg; | 453 | struct v4l2_audio *audio = arg; |
454 | 454 | ||
455 | client->addr = TLV320_ADDRESS; | ||
456 | switch (audio->index) { | 455 | switch (audio->index) { |
457 | case 0: | 456 | case 0: |
458 | write_reg(client, 0x08, 0x02); /* Line In */ | 457 | write_reg(dec->audio, 0x08, 0x02); /* Line In */ |
459 | break; | 458 | break; |
460 | case 1: | 459 | case 1: |
461 | write_reg(client, 0x08, 0x04); /* Mic */ | 460 | write_reg(dec->audio, 0x08, 0x04); /* Mic */ |
462 | break; | 461 | break; |
463 | case 2: | 462 | case 2: |
464 | write_reg(client, 0x08, 0x05); /* Mic Boost */ | 463 | write_reg(dec->audio, 0x08, 0x05); /* Mic Boost */ |
465 | break; | 464 | break; |
466 | default: | 465 | default: |
467 | return -EINVAL; | 466 | return -EINVAL; |
@@ -477,31 +476,23 @@ static int s2250_command(struct i2c_client *client, | |||
477 | return 0; | 476 | return 0; |
478 | } | 477 | } |
479 | 478 | ||
480 | static struct i2c_driver s2250_driver; | 479 | static int s2250_probe(struct i2c_client *client, |
481 | 480 | const struct i2c_device_id *id) | |
482 | static struct i2c_client s2250_client_templ = { | ||
483 | .name = "Sensoray 2250", | ||
484 | .driver = &s2250_driver, | ||
485 | }; | ||
486 | |||
487 | static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
488 | { | 481 | { |
489 | struct i2c_client *client; | 482 | struct i2c_client *audio; |
483 | struct i2c_adapter *adapter = client->adapter; | ||
490 | struct s2250 *dec; | 484 | struct s2250 *dec; |
491 | u8 *data; | 485 | u8 *data; |
492 | struct go7007 *go = i2c_get_adapdata(adapter); | 486 | struct go7007 *go = i2c_get_adapdata(adapter); |
493 | struct go7007_usb *usb = go->hpi_context; | 487 | struct go7007_usb *usb = go->hpi_context; |
494 | 488 | ||
495 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 489 | audio = i2c_new_dummy(adapter, TLV320_ADDRESS >> 1); |
496 | if (client == NULL) | 490 | if (audio == NULL) |
497 | return -ENOMEM; | 491 | return -ENOMEM; |
498 | memcpy(client, &s2250_client_templ, | ||
499 | sizeof(s2250_client_templ)); | ||
500 | client->adapter = adapter; | ||
501 | 492 | ||
502 | dec = kmalloc(sizeof(struct s2250), GFP_KERNEL); | 493 | dec = kmalloc(sizeof(struct s2250), GFP_KERNEL); |
503 | if (dec == NULL) { | 494 | if (dec == NULL) { |
504 | kfree(client); | 495 | i2c_unregister_device(audio); |
505 | return -ENOMEM; | 496 | return -ENOMEM; |
506 | } | 497 | } |
507 | 498 | ||
@@ -510,7 +501,7 @@ static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
510 | dec->contrast = 50; | 501 | dec->contrast = 50; |
511 | dec->saturation = 50; | 502 | dec->saturation = 50; |
512 | dec->hue = 0; | 503 | dec->hue = 0; |
513 | client->addr = TLV320_ADDRESS; | 504 | dec->audio = audio; |
514 | i2c_set_clientdata(client, dec); | 505 | i2c_set_clientdata(client, dec); |
515 | 506 | ||
516 | printk(KERN_DEBUG | 507 | printk(KERN_DEBUG |
@@ -518,28 +509,25 @@ static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
518 | adapter->name); | 509 | adapter->name); |
519 | 510 | ||
520 | /* initialize the audio */ | 511 | /* initialize the audio */ |
521 | client->addr = TLV320_ADDRESS; | 512 | if (write_regs(audio, aud_regs) < 0) { |
522 | if (write_regs(client, aud_regs) < 0) { | ||
523 | printk(KERN_ERR | 513 | printk(KERN_ERR |
524 | "s2250: error initializing audio\n"); | 514 | "s2250: error initializing audio\n"); |
525 | kfree(client); | 515 | i2c_unregister_device(audio); |
526 | kfree(dec); | 516 | kfree(dec); |
527 | return 0; | 517 | return 0; |
528 | } | 518 | } |
529 | client->addr = S2250_VIDDEC; | ||
530 | i2c_set_clientdata(client, dec); | ||
531 | 519 | ||
532 | if (write_regs(client, vid_regs) < 0) { | 520 | if (write_regs(client, vid_regs) < 0) { |
533 | printk(KERN_ERR | 521 | printk(KERN_ERR |
534 | "s2250: error initializing decoder\n"); | 522 | "s2250: error initializing decoder\n"); |
535 | kfree(client); | 523 | i2c_unregister_device(audio); |
536 | kfree(dec); | 524 | kfree(dec); |
537 | return 0; | 525 | return 0; |
538 | } | 526 | } |
539 | if (write_regs_fp(client, vid_regs_fp) < 0) { | 527 | if (write_regs_fp(client, vid_regs_fp) < 0) { |
540 | printk(KERN_ERR | 528 | printk(KERN_ERR |
541 | "s2250: error initializing decoder\n"); | 529 | "s2250: error initializing decoder\n"); |
542 | kfree(client); | 530 | i2c_unregister_device(audio); |
543 | kfree(dec); | 531 | kfree(dec); |
544 | return 0; | 532 | return 0; |
545 | } | 533 | } |
@@ -575,32 +563,33 @@ static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
575 | up(&usb->i2c_lock); | 563 | up(&usb->i2c_lock); |
576 | } | 564 | } |
577 | 565 | ||
578 | i2c_attach_client(client); | ||
579 | printk("s2250: initialized successfully\n"); | 566 | printk("s2250: initialized successfully\n"); |
580 | return 0; | 567 | return 0; |
581 | } | 568 | } |
582 | 569 | ||
583 | static int s2250_detach(struct i2c_client *client) | 570 | static int s2250_remove(struct i2c_client *client) |
584 | { | 571 | { |
585 | struct s2250 *dec = i2c_get_clientdata(client); | 572 | struct s2250 *dec = i2c_get_clientdata(client); |
586 | int r; | ||
587 | |||
588 | r = i2c_detach_client(client); | ||
589 | if (r < 0) | ||
590 | return r; | ||
591 | 573 | ||
592 | kfree(client); | 574 | i2c_set_clientdata(client, NULL); |
575 | i2c_unregister_device(dec->audio); | ||
593 | kfree(dec); | 576 | kfree(dec); |
594 | return 0; | 577 | return 0; |
595 | } | 578 | } |
596 | 579 | ||
580 | static struct i2c_device_id s2250_id[] = { | ||
581 | { "s2250_board", 0 }, | ||
582 | { } | ||
583 | }; | ||
584 | |||
597 | static struct i2c_driver s2250_driver = { | 585 | static struct i2c_driver s2250_driver = { |
598 | .driver = { | 586 | .driver = { |
599 | .name = "Sensoray 2250 board driver", | 587 | .name = "Sensoray 2250 board driver", |
600 | }, | 588 | }, |
601 | .id = I2C_DRIVERID_S2250, | 589 | .probe = s2250_probe, |
602 | .detach_client = s2250_detach, | 590 | .remove = s2250_remove, |
603 | .command = s2250_command, | 591 | .command = s2250_command, |
592 | .id_table = s2250_id, | ||
604 | }; | 593 | }; |
605 | 594 | ||
606 | static int __init s2250_init(void) | 595 | static int __init s2250_init(void) |
@@ -613,13 +602,13 @@ static int __init s2250_init(void) | |||
613 | 602 | ||
614 | r = i2c_add_driver(&s2250_driver); | 603 | r = i2c_add_driver(&s2250_driver); |
615 | if (r < 0) | 604 | if (r < 0) |
616 | return r; | 605 | s2250loader_cleanup(); |
617 | return wis_i2c_add_driver(s2250_driver.id, s2250_detect); | 606 | |
607 | return r; | ||
618 | } | 608 | } |
619 | 609 | ||
620 | static void __exit s2250_cleanup(void) | 610 | static void __exit s2250_cleanup(void) |
621 | { | 611 | { |
622 | wis_i2c_del_driver(s2250_detect); | ||
623 | i2c_del_driver(&s2250_driver); | 612 | i2c_del_driver(&s2250_driver); |
624 | 613 | ||
625 | s2250loader_cleanup(); | 614 | s2250loader_cleanup(); |
diff --git a/drivers/staging/go7007/wis-i2c.h b/drivers/staging/go7007/wis-i2c.h index 431f41dd3966..3c2b9be455df 100644 --- a/drivers/staging/go7007/wis-i2c.h +++ b/drivers/staging/go7007/wis-i2c.h | |||
@@ -24,21 +24,12 @@ | |||
24 | #define I2C_DRIVERID_WIS_OV7640 0xf0f5 | 24 | #define I2C_DRIVERID_WIS_OV7640 0xf0f5 |
25 | #define I2C_DRIVERID_WIS_TW2804 0xf0f6 | 25 | #define I2C_DRIVERID_WIS_TW2804 0xf0f6 |
26 | #define I2C_DRIVERID_S2250 0xf0f7 | 26 | #define I2C_DRIVERID_S2250 0xf0f7 |
27 | #define I2C_ALGO_GO7007 0xf00000 | ||
28 | #define I2C_ALGO_GO7007_USB 0xf10000 | ||
29 | 27 | ||
30 | /* Flag to indicate that the client needs to be accessed with SCCB semantics */ | 28 | /* Flag to indicate that the client needs to be accessed with SCCB semantics */ |
31 | /* We re-use the I2C_M_TEN value so the flag passes through the masks in the | 29 | /* We re-use the I2C_M_TEN value so the flag passes through the masks in the |
32 | * core I2C code. Major kludge, but the I2C layer ain't exactly flexible. */ | 30 | * core I2C code. Major kludge, but the I2C layer ain't exactly flexible. */ |
33 | #define I2C_CLIENT_SCCB 0x10 | 31 | #define I2C_CLIENT_SCCB 0x10 |
34 | 32 | ||
35 | typedef int (*found_proc) (struct i2c_adapter *, int, int); | ||
36 | int wis_i2c_add_driver(unsigned int id, found_proc found_proc); | ||
37 | void wis_i2c_del_driver(found_proc found_proc); | ||
38 | |||
39 | int wis_i2c_probe_device(struct i2c_adapter *adapter, | ||
40 | unsigned int id, int addr); | ||
41 | |||
42 | /* Definitions for new video decoder commands */ | 33 | /* Definitions for new video decoder commands */ |
43 | 34 | ||
44 | struct video_decoder_resolution { | 35 | struct video_decoder_resolution { |
diff --git a/drivers/staging/go7007/wis-ov7640.c b/drivers/staging/go7007/wis-ov7640.c index 2f9efca04606..04d6d3a498a3 100644 --- a/drivers/staging/go7007/wis-ov7640.c +++ b/drivers/staging/go7007/wis-ov7640.c | |||
@@ -50,76 +50,54 @@ static int write_regs(struct i2c_client *client, u8 *regs) | |||
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
52 | 52 | ||
53 | static struct i2c_driver wis_ov7640_driver; | 53 | static int wis_ov7640_probe(struct i2c_client *client, |
54 | 54 | const struct i2c_device_id *id) | |
55 | static struct i2c_client wis_ov7640_client_templ = { | ||
56 | .name = "OV7640 (WIS)", | ||
57 | .driver = &wis_ov7640_driver, | ||
58 | }; | ||
59 | |||
60 | static int wis_ov7640_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
61 | { | 55 | { |
62 | struct i2c_client *client; | 56 | struct i2c_adapter *adapter = client->adapter; |
63 | 57 | ||
64 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 58 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
65 | return 0; | 59 | return -ENODEV; |
66 | 60 | ||
67 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
68 | if (client == NULL) | ||
69 | return -ENOMEM; | ||
70 | memcpy(client, &wis_ov7640_client_templ, | ||
71 | sizeof(wis_ov7640_client_templ)); | ||
72 | client->adapter = adapter; | ||
73 | client->addr = addr; | ||
74 | client->flags = I2C_CLIENT_SCCB; | 61 | client->flags = I2C_CLIENT_SCCB; |
75 | 62 | ||
76 | printk(KERN_DEBUG | 63 | printk(KERN_DEBUG |
77 | "wis-ov7640: initializing OV7640 at address %d on %s\n", | 64 | "wis-ov7640: initializing OV7640 at address %d on %s\n", |
78 | addr, adapter->name); | 65 | client->addr, adapter->name); |
79 | 66 | ||
80 | if (write_regs(client, initial_registers) < 0) { | 67 | if (write_regs(client, initial_registers) < 0) { |
81 | printk(KERN_ERR "wis-ov7640: error initializing OV7640\n"); | 68 | printk(KERN_ERR "wis-ov7640: error initializing OV7640\n"); |
82 | kfree(client); | 69 | return -ENODEV; |
83 | return 0; | ||
84 | } | 70 | } |
85 | 71 | ||
86 | i2c_attach_client(client); | ||
87 | return 0; | 72 | return 0; |
88 | } | 73 | } |
89 | 74 | ||
90 | static int wis_ov7640_detach(struct i2c_client *client) | 75 | static int wis_ov7640_remove(struct i2c_client *client) |
91 | { | 76 | { |
92 | int r; | ||
93 | |||
94 | r = i2c_detach_client(client); | ||
95 | if (r < 0) | ||
96 | return r; | ||
97 | |||
98 | kfree(client); | ||
99 | return 0; | 77 | return 0; |
100 | } | 78 | } |
101 | 79 | ||
80 | static struct i2c_device_id wis_ov7640_id[] = { | ||
81 | { "wis_ov7640", 0 }, | ||
82 | { } | ||
83 | }; | ||
84 | |||
102 | static struct i2c_driver wis_ov7640_driver = { | 85 | static struct i2c_driver wis_ov7640_driver = { |
103 | .driver = { | 86 | .driver = { |
104 | .name = "WIS OV7640 I2C driver", | 87 | .name = "WIS OV7640 I2C driver", |
105 | }, | 88 | }, |
106 | .id = I2C_DRIVERID_WIS_OV7640, | 89 | .probe = wis_ov7640_probe, |
107 | .detach_client = wis_ov7640_detach, | 90 | .remove = wis_ov7640_remove, |
91 | .id_table = wis_ov7640_id, | ||
108 | }; | 92 | }; |
109 | 93 | ||
110 | static int __init wis_ov7640_init(void) | 94 | static int __init wis_ov7640_init(void) |
111 | { | 95 | { |
112 | int r; | 96 | return i2c_add_driver(&wis_ov7640_driver); |
113 | |||
114 | r = i2c_add_driver(&wis_ov7640_driver); | ||
115 | if (r < 0) | ||
116 | return r; | ||
117 | return wis_i2c_add_driver(wis_ov7640_driver.id, wis_ov7640_detect); | ||
118 | } | 97 | } |
119 | 98 | ||
120 | static void __exit wis_ov7640_cleanup(void) | 99 | static void __exit wis_ov7640_cleanup(void) |
121 | { | 100 | { |
122 | wis_i2c_del_driver(wis_ov7640_detect); | ||
123 | i2c_del_driver(&wis_ov7640_driver); | 101 | i2c_del_driver(&wis_ov7640_driver); |
124 | } | 102 | } |
125 | 103 | ||
diff --git a/drivers/staging/go7007/wis-saa7113.c b/drivers/staging/go7007/wis-saa7113.c index 11689723945e..9ab893bd204e 100644 --- a/drivers/staging/go7007/wis-saa7113.c +++ b/drivers/staging/go7007/wis-saa7113.c | |||
@@ -261,34 +261,19 @@ static int wis_saa7113_command(struct i2c_client *client, | |||
261 | return 0; | 261 | return 0; |
262 | } | 262 | } |
263 | 263 | ||
264 | static struct i2c_driver wis_saa7113_driver; | 264 | static int wis_saa7113_probe(struct i2c_client *client, |
265 | 265 | const struct i2c_device_id *id) | |
266 | static struct i2c_client wis_saa7113_client_templ = { | ||
267 | .name = "SAA7113 (WIS)", | ||
268 | .driver = &wis_saa7113_driver, | ||
269 | }; | ||
270 | |||
271 | static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
272 | { | 266 | { |
273 | struct i2c_client *client; | 267 | struct i2c_adapter *adapter = client->adapter; |
274 | struct wis_saa7113 *dec; | 268 | struct wis_saa7113 *dec; |
275 | 269 | ||
276 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 270 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
277 | return 0; | 271 | return -ENODEV; |
278 | |||
279 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
280 | if (client == NULL) | ||
281 | return -ENOMEM; | ||
282 | memcpy(client, &wis_saa7113_client_templ, | ||
283 | sizeof(wis_saa7113_client_templ)); | ||
284 | client->adapter = adapter; | ||
285 | client->addr = addr; | ||
286 | 272 | ||
287 | dec = kmalloc(sizeof(struct wis_saa7113), GFP_KERNEL); | 273 | dec = kmalloc(sizeof(struct wis_saa7113), GFP_KERNEL); |
288 | if (dec == NULL) { | 274 | if (dec == NULL) |
289 | kfree(client); | ||
290 | return -ENOMEM; | 275 | return -ENOMEM; |
291 | } | 276 | |
292 | dec->norm = V4L2_STD_NTSC; | 277 | dec->norm = V4L2_STD_NTSC; |
293 | dec->brightness = 128; | 278 | dec->brightness = 128; |
294 | dec->contrast = 71; | 279 | dec->contrast = 71; |
@@ -298,56 +283,49 @@ static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
298 | 283 | ||
299 | printk(KERN_DEBUG | 284 | printk(KERN_DEBUG |
300 | "wis-saa7113: initializing SAA7113 at address %d on %s\n", | 285 | "wis-saa7113: initializing SAA7113 at address %d on %s\n", |
301 | addr, adapter->name); | 286 | client->addr, adapter->name); |
302 | 287 | ||
303 | if (write_regs(client, initial_registers) < 0) { | 288 | if (write_regs(client, initial_registers) < 0) { |
304 | printk(KERN_ERR | 289 | printk(KERN_ERR |
305 | "wis-saa7113: error initializing SAA7113\n"); | 290 | "wis-saa7113: error initializing SAA7113\n"); |
306 | kfree(client); | ||
307 | kfree(dec); | 291 | kfree(dec); |
308 | return 0; | 292 | return -ENODEV; |
309 | } | 293 | } |
310 | 294 | ||
311 | i2c_attach_client(client); | ||
312 | return 0; | 295 | return 0; |
313 | } | 296 | } |
314 | 297 | ||
315 | static int wis_saa7113_detach(struct i2c_client *client) | 298 | static int wis_saa7113_remove(struct i2c_client *client) |
316 | { | 299 | { |
317 | struct wis_saa7113 *dec = i2c_get_clientdata(client); | 300 | struct wis_saa7113 *dec = i2c_get_clientdata(client); |
318 | int r; | ||
319 | |||
320 | r = i2c_detach_client(client); | ||
321 | if (r < 0) | ||
322 | return r; | ||
323 | 301 | ||
324 | kfree(client); | 302 | i2c_set_clientdata(client, NULL); |
325 | kfree(dec); | 303 | kfree(dec); |
326 | return 0; | 304 | return 0; |
327 | } | 305 | } |
328 | 306 | ||
307 | static struct i2c_device_id wis_saa7113_id[] = { | ||
308 | { "wis_saa7113", 0 }, | ||
309 | { } | ||
310 | }; | ||
311 | |||
329 | static struct i2c_driver wis_saa7113_driver = { | 312 | static struct i2c_driver wis_saa7113_driver = { |
330 | .driver = { | 313 | .driver = { |
331 | .name = "WIS SAA7113 I2C driver", | 314 | .name = "WIS SAA7113 I2C driver", |
332 | }, | 315 | }, |
333 | .id = I2C_DRIVERID_WIS_SAA7113, | 316 | .probe = wis_saa7113_probe, |
334 | .detach_client = wis_saa7113_detach, | 317 | .remove = wis_saa7113_remove, |
335 | .command = wis_saa7113_command, | 318 | .command = wis_saa7113_command, |
319 | .id_table = wis_saa7113_id, | ||
336 | }; | 320 | }; |
337 | 321 | ||
338 | static int __init wis_saa7113_init(void) | 322 | static int __init wis_saa7113_init(void) |
339 | { | 323 | { |
340 | int r; | 324 | return i2c_add_driver(&wis_saa7113_driver); |
341 | |||
342 | r = i2c_add_driver(&wis_saa7113_driver); | ||
343 | if (r < 0) | ||
344 | return r; | ||
345 | return wis_i2c_add_driver(wis_saa7113_driver.id, wis_saa7113_detect); | ||
346 | } | 325 | } |
347 | 326 | ||
348 | static void __exit wis_saa7113_cleanup(void) | 327 | static void __exit wis_saa7113_cleanup(void) |
349 | { | 328 | { |
350 | wis_i2c_del_driver(wis_saa7113_detect); | ||
351 | i2c_del_driver(&wis_saa7113_driver); | 329 | i2c_del_driver(&wis_saa7113_driver); |
352 | } | 330 | } |
353 | 331 | ||
diff --git a/drivers/staging/go7007/wis-saa7115.c b/drivers/staging/go7007/wis-saa7115.c index 59417a7174d7..8687ad2de761 100644 --- a/drivers/staging/go7007/wis-saa7115.c +++ b/drivers/staging/go7007/wis-saa7115.c | |||
@@ -394,34 +394,19 @@ static int wis_saa7115_command(struct i2c_client *client, | |||
394 | return 0; | 394 | return 0; |
395 | } | 395 | } |
396 | 396 | ||
397 | static struct i2c_driver wis_saa7115_driver; | 397 | static int wis_saa7115_probe(struct i2c_client *client, |
398 | 398 | const struct i2c_device_id *id) | |
399 | static struct i2c_client wis_saa7115_client_templ = { | ||
400 | .name = "SAA7115 (WIS)", | ||
401 | .driver = &wis_saa7115_driver, | ||
402 | }; | ||
403 | |||
404 | static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
405 | { | 399 | { |
406 | struct i2c_client *client; | 400 | struct i2c_adapter *adapter = client->adapter; |
407 | struct wis_saa7115 *dec; | 401 | struct wis_saa7115 *dec; |
408 | 402 | ||
409 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 403 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
410 | return 0; | 404 | return -ENODEV; |
411 | |||
412 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
413 | if (client == NULL) | ||
414 | return -ENOMEM; | ||
415 | memcpy(client, &wis_saa7115_client_templ, | ||
416 | sizeof(wis_saa7115_client_templ)); | ||
417 | client->adapter = adapter; | ||
418 | client->addr = addr; | ||
419 | 405 | ||
420 | dec = kmalloc(sizeof(struct wis_saa7115), GFP_KERNEL); | 406 | dec = kmalloc(sizeof(struct wis_saa7115), GFP_KERNEL); |
421 | if (dec == NULL) { | 407 | if (dec == NULL) |
422 | kfree(client); | ||
423 | return -ENOMEM; | 408 | return -ENOMEM; |
424 | } | 409 | |
425 | dec->norm = V4L2_STD_NTSC; | 410 | dec->norm = V4L2_STD_NTSC; |
426 | dec->brightness = 128; | 411 | dec->brightness = 128; |
427 | dec->contrast = 64; | 412 | dec->contrast = 64; |
@@ -431,56 +416,49 @@ static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
431 | 416 | ||
432 | printk(KERN_DEBUG | 417 | printk(KERN_DEBUG |
433 | "wis-saa7115: initializing SAA7115 at address %d on %s\n", | 418 | "wis-saa7115: initializing SAA7115 at address %d on %s\n", |
434 | addr, adapter->name); | 419 | client->addr, adapter->name); |
435 | 420 | ||
436 | if (write_regs(client, initial_registers) < 0) { | 421 | if (write_regs(client, initial_registers) < 0) { |
437 | printk(KERN_ERR | 422 | printk(KERN_ERR |
438 | "wis-saa7115: error initializing SAA7115\n"); | 423 | "wis-saa7115: error initializing SAA7115\n"); |
439 | kfree(client); | ||
440 | kfree(dec); | 424 | kfree(dec); |
441 | return 0; | 425 | return -ENODEV; |
442 | } | 426 | } |
443 | 427 | ||
444 | i2c_attach_client(client); | ||
445 | return 0; | 428 | return 0; |
446 | } | 429 | } |
447 | 430 | ||
448 | static int wis_saa7115_detach(struct i2c_client *client) | 431 | static int wis_saa7115_remove(struct i2c_client *client) |
449 | { | 432 | { |
450 | struct wis_saa7115 *dec = i2c_get_clientdata(client); | 433 | struct wis_saa7115 *dec = i2c_get_clientdata(client); |
451 | int r; | ||
452 | |||
453 | r = i2c_detach_client(client); | ||
454 | if (r < 0) | ||
455 | return r; | ||
456 | 434 | ||
457 | kfree(client); | 435 | i2c_set_clientdata(client, NULL); |
458 | kfree(dec); | 436 | kfree(dec); |
459 | return 0; | 437 | return 0; |
460 | } | 438 | } |
461 | 439 | ||
440 | static struct i2c_device_id wis_saa7115_id[] = { | ||
441 | { "wis_saa7115", 0 }, | ||
442 | { } | ||
443 | }; | ||
444 | |||
462 | static struct i2c_driver wis_saa7115_driver = { | 445 | static struct i2c_driver wis_saa7115_driver = { |
463 | .driver = { | 446 | .driver = { |
464 | .name = "WIS SAA7115 I2C driver", | 447 | .name = "WIS SAA7115 I2C driver", |
465 | }, | 448 | }, |
466 | .id = I2C_DRIVERID_WIS_SAA7115, | 449 | .probe = wis_saa7115_probe, |
467 | .detach_client = wis_saa7115_detach, | 450 | .remove = wis_saa7115_remove, |
468 | .command = wis_saa7115_command, | 451 | .command = wis_saa7115_command, |
452 | .id_table = wis_saa7115_id, | ||
469 | }; | 453 | }; |
470 | 454 | ||
471 | static int __init wis_saa7115_init(void) | 455 | static int __init wis_saa7115_init(void) |
472 | { | 456 | { |
473 | int r; | 457 | return i2c_add_driver(&wis_saa7115_driver); |
474 | |||
475 | r = i2c_add_driver(&wis_saa7115_driver); | ||
476 | if (r < 0) | ||
477 | return r; | ||
478 | return wis_i2c_add_driver(wis_saa7115_driver.id, wis_saa7115_detect); | ||
479 | } | 458 | } |
480 | 459 | ||
481 | static void __exit wis_saa7115_cleanup(void) | 460 | static void __exit wis_saa7115_cleanup(void) |
482 | { | 461 | { |
483 | wis_i2c_del_driver(wis_saa7115_detect); | ||
484 | i2c_del_driver(&wis_saa7115_driver); | 462 | i2c_del_driver(&wis_saa7115_driver); |
485 | } | 463 | } |
486 | 464 | ||
diff --git a/drivers/staging/go7007/wis-sony-tuner.c b/drivers/staging/go7007/wis-sony-tuner.c index 0a7eeef7c008..c965c601ac90 100644 --- a/drivers/staging/go7007/wis-sony-tuner.c +++ b/drivers/staging/go7007/wis-sony-tuner.c | |||
@@ -653,35 +653,19 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
653 | return 0; | 653 | return 0; |
654 | } | 654 | } |
655 | 655 | ||
656 | static struct i2c_driver wis_sony_tuner_driver; | 656 | static int wis_sony_tuner_probe(struct i2c_client *client, |
657 | 657 | const struct i2c_device_id *id) | |
658 | static struct i2c_client wis_sony_tuner_client_templ = { | ||
659 | .name = "Sony TV Tuner (WIS)", | ||
660 | .driver = &wis_sony_tuner_driver, | ||
661 | }; | ||
662 | |||
663 | static int wis_sony_tuner_detect(struct i2c_adapter *adapter, | ||
664 | int addr, int kind) | ||
665 | { | 658 | { |
666 | struct i2c_client *client; | 659 | struct i2c_adapter *adapter = client->adapter; |
667 | struct wis_sony_tuner *t; | 660 | struct wis_sony_tuner *t; |
668 | 661 | ||
669 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) | 662 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) |
670 | return 0; | 663 | return -ENODEV; |
671 | |||
672 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
673 | if (client == NULL) | ||
674 | return -ENOMEM; | ||
675 | memcpy(client, &wis_sony_tuner_client_templ, | ||
676 | sizeof(wis_sony_tuner_client_templ)); | ||
677 | client->adapter = adapter; | ||
678 | client->addr = addr; | ||
679 | 664 | ||
680 | t = kmalloc(sizeof(struct wis_sony_tuner), GFP_KERNEL); | 665 | t = kmalloc(sizeof(struct wis_sony_tuner), GFP_KERNEL); |
681 | if (t == NULL) { | 666 | if (t == NULL) |
682 | kfree(client); | ||
683 | return -ENOMEM; | 667 | return -ENOMEM; |
684 | } | 668 | |
685 | t->type = -1; | 669 | t->type = -1; |
686 | t->freq = 0; | 670 | t->freq = 0; |
687 | t->mpxmode = 0; | 671 | t->mpxmode = 0; |
@@ -690,50 +674,42 @@ static int wis_sony_tuner_detect(struct i2c_adapter *adapter, | |||
690 | 674 | ||
691 | printk(KERN_DEBUG | 675 | printk(KERN_DEBUG |
692 | "wis-sony-tuner: initializing tuner at address %d on %s\n", | 676 | "wis-sony-tuner: initializing tuner at address %d on %s\n", |
693 | addr, adapter->name); | 677 | client->addr, adapter->name); |
694 | |||
695 | i2c_attach_client(client); | ||
696 | 678 | ||
697 | return 0; | 679 | return 0; |
698 | } | 680 | } |
699 | 681 | ||
700 | static int wis_sony_tuner_detach(struct i2c_client *client) | 682 | static int wis_sony_tuner_remove(struct i2c_client *client) |
701 | { | 683 | { |
702 | struct wis_sony_tuner *t = i2c_get_clientdata(client); | 684 | struct wis_sony_tuner *t = i2c_get_clientdata(client); |
703 | int r; | ||
704 | |||
705 | r = i2c_detach_client(client); | ||
706 | if (r < 0) | ||
707 | return r; | ||
708 | 685 | ||
686 | i2c_set_clientdata(client, NULL); | ||
709 | kfree(t); | 687 | kfree(t); |
710 | kfree(client); | ||
711 | return 0; | 688 | return 0; |
712 | } | 689 | } |
713 | 690 | ||
691 | static struct i2c_device_id wis_sony_tuner_id[] = { | ||
692 | { "wis_sony_tuner", 0 }, | ||
693 | { } | ||
694 | }; | ||
695 | |||
714 | static struct i2c_driver wis_sony_tuner_driver = { | 696 | static struct i2c_driver wis_sony_tuner_driver = { |
715 | .driver = { | 697 | .driver = { |
716 | .name = "WIS Sony TV Tuner I2C driver", | 698 | .name = "WIS Sony TV Tuner I2C driver", |
717 | }, | 699 | }, |
718 | .id = I2C_DRIVERID_WIS_SONY_TUNER, | 700 | .probe = wis_sony_tuner_probe, |
719 | .detach_client = wis_sony_tuner_detach, | 701 | .remove = wis_sony_tuner_remove, |
720 | .command = tuner_command, | 702 | .command = tuner_command, |
703 | .id_table = wis_sony_tuner_id, | ||
721 | }; | 704 | }; |
722 | 705 | ||
723 | static int __init wis_sony_tuner_init(void) | 706 | static int __init wis_sony_tuner_init(void) |
724 | { | 707 | { |
725 | int r; | 708 | return i2c_add_driver(&wis_sony_tuner_driver); |
726 | |||
727 | r = i2c_add_driver(&wis_sony_tuner_driver); | ||
728 | if (r < 0) | ||
729 | return r; | ||
730 | return wis_i2c_add_driver(wis_sony_tuner_driver.id, | ||
731 | wis_sony_tuner_detect); | ||
732 | } | 709 | } |
733 | 710 | ||
734 | static void __exit wis_sony_tuner_cleanup(void) | 711 | static void __exit wis_sony_tuner_cleanup(void) |
735 | { | 712 | { |
736 | wis_i2c_del_driver(wis_sony_tuner_detect); | ||
737 | i2c_del_driver(&wis_sony_tuner_driver); | 713 | i2c_del_driver(&wis_sony_tuner_driver); |
738 | } | 714 | } |
739 | 715 | ||
diff --git a/drivers/staging/go7007/wis-tw2804.c b/drivers/staging/go7007/wis-tw2804.c index 57b8f2b1caa3..e15794a2a0ae 100644 --- a/drivers/staging/go7007/wis-tw2804.c +++ b/drivers/staging/go7007/wis-tw2804.c | |||
@@ -291,34 +291,19 @@ static int wis_tw2804_command(struct i2c_client *client, | |||
291 | return 0; | 291 | return 0; |
292 | } | 292 | } |
293 | 293 | ||
294 | static struct i2c_driver wis_tw2804_driver; | 294 | static int wis_tw2804_probe(struct i2c_client *client, |
295 | 295 | const struct i2c_device_id *id) | |
296 | static struct i2c_client wis_tw2804_client_templ = { | ||
297 | .name = "TW2804 (WIS)", | ||
298 | .driver = &wis_tw2804_driver, | ||
299 | }; | ||
300 | |||
301 | static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
302 | { | 296 | { |
303 | struct i2c_client *client; | 297 | struct i2c_adapter *adapter = client->adapter; |
304 | struct wis_tw2804 *dec; | 298 | struct wis_tw2804 *dec; |
305 | 299 | ||
306 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 300 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
307 | return 0; | 301 | return -ENODEV; |
308 | |||
309 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
310 | if (client == NULL) | ||
311 | return -ENOMEM; | ||
312 | memcpy(client, &wis_tw2804_client_templ, | ||
313 | sizeof(wis_tw2804_client_templ)); | ||
314 | client->adapter = adapter; | ||
315 | client->addr = addr; | ||
316 | 302 | ||
317 | dec = kmalloc(sizeof(struct wis_tw2804), GFP_KERNEL); | 303 | dec = kmalloc(sizeof(struct wis_tw2804), GFP_KERNEL); |
318 | if (dec == NULL) { | 304 | if (dec == NULL) |
319 | kfree(client); | ||
320 | return -ENOMEM; | 305 | return -ENOMEM; |
321 | } | 306 | |
322 | dec->channel = -1; | 307 | dec->channel = -1; |
323 | dec->norm = V4L2_STD_NTSC; | 308 | dec->norm = V4L2_STD_NTSC; |
324 | dec->brightness = 128; | 309 | dec->brightness = 128; |
@@ -328,48 +313,42 @@ static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
328 | i2c_set_clientdata(client, dec); | 313 | i2c_set_clientdata(client, dec); |
329 | 314 | ||
330 | printk(KERN_DEBUG "wis-tw2804: creating TW2804 at address %d on %s\n", | 315 | printk(KERN_DEBUG "wis-tw2804: creating TW2804 at address %d on %s\n", |
331 | addr, adapter->name); | 316 | client->addr, adapter->name); |
332 | 317 | ||
333 | i2c_attach_client(client); | ||
334 | return 0; | 318 | return 0; |
335 | } | 319 | } |
336 | 320 | ||
337 | static int wis_tw2804_detach(struct i2c_client *client) | 321 | static int wis_tw2804_remove(struct i2c_client *client) |
338 | { | 322 | { |
339 | struct wis_tw2804 *dec = i2c_get_clientdata(client); | 323 | struct wis_tw2804 *dec = i2c_get_clientdata(client); |
340 | int r; | ||
341 | |||
342 | r = i2c_detach_client(client); | ||
343 | if (r < 0) | ||
344 | return r; | ||
345 | 324 | ||
346 | kfree(client); | 325 | i2c_set_clientdata(client, NULL); |
347 | kfree(dec); | 326 | kfree(dec); |
348 | return 0; | 327 | return 0; |
349 | } | 328 | } |
350 | 329 | ||
330 | static struct i2c_device_id wis_tw2804_id[] = { | ||
331 | { "wis_tw2804", 0 }, | ||
332 | { } | ||
333 | }; | ||
334 | |||
351 | static struct i2c_driver wis_tw2804_driver = { | 335 | static struct i2c_driver wis_tw2804_driver = { |
352 | .driver = { | 336 | .driver = { |
353 | .name = "WIS TW2804 I2C driver", | 337 | .name = "WIS TW2804 I2C driver", |
354 | }, | 338 | }, |
355 | .id = I2C_DRIVERID_WIS_TW2804, | 339 | .probe = wis_tw2804_probe, |
356 | .detach_client = wis_tw2804_detach, | 340 | .remove = wis_tw2804_remove, |
357 | .command = wis_tw2804_command, | 341 | .command = wis_tw2804_command, |
342 | .id_table = wis_tw2804_id, | ||
358 | }; | 343 | }; |
359 | 344 | ||
360 | static int __init wis_tw2804_init(void) | 345 | static int __init wis_tw2804_init(void) |
361 | { | 346 | { |
362 | int r; | 347 | return i2c_add_driver(&wis_tw2804_driver); |
363 | |||
364 | r = i2c_add_driver(&wis_tw2804_driver); | ||
365 | if (r < 0) | ||
366 | return r; | ||
367 | return wis_i2c_add_driver(wis_tw2804_driver.id, wis_tw2804_detect); | ||
368 | } | 348 | } |
369 | 349 | ||
370 | static void __exit wis_tw2804_cleanup(void) | 350 | static void __exit wis_tw2804_cleanup(void) |
371 | { | 351 | { |
372 | wis_i2c_del_driver(wis_tw2804_detect); | ||
373 | i2c_del_driver(&wis_tw2804_driver); | 352 | i2c_del_driver(&wis_tw2804_driver); |
374 | } | 353 | } |
375 | 354 | ||
diff --git a/drivers/staging/go7007/wis-tw9903.c b/drivers/staging/go7007/wis-tw9903.c index 40627b282cb4..6c3427bb6f4c 100644 --- a/drivers/staging/go7007/wis-tw9903.c +++ b/drivers/staging/go7007/wis-tw9903.c | |||
@@ -267,34 +267,19 @@ static int wis_tw9903_command(struct i2c_client *client, | |||
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | static struct i2c_driver wis_tw9903_driver; | 270 | static int wis_tw9903_probe(struct i2c_client *client, |
271 | 271 | const struct i2c_device_id *id) | |
272 | static struct i2c_client wis_tw9903_client_templ = { | ||
273 | .name = "TW9903 (WIS)", | ||
274 | .driver = &wis_tw9903_driver, | ||
275 | }; | ||
276 | |||
277 | static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
278 | { | 272 | { |
279 | struct i2c_client *client; | 273 | struct i2c_adapter *adapter = client->adapter; |
280 | struct wis_tw9903 *dec; | 274 | struct wis_tw9903 *dec; |
281 | 275 | ||
282 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 276 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
283 | return 0; | 277 | return -ENODEV; |
284 | |||
285 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
286 | if (client == NULL) | ||
287 | return -ENOMEM; | ||
288 | memcpy(client, &wis_tw9903_client_templ, | ||
289 | sizeof(wis_tw9903_client_templ)); | ||
290 | client->adapter = adapter; | ||
291 | client->addr = addr; | ||
292 | 278 | ||
293 | dec = kmalloc(sizeof(struct wis_tw9903), GFP_KERNEL); | 279 | dec = kmalloc(sizeof(struct wis_tw9903), GFP_KERNEL); |
294 | if (dec == NULL) { | 280 | if (dec == NULL) |
295 | kfree(client); | ||
296 | return -ENOMEM; | 281 | return -ENOMEM; |
297 | } | 282 | |
298 | dec->norm = V4L2_STD_NTSC; | 283 | dec->norm = V4L2_STD_NTSC; |
299 | dec->brightness = 0; | 284 | dec->brightness = 0; |
300 | dec->contrast = 0x60; | 285 | dec->contrast = 0x60; |
@@ -303,55 +288,48 @@ static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
303 | 288 | ||
304 | printk(KERN_DEBUG | 289 | printk(KERN_DEBUG |
305 | "wis-tw9903: initializing TW9903 at address %d on %s\n", | 290 | "wis-tw9903: initializing TW9903 at address %d on %s\n", |
306 | addr, adapter->name); | 291 | client->addr, adapter->name); |
307 | 292 | ||
308 | if (write_regs(client, initial_registers) < 0) { | 293 | if (write_regs(client, initial_registers) < 0) { |
309 | printk(KERN_ERR "wis-tw9903: error initializing TW9903\n"); | 294 | printk(KERN_ERR "wis-tw9903: error initializing TW9903\n"); |
310 | kfree(client); | ||
311 | kfree(dec); | 295 | kfree(dec); |
312 | return 0; | 296 | return -ENODEV; |
313 | } | 297 | } |
314 | 298 | ||
315 | i2c_attach_client(client); | ||
316 | return 0; | 299 | return 0; |
317 | } | 300 | } |
318 | 301 | ||
319 | static int wis_tw9903_detach(struct i2c_client *client) | 302 | static int wis_tw9903_remove(struct i2c_client *client) |
320 | { | 303 | { |
321 | struct wis_tw9903 *dec = i2c_get_clientdata(client); | 304 | struct wis_tw9903 *dec = i2c_get_clientdata(client); |
322 | int r; | ||
323 | |||
324 | r = i2c_detach_client(client); | ||
325 | if (r < 0) | ||
326 | return r; | ||
327 | 305 | ||
328 | kfree(client); | 306 | i2c_set_clientdata(client, NULL); |
329 | kfree(dec); | 307 | kfree(dec); |
330 | return 0; | 308 | return 0; |
331 | } | 309 | } |
332 | 310 | ||
311 | static struct i2c_device_id wis_tw9903_id[] = { | ||
312 | { "wis_tw9903", 0 }, | ||
313 | { } | ||
314 | }; | ||
315 | |||
333 | static struct i2c_driver wis_tw9903_driver = { | 316 | static struct i2c_driver wis_tw9903_driver = { |
334 | .driver = { | 317 | .driver = { |
335 | .name = "WIS TW9903 I2C driver", | 318 | .name = "WIS TW9903 I2C driver", |
336 | }, | 319 | }, |
337 | .id = I2C_DRIVERID_WIS_TW9903, | 320 | .probe = wis_tw9903_probe, |
338 | .detach_client = wis_tw9903_detach, | 321 | .remove = wis_tw9903_remove, |
339 | .command = wis_tw9903_command, | 322 | .command = wis_tw9903_command, |
323 | .id_table = wis_tw9903_id, | ||
340 | }; | 324 | }; |
341 | 325 | ||
342 | static int __init wis_tw9903_init(void) | 326 | static int __init wis_tw9903_init(void) |
343 | { | 327 | { |
344 | int r; | 328 | return i2c_add_driver(&wis_tw9903_driver); |
345 | |||
346 | r = i2c_add_driver(&wis_tw9903_driver); | ||
347 | if (r < 0) | ||
348 | return r; | ||
349 | return wis_i2c_add_driver(wis_tw9903_driver.id, wis_tw9903_detect); | ||
350 | } | 329 | } |
351 | 330 | ||
352 | static void __exit wis_tw9903_cleanup(void) | 331 | static void __exit wis_tw9903_cleanup(void) |
353 | { | 332 | { |
354 | wis_i2c_del_driver(wis_tw9903_detect); | ||
355 | i2c_del_driver(&wis_tw9903_driver); | 333 | i2c_del_driver(&wis_tw9903_driver); |
356 | } | 334 | } |
357 | 335 | ||
diff --git a/drivers/staging/go7007/wis-uda1342.c b/drivers/staging/go7007/wis-uda1342.c index 555645c0cc1a..739c7ae8913f 100644 --- a/drivers/staging/go7007/wis-uda1342.c +++ b/drivers/staging/go7007/wis-uda1342.c | |||
@@ -59,73 +59,51 @@ static int wis_uda1342_command(struct i2c_client *client, | |||
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | static struct i2c_driver wis_uda1342_driver; | 62 | static int wis_uda1342_probe(struct i2c_client *client, |
63 | 63 | const struct i2c_device_id *id) | |
64 | static struct i2c_client wis_uda1342_client_templ = { | ||
65 | .name = "UDA1342 (WIS)", | ||
66 | .driver = &wis_uda1342_driver, | ||
67 | }; | ||
68 | |||
69 | static int wis_uda1342_detect(struct i2c_adapter *adapter, int addr, int kind) | ||
70 | { | 64 | { |
71 | struct i2c_client *client; | 65 | struct i2c_adapter *adapter = client->adapter; |
72 | 66 | ||
73 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) | 67 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) |
74 | return 0; | 68 | return -ENODEV; |
75 | |||
76 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
77 | if (client == NULL) | ||
78 | return -ENOMEM; | ||
79 | memcpy(client, &wis_uda1342_client_templ, | ||
80 | sizeof(wis_uda1342_client_templ)); | ||
81 | client->adapter = adapter; | ||
82 | client->addr = addr; | ||
83 | 69 | ||
84 | printk(KERN_DEBUG | 70 | printk(KERN_DEBUG |
85 | "wis-uda1342: initializing UDA1342 at address %d on %s\n", | 71 | "wis-uda1342: initializing UDA1342 at address %d on %s\n", |
86 | addr, adapter->name); | 72 | client->addr, adapter->name); |
87 | 73 | ||
88 | write_reg(client, 0x00, 0x8000); /* reset registers */ | 74 | write_reg(client, 0x00, 0x8000); /* reset registers */ |
89 | write_reg(client, 0x00, 0x1241); /* select input 1 */ | 75 | write_reg(client, 0x00, 0x1241); /* select input 1 */ |
90 | 76 | ||
91 | i2c_attach_client(client); | ||
92 | return 0; | 77 | return 0; |
93 | } | 78 | } |
94 | 79 | ||
95 | static int wis_uda1342_detach(struct i2c_client *client) | 80 | static int wis_uda1342_remove(struct i2c_client *client) |
96 | { | 81 | { |
97 | int r; | ||
98 | |||
99 | r = i2c_detach_client(client); | ||
100 | if (r < 0) | ||
101 | return r; | ||
102 | |||
103 | kfree(client); | ||
104 | return 0; | 82 | return 0; |
105 | } | 83 | } |
106 | 84 | ||
85 | static struct i2c_device_id wis_uda1342_id[] = { | ||
86 | { "wis_uda1342", 0 }, | ||
87 | { } | ||
88 | }; | ||
89 | |||
107 | static struct i2c_driver wis_uda1342_driver = { | 90 | static struct i2c_driver wis_uda1342_driver = { |
108 | .driver = { | 91 | .driver = { |
109 | .name = "WIS UDA1342 I2C driver", | 92 | .name = "WIS UDA1342 I2C driver", |
110 | }, | 93 | }, |
111 | .id = I2C_DRIVERID_WIS_UDA1342, | 94 | .probe = wis_uda1342_probe, |
112 | .detach_client = wis_uda1342_detach, | 95 | .remove = wis_uda1342_remove, |
113 | .command = wis_uda1342_command, | 96 | .command = wis_uda1342_command, |
97 | .id_table = wis_uda1342_id, | ||
114 | }; | 98 | }; |
115 | 99 | ||
116 | static int __init wis_uda1342_init(void) | 100 | static int __init wis_uda1342_init(void) |
117 | { | 101 | { |
118 | int r; | 102 | return i2c_add_driver(&wis_uda1342_driver); |
119 | |||
120 | r = i2c_add_driver(&wis_uda1342_driver); | ||
121 | if (r < 0) | ||
122 | return r; | ||
123 | return wis_i2c_add_driver(wis_uda1342_driver.id, wis_uda1342_detect); | ||
124 | } | 103 | } |
125 | 104 | ||
126 | static void __exit wis_uda1342_cleanup(void) | 105 | static void __exit wis_uda1342_cleanup(void) |
127 | { | 106 | { |
128 | wis_i2c_del_driver(wis_uda1342_detect); | ||
129 | i2c_del_driver(&wis_uda1342_driver); | 107 | i2c_del_driver(&wis_uda1342_driver); |
130 | } | 108 | } |
131 | 109 | ||
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index 1a1f946d8fef..9fe90ce928fb 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -533,6 +533,7 @@ static int __devinit init_asiliant(struct fb_info *p, unsigned long addr) | |||
533 | 533 | ||
534 | writeb(0xff, mmio_base + 0x78c); | 534 | writeb(0xff, mmio_base + 0x78c); |
535 | chips_hw_init(p); | 535 | chips_hw_init(p); |
536 | return 0; | ||
536 | } | 537 | } |
537 | 538 | ||
538 | static int __devinit | 539 | static int __devinit |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 84f63205c46d..0889d50c3288 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -1439,7 +1439,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) | |||
1439 | static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) | 1439 | static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) |
1440 | { | 1440 | { |
1441 | struct pxafb_info *fbi = dev_id; | 1441 | struct pxafb_info *fbi = dev_id; |
1442 | unsigned int lccr0, lcsr, lcsr1; | 1442 | unsigned int lccr0, lcsr; |
1443 | 1443 | ||
1444 | lcsr = lcd_readl(fbi, LCSR); | 1444 | lcsr = lcd_readl(fbi, LCSR); |
1445 | if (lcsr & LCSR_LDD) { | 1445 | if (lcsr & LCSR_LDD) { |
@@ -1455,14 +1455,16 @@ static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) | |||
1455 | lcd_writel(fbi, LCSR, lcsr); | 1455 | lcd_writel(fbi, LCSR, lcsr); |
1456 | 1456 | ||
1457 | #ifdef CONFIG_FB_PXA_OVERLAY | 1457 | #ifdef CONFIG_FB_PXA_OVERLAY |
1458 | lcsr1 = lcd_readl(fbi, LCSR1); | 1458 | { |
1459 | if (lcsr1 & LCSR1_BS(1)) | 1459 | unsigned int lcsr1 = lcd_readl(fbi, LCSR1); |
1460 | complete(&fbi->overlay[0].branch_done); | 1460 | if (lcsr1 & LCSR1_BS(1)) |
1461 | complete(&fbi->overlay[0].branch_done); | ||
1461 | 1462 | ||
1462 | if (lcsr1 & LCSR1_BS(2)) | 1463 | if (lcsr1 & LCSR1_BS(2)) |
1463 | complete(&fbi->overlay[1].branch_done); | 1464 | complete(&fbi->overlay[1].branch_done); |
1464 | 1465 | ||
1465 | lcd_writel(fbi, LCSR1, lcsr1); | 1466 | lcd_writel(fbi, LCSR1, lcsr1); |
1467 | } | ||
1466 | #endif | 1468 | #endif |
1467 | return IRQ_HANDLED; | 1469 | return IRQ_HANDLED; |
1468 | } | 1470 | } |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 59268266b79a..9c76a061a04d 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -190,7 +190,8 @@ static int balloon(void *_vballoon) | |||
190 | try_to_freeze(); | 190 | try_to_freeze(); |
191 | wait_event_interruptible(vb->config_change, | 191 | wait_event_interruptible(vb->config_change, |
192 | (diff = towards_target(vb)) != 0 | 192 | (diff = towards_target(vb)) != 0 |
193 | || kthread_should_stop()); | 193 | || kthread_should_stop() |
194 | || freezing(current)); | ||
194 | if (diff > 0) | 195 | if (diff > 0) |
195 | fill_balloon(vb, diff); | 196 | fill_balloon(vb, diff); |
196 | else if (diff < 0) | 197 | else if (diff < 0) |