diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-04-21 20:27:47 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-04-21 20:27:47 -0400 |
commit | 99ce567ba912109c78762246c964327f3f81f27d (patch) | |
tree | 685265d60792c11d386db6c005ca8b8e714ecc23 /drivers | |
parent | 8fb2bae4b41eb64f6e233e9bd3f3a789fbb04a06 (diff) | |
parent | ccc5ff94c66e628d3c501b26ace5d4339667715d (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers')
49 files changed, 667 insertions, 579 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/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/ide/cs5536.c b/drivers/ide/cs5536.c index 353a35bbba63..0332a95eefd4 100644 --- a/drivers/ide/cs5536.c +++ b/drivers/ide/cs5536.c | |||
@@ -236,6 +236,7 @@ static const struct ide_dma_ops cs5536_dma_ops = { | |||
236 | .dma_test_irq = ide_dma_test_irq, | 236 | .dma_test_irq = ide_dma_test_irq, |
237 | .dma_lost_irq = ide_dma_lost_irq, | 237 | .dma_lost_irq = ide_dma_lost_irq, |
238 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | 238 | .dma_timer_expiry = ide_dma_sff_timer_expiry, |
239 | .dma_sff_read_status = ide_dma_sff_read_status, | ||
239 | }; | 240 | }; |
240 | 241 | ||
241 | static const struct ide_port_info cs5536_info = { | 242 | static const struct ide_port_info cs5536_info = { |
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index a0eb87f59134..0feb66c720e1 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 3 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
4 | * Portions Copyright (C) 2003 Red Hat Inc | 4 | * Portions Copyright (C) 2003 Red Hat Inc |
5 | * Portions Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 5 | * Portions Copyright (C) 2007 Bartlomiej Zolnierkiewicz |
6 | * Portions Copyright (C) 2005-2008 MontaVista Software, Inc. | 6 | * Portions Copyright (C) 2005-2009 MontaVista Software, Inc. |
7 | * | 7 | * |
8 | * Thanks to HighPoint Technologies for their assistance, and hardware. | 8 | * Thanks to HighPoint Technologies for their assistance, and hardware. |
9 | * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his | 9 | * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his |
@@ -114,6 +114,8 @@ | |||
114 | * the register setting lists into the table indexed by the clock selected | 114 | * the register setting lists into the table indexed by the clock selected |
115 | * - set the correct hwif->ultra_mask for each individual chip | 115 | * - set the correct hwif->ultra_mask for each individual chip |
116 | * - add Ultra and MW DMA mode filtering for the HPT37[24] based SATA cards | 116 | * - add Ultra and MW DMA mode filtering for the HPT37[24] based SATA cards |
117 | * - stop resetting HPT370's state machine before each DMA transfer as that has | ||
118 | * caused more harm than good | ||
117 | * Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com> | 119 | * Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com> |
118 | */ | 120 | */ |
119 | 121 | ||
@@ -133,7 +135,7 @@ | |||
133 | #define DRV_NAME "hpt366" | 135 | #define DRV_NAME "hpt366" |
134 | 136 | ||
135 | /* various tuning parameters */ | 137 | /* various tuning parameters */ |
136 | #define HPT_RESET_STATE_ENGINE | 138 | #undef HPT_RESET_STATE_ENGINE |
137 | #undef HPT_DELAY_INTERRUPT | 139 | #undef HPT_DELAY_INTERRUPT |
138 | 140 | ||
139 | static const char *quirk_drives[] = { | 141 | static const char *quirk_drives[] = { |
@@ -808,7 +810,7 @@ static void hpt370_irq_timeout(ide_drive_t *drive) | |||
808 | /* get DMA command mode */ | 810 | /* get DMA command mode */ |
809 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); | 811 | dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); |
810 | /* stop DMA */ | 812 | /* stop DMA */ |
811 | outb(dma_cmd & ~0x1, hwif->dma_base + ATA_DMA_CMD); | 813 | outb(dma_cmd & ~ATA_DMA_START, hwif->dma_base + ATA_DMA_CMD); |
812 | hpt370_clear_engine(drive); | 814 | hpt370_clear_engine(drive); |
813 | } | 815 | } |
814 | 816 | ||
@@ -825,11 +827,11 @@ static int hpt370_dma_end(ide_drive_t *drive) | |||
825 | ide_hwif_t *hwif = drive->hwif; | 827 | ide_hwif_t *hwif = drive->hwif; |
826 | u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); | 828 | u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); |
827 | 829 | ||
828 | if (dma_stat & 0x01) { | 830 | if (dma_stat & ATA_DMA_ACTIVE) { |
829 | /* wait a little */ | 831 | /* wait a little */ |
830 | udelay(20); | 832 | udelay(20); |
831 | dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); | 833 | dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); |
832 | if (dma_stat & 0x01) | 834 | if (dma_stat & ATA_DMA_ACTIVE) |
833 | hpt370_irq_timeout(drive); | 835 | hpt370_irq_timeout(drive); |
834 | } | 836 | } |
835 | return ide_dma_end(drive); | 837 | return ide_dma_end(drive); |
@@ -851,7 +853,7 @@ static int hpt374_dma_test_irq(ide_drive_t *drive) | |||
851 | 853 | ||
852 | dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); | 854 | dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); |
853 | /* return 1 if INTR asserted */ | 855 | /* return 1 if INTR asserted */ |
854 | if (dma_stat & 4) | 856 | if (dma_stat & ATA_DMA_INTR) |
855 | return 1; | 857 | return 1; |
856 | 858 | ||
857 | return 0; | 859 | return 0; |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2ae02b8d7f8e..35dc38d3b2c5 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -102,11 +102,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | |||
102 | drive->dev_flags |= IDE_DFLAG_PARKED; | 102 | drive->dev_flags |= IDE_DFLAG_PARKED; |
103 | } | 103 | } |
104 | 104 | ||
105 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 105 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
106 | memcpy(rq->special, cmd, sizeof(*cmd)); | 106 | struct ide_cmd *orig_cmd = rq->special; |
107 | 107 | ||
108 | if (cmd->tf_flags & IDE_TFLAG_DYN) | 108 | if (cmd->tf_flags & IDE_TFLAG_DYN) |
109 | kfree(cmd); | 109 | kfree(orig_cmd); |
110 | else | ||
111 | memcpy(orig_cmd, cmd, sizeof(*cmd)); | ||
112 | } | ||
110 | } | 113 | } |
111 | 114 | ||
112 | /* obsolete, blk_rq_bytes() should be used instead */ | 115 | /* obsolete, blk_rq_bytes() should be used instead */ |
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 052b9bf1f8fb..f76e4e6b408f 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c | |||
@@ -1682,7 +1682,7 @@ static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, | |||
1682 | * The +2 is +1 for the stop command and +1 to allow for | 1682 | * The +2 is +1 for the stop command and +1 to allow for |
1683 | * aligning the start address to a multiple of 16 bytes. | 1683 | * aligning the start address to a multiple of 16 bytes. |
1684 | */ | 1684 | */ |
1685 | pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent( | 1685 | pmif->dma_table_cpu = pci_alloc_consistent( |
1686 | dev, | 1686 | dev, |
1687 | (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), | 1687 | (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), |
1688 | &hwif->dmatable_dma); | 1688 | &hwif->dmatable_dma); |
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/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/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/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/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) |