diff options
Diffstat (limited to 'drivers')
40 files changed, 687 insertions, 588 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 04e90443eff7..391f331674c7 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device) | |||
1065 | struct acpi_ec *ec = acpi_driver_data(device); | 1065 | struct acpi_ec *ec = acpi_driver_data(device); |
1066 | /* Enable use of GPE back */ | 1066 | /* Enable use of GPE back */ |
1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); |
1068 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
1068 | acpi_enable_gpe(NULL, ec->gpe); | 1069 | acpi_enable_gpe(NULL, ec->gpe); |
1069 | return 0; | 1070 | return 0; |
1070 | } | 1071 | } |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 9cd15e8c8932..564ea1424288 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
909 | thermal_zone_device_register("acpitz", trips, tz, | 909 | thermal_zone_device_register("acpitz", trips, tz, |
910 | &acpi_thermal_zone_ops, | 910 | &acpi_thermal_zone_ops, |
911 | 0, 0, 0, | 911 | 0, 0, 0, |
912 | tz->polling_frequency); | 912 | tz->polling_frequency*100); |
913 | if (IS_ERR(tz->thermal_zone)) | 913 | if (IS_ERR(tz->thermal_zone)) |
914 | return -ENODEV; | 914 | return -ENODEV; |
915 | 915 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index cd4fb7543a90..21968ae6ed91 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -770,10 +770,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
770 | * In this case, the first two elements in _BCL packages | 770 | * In this case, the first two elements in _BCL packages |
771 | * are also supported brightness levels that OS should take care of. | 771 | * are also supported brightness levels that OS should take care of. |
772 | */ | 772 | */ |
773 | for (i = 2; i < count; i++) | 773 | for (i = 2; i < count; i++) { |
774 | if (br->levels[i] == br->levels[0] || | 774 | if (br->levels[i] == br->levels[0]) |
775 | br->levels[i] == br->levels[1]) | ||
776 | level_ac_battery++; | 775 | level_ac_battery++; |
776 | if (br->levels[i] == br->levels[1]) | ||
777 | level_ac_battery++; | ||
778 | } | ||
777 | 779 | ||
778 | if (level_ac_battery < 2) { | 780 | if (level_ac_battery < 2) { |
779 | level_ac_battery = 2 - level_ac_battery; | 781 | level_ac_battery = 2 - level_ac_battery; |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index f17c3266a0e0..742cbe6b042b 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -179,6 +179,7 @@ void wait_for_device_probe(void) | |||
179 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); | 179 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
180 | async_synchronize_full(); | 180 | async_synchronize_full(); |
181 | } | 181 | } |
182 | EXPORT_SYMBOL_GPL(wait_for_device_probe); | ||
182 | 183 | ||
183 | /** | 184 | /** |
184 | * driver_probe_device - attempt to bind device & driver together | 185 | * driver_probe_device - attempt to bind device & driver together |
diff --git a/drivers/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/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/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/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/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index d3c92d777bde..552958545f94 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -317,7 +317,8 @@ static void sony_laptop_report_input_event(u8 event) | |||
317 | struct input_dev *key_dev = sony_laptop_input.key_dev; | 317 | struct input_dev *key_dev = sony_laptop_input.key_dev; |
318 | struct sony_laptop_keypress kp = { NULL }; | 318 | struct sony_laptop_keypress kp = { NULL }; |
319 | 319 | ||
320 | if (event == SONYPI_EVENT_FNKEY_RELEASED) { | 320 | if (event == SONYPI_EVENT_FNKEY_RELEASED || |
321 | event == SONYPI_EVENT_ANYBUTTON_RELEASED) { | ||
321 | /* Nothing, not all VAIOs generate this event */ | 322 | /* Nothing, not all VAIOs generate this event */ |
322 | return; | 323 | return; |
323 | } | 324 | } |
@@ -905,7 +906,6 @@ static struct sony_nc_event sony_127_events[] = { | |||
905 | { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED }, | 906 | { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED }, |
906 | { 0x86, SONYPI_EVENT_PKEY_P5 }, | 907 | { 0x86, SONYPI_EVENT_PKEY_P5 }, |
907 | { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, | 908 | { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, |
908 | { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, | ||
909 | { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED }, | 909 | { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED }, |
910 | { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED }, | 910 | { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED }, |
911 | { 0, 0 }, | 911 | { 0, 0 }, |
@@ -1004,6 +1004,7 @@ static int sony_nc_function_setup(struct acpi_device *device) | |||
1004 | sony_call_snc_handle(0x0100, 0, &result); | 1004 | sony_call_snc_handle(0x0100, 0, &result); |
1005 | sony_call_snc_handle(0x0101, 0, &result); | 1005 | sony_call_snc_handle(0x0101, 0, &result); |
1006 | sony_call_snc_handle(0x0102, 0x100, &result); | 1006 | sony_call_snc_handle(0x0102, 0x100, &result); |
1007 | sony_call_snc_handle(0x0127, 0, &result); | ||
1007 | 1008 | ||
1008 | return 0; | 1009 | return 0; |
1009 | } | 1010 | } |
@@ -1040,7 +1041,7 @@ static int sony_nc_resume(struct acpi_device *device) | |||
1040 | 1041 | ||
1041 | /* set the last requested brightness level */ | 1042 | /* set the last requested brightness level */ |
1042 | if (sony_backlight_device && | 1043 | if (sony_backlight_device && |
1043 | !sony_backlight_update_status(sony_backlight_device)) | 1044 | sony_backlight_update_status(sony_backlight_device) < 0) |
1044 | printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); | 1045 | printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); |
1045 | 1046 | ||
1046 | return 0; | 1047 | return 0; |
@@ -1102,8 +1103,11 @@ static int sony_nc_setup_wifi_rfkill(struct acpi_device *device) | |||
1102 | err = rfkill_register(sony_wifi_rfkill); | 1103 | err = rfkill_register(sony_wifi_rfkill); |
1103 | if (err) | 1104 | if (err) |
1104 | rfkill_free(sony_wifi_rfkill); | 1105 | rfkill_free(sony_wifi_rfkill); |
1105 | else | 1106 | else { |
1106 | sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill; | 1107 | sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill; |
1108 | sony_nc_rfkill_set(sony_wifi_rfkill->data, | ||
1109 | RFKILL_STATE_UNBLOCKED); | ||
1110 | } | ||
1107 | return err; | 1111 | return err; |
1108 | } | 1112 | } |
1109 | 1113 | ||
@@ -1124,8 +1128,11 @@ static int sony_nc_setup_bluetooth_rfkill(struct acpi_device *device) | |||
1124 | err = rfkill_register(sony_bluetooth_rfkill); | 1128 | err = rfkill_register(sony_bluetooth_rfkill); |
1125 | if (err) | 1129 | if (err) |
1126 | rfkill_free(sony_bluetooth_rfkill); | 1130 | rfkill_free(sony_bluetooth_rfkill); |
1127 | else | 1131 | else { |
1128 | sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill; | 1132 | sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill; |
1133 | sony_nc_rfkill_set(sony_bluetooth_rfkill->data, | ||
1134 | RFKILL_STATE_UNBLOCKED); | ||
1135 | } | ||
1129 | return err; | 1136 | return err; |
1130 | } | 1137 | } |
1131 | 1138 | ||
@@ -1145,8 +1152,11 @@ static int sony_nc_setup_wwan_rfkill(struct acpi_device *device) | |||
1145 | err = rfkill_register(sony_wwan_rfkill); | 1152 | err = rfkill_register(sony_wwan_rfkill); |
1146 | if (err) | 1153 | if (err) |
1147 | rfkill_free(sony_wwan_rfkill); | 1154 | rfkill_free(sony_wwan_rfkill); |
1148 | else | 1155 | else { |
1149 | sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill; | 1156 | sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill; |
1157 | sony_nc_rfkill_set(sony_wwan_rfkill->data, | ||
1158 | RFKILL_STATE_UNBLOCKED); | ||
1159 | } | ||
1150 | return err; | 1160 | return err; |
1151 | } | 1161 | } |
1152 | 1162 | ||
@@ -1166,8 +1176,11 @@ static int sony_nc_setup_wimax_rfkill(struct acpi_device *device) | |||
1166 | err = rfkill_register(sony_wimax_rfkill); | 1176 | err = rfkill_register(sony_wimax_rfkill); |
1167 | if (err) | 1177 | if (err) |
1168 | rfkill_free(sony_wimax_rfkill); | 1178 | rfkill_free(sony_wimax_rfkill); |
1169 | else | 1179 | else { |
1170 | sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill; | 1180 | sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill; |
1181 | sony_nc_rfkill_set(sony_wimax_rfkill->data, | ||
1182 | RFKILL_STATE_UNBLOCKED); | ||
1183 | } | ||
1171 | return err; | 1184 | return err; |
1172 | } | 1185 | } |
1173 | 1186 | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index a40b075743d9..912be65b6261 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define TPACPI_VERSION "0.22" | 24 | #define TPACPI_VERSION "0.23" |
25 | #define TPACPI_SYSFS_VERSION 0x020300 | 25 | #define TPACPI_SYSFS_VERSION 0x020300 |
26 | 26 | ||
27 | /* | 27 | /* |
@@ -303,11 +303,17 @@ static u32 dbg_level; | |||
303 | 303 | ||
304 | static struct workqueue_struct *tpacpi_wq; | 304 | static struct workqueue_struct *tpacpi_wq; |
305 | 305 | ||
306 | enum led_status_t { | ||
307 | TPACPI_LED_OFF = 0, | ||
308 | TPACPI_LED_ON, | ||
309 | TPACPI_LED_BLINK, | ||
310 | }; | ||
311 | |||
306 | /* Special LED class that can defer work */ | 312 | /* Special LED class that can defer work */ |
307 | struct tpacpi_led_classdev { | 313 | struct tpacpi_led_classdev { |
308 | struct led_classdev led_classdev; | 314 | struct led_classdev led_classdev; |
309 | struct work_struct work; | 315 | struct work_struct work; |
310 | enum led_brightness new_brightness; | 316 | enum led_status_t new_state; |
311 | unsigned int led; | 317 | unsigned int led; |
312 | }; | 318 | }; |
313 | 319 | ||
@@ -2946,12 +2952,18 @@ static int hotkey_read(char *p) | |||
2946 | return len; | 2952 | return len; |
2947 | } | 2953 | } |
2948 | 2954 | ||
2949 | static void hotkey_enabledisable_warn(void) | 2955 | static void hotkey_enabledisable_warn(bool enable) |
2950 | { | 2956 | { |
2951 | tpacpi_log_usertask("procfs hotkey enable/disable"); | 2957 | tpacpi_log_usertask("procfs hotkey enable/disable"); |
2952 | WARN(1, TPACPI_WARN | 2958 | if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable), |
2953 | "hotkey enable/disable functionality has been " | 2959 | TPACPI_WARN |
2954 | "removed from the driver. Hotkeys are always enabled.\n"); | 2960 | "hotkey enable/disable functionality has been " |
2961 | "removed from the driver. Hotkeys are always " | ||
2962 | "enabled\n")) | ||
2963 | printk(TPACPI_ERR | ||
2964 | "Please remove the hotkey=enable module " | ||
2965 | "parameter, it is deprecated. Hotkeys are always " | ||
2966 | "enabled\n"); | ||
2955 | } | 2967 | } |
2956 | 2968 | ||
2957 | static int hotkey_write(char *buf) | 2969 | static int hotkey_write(char *buf) |
@@ -2971,9 +2983,9 @@ static int hotkey_write(char *buf) | |||
2971 | res = 0; | 2983 | res = 0; |
2972 | while ((cmd = next_cmd(&buf))) { | 2984 | while ((cmd = next_cmd(&buf))) { |
2973 | if (strlencmp(cmd, "enable") == 0) { | 2985 | if (strlencmp(cmd, "enable") == 0) { |
2974 | hotkey_enabledisable_warn(); | 2986 | hotkey_enabledisable_warn(1); |
2975 | } else if (strlencmp(cmd, "disable") == 0) { | 2987 | } else if (strlencmp(cmd, "disable") == 0) { |
2976 | hotkey_enabledisable_warn(); | 2988 | hotkey_enabledisable_warn(0); |
2977 | res = -EPERM; | 2989 | res = -EPERM; |
2978 | } else if (strlencmp(cmd, "reset") == 0) { | 2990 | } else if (strlencmp(cmd, "reset") == 0) { |
2979 | mask = hotkey_orig_mask; | 2991 | mask = hotkey_orig_mask; |
@@ -4207,7 +4219,7 @@ static void light_set_status_worker(struct work_struct *work) | |||
4207 | container_of(work, struct tpacpi_led_classdev, work); | 4219 | container_of(work, struct tpacpi_led_classdev, work); |
4208 | 4220 | ||
4209 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) | 4221 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) |
4210 | light_set_status((data->new_brightness != LED_OFF)); | 4222 | light_set_status((data->new_state != TPACPI_LED_OFF)); |
4211 | } | 4223 | } |
4212 | 4224 | ||
4213 | static void light_sysfs_set(struct led_classdev *led_cdev, | 4225 | static void light_sysfs_set(struct led_classdev *led_cdev, |
@@ -4217,7 +4229,8 @@ static void light_sysfs_set(struct led_classdev *led_cdev, | |||
4217 | container_of(led_cdev, | 4229 | container_of(led_cdev, |
4218 | struct tpacpi_led_classdev, | 4230 | struct tpacpi_led_classdev, |
4219 | led_classdev); | 4231 | led_classdev); |
4220 | data->new_brightness = brightness; | 4232 | data->new_state = (brightness != LED_OFF) ? |
4233 | TPACPI_LED_ON : TPACPI_LED_OFF; | ||
4221 | queue_work(tpacpi_wq, &data->work); | 4234 | queue_work(tpacpi_wq, &data->work); |
4222 | } | 4235 | } |
4223 | 4236 | ||
@@ -4724,12 +4737,6 @@ enum { /* For TPACPI_LED_OLD */ | |||
4724 | TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ | 4737 | TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ |
4725 | }; | 4738 | }; |
4726 | 4739 | ||
4727 | enum led_status_t { | ||
4728 | TPACPI_LED_OFF = 0, | ||
4729 | TPACPI_LED_ON, | ||
4730 | TPACPI_LED_BLINK, | ||
4731 | }; | ||
4732 | |||
4733 | static enum led_access_mode led_supported; | 4740 | static enum led_access_mode led_supported; |
4734 | 4741 | ||
4735 | TPACPI_HANDLE(led, ec, "SLED", /* 570 */ | 4742 | TPACPI_HANDLE(led, ec, "SLED", /* 570 */ |
@@ -4841,23 +4848,13 @@ static int led_set_status(const unsigned int led, | |||
4841 | return rc; | 4848 | return rc; |
4842 | } | 4849 | } |
4843 | 4850 | ||
4844 | static void led_sysfs_set_status(unsigned int led, | ||
4845 | enum led_brightness brightness) | ||
4846 | { | ||
4847 | led_set_status(led, | ||
4848 | (brightness == LED_OFF) ? | ||
4849 | TPACPI_LED_OFF : | ||
4850 | (tpacpi_led_state_cache[led] == TPACPI_LED_BLINK) ? | ||
4851 | TPACPI_LED_BLINK : TPACPI_LED_ON); | ||
4852 | } | ||
4853 | |||
4854 | static void led_set_status_worker(struct work_struct *work) | 4851 | static void led_set_status_worker(struct work_struct *work) |
4855 | { | 4852 | { |
4856 | struct tpacpi_led_classdev *data = | 4853 | struct tpacpi_led_classdev *data = |
4857 | container_of(work, struct tpacpi_led_classdev, work); | 4854 | container_of(work, struct tpacpi_led_classdev, work); |
4858 | 4855 | ||
4859 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) | 4856 | if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) |
4860 | led_sysfs_set_status(data->led, data->new_brightness); | 4857 | led_set_status(data->led, data->new_state); |
4861 | } | 4858 | } |
4862 | 4859 | ||
4863 | static void led_sysfs_set(struct led_classdev *led_cdev, | 4860 | static void led_sysfs_set(struct led_classdev *led_cdev, |
@@ -4866,7 +4863,13 @@ static void led_sysfs_set(struct led_classdev *led_cdev, | |||
4866 | struct tpacpi_led_classdev *data = container_of(led_cdev, | 4863 | struct tpacpi_led_classdev *data = container_of(led_cdev, |
4867 | struct tpacpi_led_classdev, led_classdev); | 4864 | struct tpacpi_led_classdev, led_classdev); |
4868 | 4865 | ||
4869 | data->new_brightness = brightness; | 4866 | if (brightness == LED_OFF) |
4867 | data->new_state = TPACPI_LED_OFF; | ||
4868 | else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK) | ||
4869 | data->new_state = TPACPI_LED_ON; | ||
4870 | else | ||
4871 | data->new_state = TPACPI_LED_BLINK; | ||
4872 | |||
4870 | queue_work(tpacpi_wq, &data->work); | 4873 | queue_work(tpacpi_wq, &data->work); |
4871 | } | 4874 | } |
4872 | 4875 | ||
@@ -4884,7 +4887,7 @@ static int led_sysfs_blink_set(struct led_classdev *led_cdev, | |||
4884 | } else if ((*delay_on != 500) || (*delay_off != 500)) | 4887 | } else if ((*delay_on != 500) || (*delay_off != 500)) |
4885 | return -EINVAL; | 4888 | return -EINVAL; |
4886 | 4889 | ||
4887 | data->new_brightness = TPACPI_LED_BLINK; | 4890 | data->new_state = TPACPI_LED_BLINK; |
4888 | queue_work(tpacpi_wq, &data->work); | 4891 | queue_work(tpacpi_wq, &data->work); |
4889 | 4892 | ||
4890 | return 0; | 4893 | return 0; |
@@ -7858,6 +7861,15 @@ static int __init thinkpad_acpi_module_init(void) | |||
7858 | MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); | 7861 | MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); |
7859 | 7862 | ||
7860 | /* | 7863 | /* |
7864 | * This will autoload the driver in almost every ThinkPad | ||
7865 | * in widespread use. | ||
7866 | * | ||
7867 | * Only _VERY_ old models, like the 240, 240x and 570 lack | ||
7868 | * the HKEY event interface. | ||
7869 | */ | ||
7870 | MODULE_DEVICE_TABLE(acpi, ibm_htk_device_ids); | ||
7871 | |||
7872 | /* | ||
7861 | * DMI matching for module autoloading | 7873 | * DMI matching for module autoloading |
7862 | * | 7874 | * |
7863 | * See http://thinkwiki.org/wiki/List_of_DMI_IDs | 7875 | * See http://thinkwiki.org/wiki/List_of_DMI_IDs |
@@ -7869,18 +7881,13 @@ MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); | |||
7869 | #define IBM_BIOS_MODULE_ALIAS(__type) \ | 7881 | #define IBM_BIOS_MODULE_ALIAS(__type) \ |
7870 | MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW*") | 7882 | MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW*") |
7871 | 7883 | ||
7872 | /* Non-ancient thinkpads */ | ||
7873 | MODULE_ALIAS("dmi:bvnIBM:*:svnIBM:*:pvrThinkPad*:rvnIBM:*"); | ||
7874 | MODULE_ALIAS("dmi:bvnLENOVO:*:svnLENOVO:*:pvrThinkPad*:rvnLENOVO:*"); | ||
7875 | |||
7876 | /* Ancient thinkpad BIOSes have to be identified by | 7884 | /* Ancient thinkpad BIOSes have to be identified by |
7877 | * BIOS type or model number, and there are far less | 7885 | * BIOS type or model number, and there are far less |
7878 | * BIOS types than model numbers... */ | 7886 | * BIOS types than model numbers... */ |
7879 | IBM_BIOS_MODULE_ALIAS("I[BDHIMNOTWVYZ]"); | 7887 | IBM_BIOS_MODULE_ALIAS("I[MU]"); /* 570, 570e */ |
7880 | IBM_BIOS_MODULE_ALIAS("1[0368A-GIKM-PST]"); | ||
7881 | IBM_BIOS_MODULE_ALIAS("K[UX-Z]"); | ||
7882 | 7888 | ||
7883 | MODULE_AUTHOR("Borislav Deianov, Henrique de Moraes Holschuh"); | 7889 | MODULE_AUTHOR("Borislav Deianov <borislav@users.sf.net>"); |
7890 | MODULE_AUTHOR("Henrique de Moraes Holschuh <hmh@hmh.eng.br>"); | ||
7884 | MODULE_DESCRIPTION(TPACPI_DESC); | 7891 | MODULE_DESCRIPTION(TPACPI_DESC); |
7885 | MODULE_VERSION(TPACPI_VERSION); | 7892 | MODULE_VERSION(TPACPI_VERSION); |
7886 | MODULE_LICENSE("GPL"); | 7893 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index ffe34a12f446..4e9851fc1746 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -573,7 +573,7 @@ config RTC_DRV_SA1100 | |||
573 | 573 | ||
574 | config RTC_DRV_SH | 574 | config RTC_DRV_SH |
575 | tristate "SuperH On-Chip RTC" | 575 | tristate "SuperH On-Chip RTC" |
576 | depends on RTC_CLASS && SUPERH | 576 | depends on RTC_CLASS && SUPERH && HAVE_CLK |
577 | help | 577 | help |
578 | Say Y here to enable support for the on-chip RTC found in | 578 | Say Y here to enable support for the on-chip RTC found in |
579 | most SuperH processors. | 579 | most SuperH processors. |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index b6d35f50e404..23e10b6263d6 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -797,17 +797,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
797 | goto cleanup2; | 797 | goto cleanup2; |
798 | } | 798 | } |
799 | 799 | ||
800 | pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n", | 800 | pr_info("%s: %s%s, %zd bytes nvram%s\n", |
801 | dev_name(&cmos_rtc.rtc->dev), | 801 | dev_name(&cmos_rtc.rtc->dev), |
802 | is_valid_irq(rtc_irq) | 802 | !is_valid_irq(rtc_irq) ? "no alarms" : |
803 | ? (cmos_rtc.mon_alrm | 803 | cmos_rtc.mon_alrm ? "alarms up to one year" : |
804 | ? "year" | 804 | cmos_rtc.day_alrm ? "alarms up to one month" : |
805 | : (cmos_rtc.day_alrm | 805 | "alarms up to one day", |
806 | ? "month" : "day")) | 806 | cmos_rtc.century ? ", y3k" : "", |
807 | : "no", | 807 | nvram.size, |
808 | cmos_rtc.century ? ", y3k" : "", | 808 | is_hpet_enabled() ? ", hpet irqs" : ""); |
809 | nvram.size, | ||
810 | is_hpet_enabled() ? ", hpet irqs" : ""); | ||
811 | 809 | ||
812 | return 0; | 810 | return 0; |
813 | 811 | ||
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 9b1ff12bf947..d7310adb7152 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * SuperH On-Chip RTC Support | 2 | * SuperH On-Chip RTC Support |
3 | * | 3 | * |
4 | * Copyright (C) 2006, 2007, 2008 Paul Mundt | 4 | * Copyright (C) 2006 - 2009 Paul Mundt |
5 | * Copyright (C) 2006 Jamie Lenehan | 5 | * Copyright (C) 2006 Jamie Lenehan |
6 | * Copyright (C) 2008 Angelo Castello | 6 | * Copyright (C) 2008 Angelo Castello |
7 | * | 7 | * |
@@ -25,10 +25,11 @@ | |||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/log2.h> | 27 | #include <linux/log2.h> |
28 | #include <linux/clk.h> | ||
28 | #include <asm/rtc.h> | 29 | #include <asm/rtc.h> |
29 | 30 | ||
30 | #define DRV_NAME "sh-rtc" | 31 | #define DRV_NAME "sh-rtc" |
31 | #define DRV_VERSION "0.2.1" | 32 | #define DRV_VERSION "0.2.2" |
32 | 33 | ||
33 | #define RTC_REG(r) ((r) * rtc_reg_size) | 34 | #define RTC_REG(r) ((r) * rtc_reg_size) |
34 | 35 | ||
@@ -87,16 +88,17 @@ | |||
87 | #define RCR2_START 0x01 /* Start bit */ | 88 | #define RCR2_START 0x01 /* Start bit */ |
88 | 89 | ||
89 | struct sh_rtc { | 90 | struct sh_rtc { |
90 | void __iomem *regbase; | 91 | void __iomem *regbase; |
91 | unsigned long regsize; | 92 | unsigned long regsize; |
92 | struct resource *res; | 93 | struct resource *res; |
93 | int alarm_irq; | 94 | int alarm_irq; |
94 | int periodic_irq; | 95 | int periodic_irq; |
95 | int carry_irq; | 96 | int carry_irq; |
96 | struct rtc_device *rtc_dev; | 97 | struct clk *clk; |
97 | spinlock_t lock; | 98 | struct rtc_device *rtc_dev; |
98 | unsigned long capabilities; /* See asm-sh/rtc.h for cap bits */ | 99 | spinlock_t lock; |
99 | unsigned short periodic_freq; | 100 | unsigned long capabilities; /* See asm/rtc.h for cap bits */ |
101 | unsigned short periodic_freq; | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | static int __sh_rtc_interrupt(struct sh_rtc *rtc) | 104 | static int __sh_rtc_interrupt(struct sh_rtc *rtc) |
@@ -294,10 +296,10 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable) | |||
294 | 296 | ||
295 | tmp = readb(rtc->regbase + RCR1); | 297 | tmp = readb(rtc->regbase + RCR1); |
296 | 298 | ||
297 | if (!enable) | 299 | if (enable) |
298 | tmp &= ~RCR1_AIE; | ||
299 | else | ||
300 | tmp |= RCR1_AIE; | 300 | tmp |= RCR1_AIE; |
301 | else | ||
302 | tmp &= ~RCR1_AIE; | ||
301 | 303 | ||
302 | writeb(tmp, rtc->regbase + RCR1); | 304 | writeb(tmp, rtc->regbase + RCR1); |
303 | 305 | ||
@@ -618,6 +620,7 @@ static int sh_rtc_irq_set_freq(struct device *dev, int freq) | |||
618 | { | 620 | { |
619 | if (!is_power_of_2(freq)) | 621 | if (!is_power_of_2(freq)) |
620 | return -EINVAL; | 622 | return -EINVAL; |
623 | |||
621 | return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq); | 624 | return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq); |
622 | } | 625 | } |
623 | 626 | ||
@@ -637,7 +640,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
637 | struct sh_rtc *rtc; | 640 | struct sh_rtc *rtc; |
638 | struct resource *res; | 641 | struct resource *res; |
639 | struct rtc_time r; | 642 | struct rtc_time r; |
640 | int ret; | 643 | char clk_name[6]; |
644 | int clk_id, ret; | ||
641 | 645 | ||
642 | rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL); | 646 | rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL); |
643 | if (unlikely(!rtc)) | 647 | if (unlikely(!rtc)) |
@@ -652,6 +656,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
652 | dev_err(&pdev->dev, "No IRQ resource\n"); | 656 | dev_err(&pdev->dev, "No IRQ resource\n"); |
653 | goto err_badres; | 657 | goto err_badres; |
654 | } | 658 | } |
659 | |||
655 | rtc->periodic_irq = ret; | 660 | rtc->periodic_irq = ret; |
656 | rtc->carry_irq = platform_get_irq(pdev, 1); | 661 | rtc->carry_irq = platform_get_irq(pdev, 1); |
657 | rtc->alarm_irq = platform_get_irq(pdev, 2); | 662 | rtc->alarm_irq = platform_get_irq(pdev, 2); |
@@ -663,7 +668,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
663 | goto err_badres; | 668 | goto err_badres; |
664 | } | 669 | } |
665 | 670 | ||
666 | rtc->regsize = res->end - res->start + 1; | 671 | rtc->regsize = resource_size(res); |
667 | 672 | ||
668 | rtc->res = request_mem_region(res->start, rtc->regsize, pdev->name); | 673 | rtc->res = request_mem_region(res->start, rtc->regsize, pdev->name); |
669 | if (unlikely(!rtc->res)) { | 674 | if (unlikely(!rtc->res)) { |
@@ -677,6 +682,26 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
677 | goto err_badmap; | 682 | goto err_badmap; |
678 | } | 683 | } |
679 | 684 | ||
685 | clk_id = pdev->id; | ||
686 | /* With a single device, the clock id is still "rtc0" */ | ||
687 | if (clk_id < 0) | ||
688 | clk_id = 0; | ||
689 | |||
690 | snprintf(clk_name, sizeof(clk_name), "rtc%d", clk_id); | ||
691 | |||
692 | rtc->clk = clk_get(&pdev->dev, clk_name); | ||
693 | if (IS_ERR(rtc->clk)) { | ||
694 | /* | ||
695 | * No error handling for rtc->clk intentionally, not all | ||
696 | * platforms will have a unique clock for the RTC, and | ||
697 | * the clk API can handle the struct clk pointer being | ||
698 | * NULL. | ||
699 | */ | ||
700 | rtc->clk = NULL; | ||
701 | } | ||
702 | |||
703 | clk_enable(rtc->clk); | ||
704 | |||
680 | rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, | 705 | rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, |
681 | &sh_rtc_ops, THIS_MODULE); | 706 | &sh_rtc_ops, THIS_MODULE); |
682 | if (IS_ERR(rtc->rtc_dev)) { | 707 | if (IS_ERR(rtc->rtc_dev)) { |
@@ -759,6 +784,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
759 | return 0; | 784 | return 0; |
760 | 785 | ||
761 | err_unmap: | 786 | err_unmap: |
787 | clk_disable(rtc->clk); | ||
788 | clk_put(rtc->clk); | ||
762 | iounmap(rtc->regbase); | 789 | iounmap(rtc->regbase); |
763 | err_badmap: | 790 | err_badmap: |
764 | release_resource(rtc->res); | 791 | release_resource(rtc->res); |
@@ -780,6 +807,7 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
780 | sh_rtc_setcie(&pdev->dev, 0); | 807 | sh_rtc_setcie(&pdev->dev, 0); |
781 | 808 | ||
782 | free_irq(rtc->periodic_irq, rtc); | 809 | free_irq(rtc->periodic_irq, rtc); |
810 | |||
783 | if (rtc->carry_irq > 0) { | 811 | if (rtc->carry_irq > 0) { |
784 | free_irq(rtc->carry_irq, rtc); | 812 | free_irq(rtc->carry_irq, rtc); |
785 | free_irq(rtc->alarm_irq, rtc); | 813 | free_irq(rtc->alarm_irq, rtc); |
@@ -789,6 +817,9 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) | |||
789 | 817 | ||
790 | iounmap(rtc->regbase); | 818 | iounmap(rtc->regbase); |
791 | 819 | ||
820 | clk_disable(rtc->clk); | ||
821 | clk_put(rtc->clk); | ||
822 | |||
792 | platform_set_drvdata(pdev, NULL); | 823 | platform_set_drvdata(pdev, NULL); |
793 | 824 | ||
794 | kfree(rtc); | 825 | kfree(rtc); |
@@ -802,11 +833,11 @@ static void sh_rtc_set_irq_wake(struct device *dev, int enabled) | |||
802 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | 833 | struct sh_rtc *rtc = platform_get_drvdata(pdev); |
803 | 834 | ||
804 | set_irq_wake(rtc->periodic_irq, enabled); | 835 | set_irq_wake(rtc->periodic_irq, enabled); |
836 | |||
805 | if (rtc->carry_irq > 0) { | 837 | if (rtc->carry_irq > 0) { |
806 | set_irq_wake(rtc->carry_irq, enabled); | 838 | set_irq_wake(rtc->carry_irq, enabled); |
807 | set_irq_wake(rtc->alarm_irq, enabled); | 839 | set_irq_wake(rtc->alarm_irq, enabled); |
808 | } | 840 | } |
809 | |||
810 | } | 841 | } |
811 | 842 | ||
812 | static int sh_rtc_suspend(struct device *dev) | 843 | static int sh_rtc_suspend(struct device *dev) |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index a14d245a66b8..6f51ca485f35 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -180,8 +180,6 @@ int scsi_complete_async_scans(void) | |||
180 | spin_unlock(&async_scan_lock); | 180 | spin_unlock(&async_scan_lock); |
181 | 181 | ||
182 | kfree(data); | 182 | kfree(data); |
183 | /* Synchronize async operations globally */ | ||
184 | async_synchronize_full(); | ||
185 | return 0; | 183 | return 0; |
186 | } | 184 | } |
187 | 185 | ||
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c index 2f21af21269a..74708fcaf82f 100644 --- a/drivers/scsi/scsi_wait_scan.c +++ b/drivers/scsi/scsi_wait_scan.c | |||
@@ -11,10 +11,21 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/device.h> | ||
14 | #include <scsi/scsi_scan.h> | 15 | #include <scsi/scsi_scan.h> |
15 | 16 | ||
16 | static int __init wait_scan_init(void) | 17 | static int __init wait_scan_init(void) |
17 | { | 18 | { |
19 | /* | ||
20 | * First we need to wait for device probing to finish; | ||
21 | * the drivers we just loaded might just still be probing | ||
22 | * and might not yet have reached the scsi async scanning | ||
23 | */ | ||
24 | wait_for_device_probe(); | ||
25 | /* | ||
26 | * and then we wait for the actual asynchronous scsi scan | ||
27 | * to finish. | ||
28 | */ | ||
18 | scsi_complete_async_scans(); | 29 | scsi_complete_async_scans(); |
19 | return 0; | 30 | return 0; |
20 | } | 31 | } |
diff --git a/drivers/serial/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 | } |