diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-01-10 23:10:08 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-01-10 23:10:08 -0500 |
commit | eed0ba0b4ab2d1668588219a8efa81bf8636a12d (patch) | |
tree | f5aa3c732e7830a1b24e6071f8bed0f799881187 /drivers | |
parent | 98b14d6b290d96b24ae993ceaccc59b2aa4b130c (diff) | |
parent | c9de9333f5a860cab82052bce6ac28bcac9b2c26 (diff) |
Merge remote branch 'gcl/next' into next
Diffstat (limited to 'drivers')
451 files changed, 5474 insertions, 3526 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index ba9afeaa23ac..25d3aaebc10d 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -100,24 +100,7 @@ static const struct file_operations acpi_ac_fops = { | |||
100 | .release = single_release, | 100 | .release = single_release, |
101 | }; | 101 | }; |
102 | #endif | 102 | #endif |
103 | static int get_ac_property(struct power_supply *psy, | ||
104 | enum power_supply_property psp, | ||
105 | union power_supply_propval *val) | ||
106 | { | ||
107 | struct acpi_ac *ac = to_acpi_ac(psy); | ||
108 | switch (psp) { | ||
109 | case POWER_SUPPLY_PROP_ONLINE: | ||
110 | val->intval = ac->state; | ||
111 | break; | ||
112 | default: | ||
113 | return -EINVAL; | ||
114 | } | ||
115 | return 0; | ||
116 | } | ||
117 | 103 | ||
118 | static enum power_supply_property ac_props[] = { | ||
119 | POWER_SUPPLY_PROP_ONLINE, | ||
120 | }; | ||
121 | /* -------------------------------------------------------------------------- | 104 | /* -------------------------------------------------------------------------- |
122 | AC Adapter Management | 105 | AC Adapter Management |
123 | -------------------------------------------------------------------------- */ | 106 | -------------------------------------------------------------------------- */ |
@@ -140,6 +123,35 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
140 | return 0; | 123 | return 0; |
141 | } | 124 | } |
142 | 125 | ||
126 | /* -------------------------------------------------------------------------- | ||
127 | sysfs I/F | ||
128 | -------------------------------------------------------------------------- */ | ||
129 | static int get_ac_property(struct power_supply *psy, | ||
130 | enum power_supply_property psp, | ||
131 | union power_supply_propval *val) | ||
132 | { | ||
133 | struct acpi_ac *ac = to_acpi_ac(psy); | ||
134 | |||
135 | if (!ac) | ||
136 | return -ENODEV; | ||
137 | |||
138 | if (acpi_ac_get_state(ac)) | ||
139 | return -ENODEV; | ||
140 | |||
141 | switch (psp) { | ||
142 | case POWER_SUPPLY_PROP_ONLINE: | ||
143 | val->intval = ac->state; | ||
144 | break; | ||
145 | default: | ||
146 | return -EINVAL; | ||
147 | } | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static enum power_supply_property ac_props[] = { | ||
152 | POWER_SUPPLY_PROP_ONLINE, | ||
153 | }; | ||
154 | |||
143 | #ifdef CONFIG_ACPI_PROCFS_POWER | 155 | #ifdef CONFIG_ACPI_PROCFS_POWER |
144 | /* -------------------------------------------------------------------------- | 156 | /* -------------------------------------------------------------------------- |
145 | FS Interface (/proc) | 157 | FS Interface (/proc) |
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index 2c7def95f721..4c8dea513b66 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c | |||
@@ -408,6 +408,9 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle, | |||
408 | return_ACPI_STATUS(AE_OK); | 408 | return_ACPI_STATUS(AE_OK); |
409 | } | 409 | } |
410 | 410 | ||
411 | /* Disable the GPE in case it's been enabled already. */ | ||
412 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); | ||
413 | |||
411 | /* | 414 | /* |
412 | * Add the GPE information from above to the gpe_event_info block for | 415 | * Add the GPE information from above to the gpe_event_info block for |
413 | * use during dispatch of this GPE. | 416 | * use during dispatch of this GPE. |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 1211c03149e8..5850d320404c 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -86,7 +86,7 @@ static struct erst_erange { | |||
86 | * It is used to provide exclusive accessing for ERST Error Log | 86 | * It is used to provide exclusive accessing for ERST Error Log |
87 | * Address Range too. | 87 | * Address Range too. |
88 | */ | 88 | */ |
89 | static DEFINE_SPINLOCK(erst_lock); | 89 | static DEFINE_RAW_SPINLOCK(erst_lock); |
90 | 90 | ||
91 | static inline int erst_errno(int command_status) | 91 | static inline int erst_errno(int command_status) |
92 | { | 92 | { |
@@ -421,9 +421,9 @@ ssize_t erst_get_record_count(void) | |||
421 | if (erst_disable) | 421 | if (erst_disable) |
422 | return -ENODEV; | 422 | return -ENODEV; |
423 | 423 | ||
424 | spin_lock_irqsave(&erst_lock, flags); | 424 | raw_spin_lock_irqsave(&erst_lock, flags); |
425 | count = __erst_get_record_count(); | 425 | count = __erst_get_record_count(); |
426 | spin_unlock_irqrestore(&erst_lock, flags); | 426 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
427 | 427 | ||
428 | return count; | 428 | return count; |
429 | } | 429 | } |
@@ -456,9 +456,9 @@ int erst_get_next_record_id(u64 *record_id) | |||
456 | if (erst_disable) | 456 | if (erst_disable) |
457 | return -ENODEV; | 457 | return -ENODEV; |
458 | 458 | ||
459 | spin_lock_irqsave(&erst_lock, flags); | 459 | raw_spin_lock_irqsave(&erst_lock, flags); |
460 | rc = __erst_get_next_record_id(record_id); | 460 | rc = __erst_get_next_record_id(record_id); |
461 | spin_unlock_irqrestore(&erst_lock, flags); | 461 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
462 | 462 | ||
463 | return rc; | 463 | return rc; |
464 | } | 464 | } |
@@ -624,17 +624,17 @@ int erst_write(const struct cper_record_header *record) | |||
624 | return -EINVAL; | 624 | return -EINVAL; |
625 | 625 | ||
626 | if (erst_erange.attr & ERST_RANGE_NVRAM) { | 626 | if (erst_erange.attr & ERST_RANGE_NVRAM) { |
627 | if (!spin_trylock_irqsave(&erst_lock, flags)) | 627 | if (!raw_spin_trylock_irqsave(&erst_lock, flags)) |
628 | return -EBUSY; | 628 | return -EBUSY; |
629 | rc = __erst_write_to_nvram(record); | 629 | rc = __erst_write_to_nvram(record); |
630 | spin_unlock_irqrestore(&erst_lock, flags); | 630 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
631 | return rc; | 631 | return rc; |
632 | } | 632 | } |
633 | 633 | ||
634 | if (record->record_length > erst_erange.size) | 634 | if (record->record_length > erst_erange.size) |
635 | return -EINVAL; | 635 | return -EINVAL; |
636 | 636 | ||
637 | if (!spin_trylock_irqsave(&erst_lock, flags)) | 637 | if (!raw_spin_trylock_irqsave(&erst_lock, flags)) |
638 | return -EBUSY; | 638 | return -EBUSY; |
639 | memcpy(erst_erange.vaddr, record, record->record_length); | 639 | memcpy(erst_erange.vaddr, record, record->record_length); |
640 | rcd_erange = erst_erange.vaddr; | 640 | rcd_erange = erst_erange.vaddr; |
@@ -642,7 +642,7 @@ int erst_write(const struct cper_record_header *record) | |||
642 | memcpy(&rcd_erange->persistence_information, "ER", 2); | 642 | memcpy(&rcd_erange->persistence_information, "ER", 2); |
643 | 643 | ||
644 | rc = __erst_write_to_storage(0); | 644 | rc = __erst_write_to_storage(0); |
645 | spin_unlock_irqrestore(&erst_lock, flags); | 645 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
646 | 646 | ||
647 | return rc; | 647 | return rc; |
648 | } | 648 | } |
@@ -696,9 +696,9 @@ ssize_t erst_read(u64 record_id, struct cper_record_header *record, | |||
696 | if (erst_disable) | 696 | if (erst_disable) |
697 | return -ENODEV; | 697 | return -ENODEV; |
698 | 698 | ||
699 | spin_lock_irqsave(&erst_lock, flags); | 699 | raw_spin_lock_irqsave(&erst_lock, flags); |
700 | len = __erst_read(record_id, record, buflen); | 700 | len = __erst_read(record_id, record, buflen); |
701 | spin_unlock_irqrestore(&erst_lock, flags); | 701 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
702 | return len; | 702 | return len; |
703 | } | 703 | } |
704 | EXPORT_SYMBOL_GPL(erst_read); | 704 | EXPORT_SYMBOL_GPL(erst_read); |
@@ -719,20 +719,20 @@ ssize_t erst_read_next(struct cper_record_header *record, size_t buflen) | |||
719 | if (erst_disable) | 719 | if (erst_disable) |
720 | return -ENODEV; | 720 | return -ENODEV; |
721 | 721 | ||
722 | spin_lock_irqsave(&erst_lock, flags); | 722 | raw_spin_lock_irqsave(&erst_lock, flags); |
723 | rc = __erst_get_next_record_id(&record_id); | 723 | rc = __erst_get_next_record_id(&record_id); |
724 | if (rc) { | 724 | if (rc) { |
725 | spin_unlock_irqrestore(&erst_lock, flags); | 725 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
726 | return rc; | 726 | return rc; |
727 | } | 727 | } |
728 | /* no more record */ | 728 | /* no more record */ |
729 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { | 729 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { |
730 | spin_unlock_irqrestore(&erst_lock, flags); | 730 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
731 | return 0; | 731 | return 0; |
732 | } | 732 | } |
733 | 733 | ||
734 | len = __erst_read(record_id, record, buflen); | 734 | len = __erst_read(record_id, record, buflen); |
735 | spin_unlock_irqrestore(&erst_lock, flags); | 735 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
736 | 736 | ||
737 | return len; | 737 | return len; |
738 | } | 738 | } |
@@ -746,12 +746,12 @@ int erst_clear(u64 record_id) | |||
746 | if (erst_disable) | 746 | if (erst_disable) |
747 | return -ENODEV; | 747 | return -ENODEV; |
748 | 748 | ||
749 | spin_lock_irqsave(&erst_lock, flags); | 749 | raw_spin_lock_irqsave(&erst_lock, flags); |
750 | if (erst_erange.attr & ERST_RANGE_NVRAM) | 750 | if (erst_erange.attr & ERST_RANGE_NVRAM) |
751 | rc = __erst_clear_from_nvram(record_id); | 751 | rc = __erst_clear_from_nvram(record_id); |
752 | else | 752 | else |
753 | rc = __erst_clear_from_storage(record_id); | 753 | rc = __erst_clear_from_storage(record_id); |
754 | spin_unlock_irqrestore(&erst_lock, flags); | 754 | raw_spin_unlock_irqrestore(&erst_lock, flags); |
755 | 755 | ||
756 | return rc; | 756 | return rc; |
757 | } | 757 | } |
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c index 1a3508a7fe03..daa7bc63f1d4 100644 --- a/drivers/acpi/apei/hest.c +++ b/drivers/acpi/apei/hest.c | |||
@@ -46,9 +46,9 @@ EXPORT_SYMBOL_GPL(hest_disable); | |||
46 | 46 | ||
47 | /* HEST table parsing */ | 47 | /* HEST table parsing */ |
48 | 48 | ||
49 | static struct acpi_table_hest *hest_tab; | 49 | static struct acpi_table_hest *__read_mostly hest_tab; |
50 | 50 | ||
51 | static int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { | 51 | static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { |
52 | [ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */ | 52 | [ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */ |
53 | [ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1, | 53 | [ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1, |
54 | [ACPI_HEST_TYPE_IA32_NMI] = sizeof(struct acpi_hest_ia_nmi), | 54 | [ACPI_HEST_TYPE_IA32_NMI] = sizeof(struct acpi_hest_ia_nmi), |
@@ -126,7 +126,7 @@ struct ghes_arr { | |||
126 | unsigned int count; | 126 | unsigned int count; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) | 129 | static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) |
130 | { | 130 | { |
131 | int *count = data; | 131 | int *count = data; |
132 | 132 | ||
@@ -135,7 +135,7 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) | |||
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) | 138 | static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) |
139 | { | 139 | { |
140 | struct platform_device *ghes_dev; | 140 | struct platform_device *ghes_dev; |
141 | struct ghes_arr *ghes_arr = data; | 141 | struct ghes_arr *ghes_arr = data; |
@@ -165,7 +165,7 @@ err: | |||
165 | return rc; | 165 | return rc; |
166 | } | 166 | } |
167 | 167 | ||
168 | static int hest_ghes_dev_register(unsigned int ghes_count) | 168 | static int __init hest_ghes_dev_register(unsigned int ghes_count) |
169 | { | 169 | { |
170 | int rc, i; | 170 | int rc, i; |
171 | struct ghes_arr ghes_arr; | 171 | struct ghes_arr ghes_arr; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 372ff80b7b0c..302b31ed31f1 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -934,6 +934,9 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { | |||
934 | ec_flag_msi, "MSI hardware", { | 934 | ec_flag_msi, "MSI hardware", { |
935 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, | 935 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, |
936 | { | 936 | { |
937 | ec_flag_msi, "MSI hardware", { | ||
938 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, | ||
939 | { | ||
937 | ec_validate_ecdt, "ASUS hardware", { | 940 | ec_validate_ecdt, "ASUS hardware", { |
938 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, | 941 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, |
939 | {}, | 942 | {}, |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 966feddf6b1b..055d7b701fff 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -110,9 +110,6 @@ struct acpi_ioremap { | |||
110 | static LIST_HEAD(acpi_ioremaps); | 110 | static LIST_HEAD(acpi_ioremaps); |
111 | static DEFINE_SPINLOCK(acpi_ioremap_lock); | 111 | static DEFINE_SPINLOCK(acpi_ioremap_lock); |
112 | 112 | ||
113 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | ||
114 | static char osi_setup_string[OSI_STRING_LENGTH_MAX]; | ||
115 | |||
116 | static void __init acpi_osi_setup_late(void); | 113 | static void __init acpi_osi_setup_late(void); |
117 | 114 | ||
118 | /* | 115 | /* |
@@ -152,8 +149,7 @@ static struct osi_linux { | |||
152 | unsigned int enable:1; | 149 | unsigned int enable:1; |
153 | unsigned int dmi:1; | 150 | unsigned int dmi:1; |
154 | unsigned int cmdline:1; | 151 | unsigned int cmdline:1; |
155 | unsigned int known:1; | 152 | } osi_linux = {0, 0, 0}; |
156 | } osi_linux = { 0, 0, 0, 0}; | ||
157 | 153 | ||
158 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) | 154 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) |
159 | { | 155 | { |
@@ -1055,13 +1051,53 @@ static int __init acpi_os_name_setup(char *str) | |||
1055 | 1051 | ||
1056 | __setup("acpi_os_name=", acpi_os_name_setup); | 1052 | __setup("acpi_os_name=", acpi_os_name_setup); |
1057 | 1053 | ||
1054 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | ||
1055 | #define OSI_STRING_ENTRIES_MAX 16 /* arbitrary */ | ||
1056 | |||
1057 | struct osi_setup_entry { | ||
1058 | char string[OSI_STRING_LENGTH_MAX]; | ||
1059 | bool enable; | ||
1060 | }; | ||
1061 | |||
1062 | static struct osi_setup_entry __initdata osi_setup_entries[OSI_STRING_ENTRIES_MAX]; | ||
1063 | |||
1064 | void __init acpi_osi_setup(char *str) | ||
1065 | { | ||
1066 | struct osi_setup_entry *osi; | ||
1067 | bool enable = true; | ||
1068 | int i; | ||
1069 | |||
1070 | if (!acpi_gbl_create_osi_method) | ||
1071 | return; | ||
1072 | |||
1073 | if (str == NULL || *str == '\0') { | ||
1074 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | ||
1075 | acpi_gbl_create_osi_method = FALSE; | ||
1076 | return; | ||
1077 | } | ||
1078 | |||
1079 | if (*str == '!') { | ||
1080 | str++; | ||
1081 | enable = false; | ||
1082 | } | ||
1083 | |||
1084 | for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { | ||
1085 | osi = &osi_setup_entries[i]; | ||
1086 | if (!strcmp(osi->string, str)) { | ||
1087 | osi->enable = enable; | ||
1088 | break; | ||
1089 | } else if (osi->string[0] == '\0') { | ||
1090 | osi->enable = enable; | ||
1091 | strncpy(osi->string, str, OSI_STRING_LENGTH_MAX); | ||
1092 | break; | ||
1093 | } | ||
1094 | } | ||
1095 | } | ||
1096 | |||
1058 | static void __init set_osi_linux(unsigned int enable) | 1097 | static void __init set_osi_linux(unsigned int enable) |
1059 | { | 1098 | { |
1060 | if (osi_linux.enable != enable) { | 1099 | if (osi_linux.enable != enable) |
1061 | osi_linux.enable = enable; | 1100 | osi_linux.enable = enable; |
1062 | printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", | ||
1063 | enable ? "Add": "Delet"); | ||
1064 | } | ||
1065 | 1101 | ||
1066 | if (osi_linux.enable) | 1102 | if (osi_linux.enable) |
1067 | acpi_osi_setup("Linux"); | 1103 | acpi_osi_setup("Linux"); |
@@ -1073,7 +1109,8 @@ static void __init set_osi_linux(unsigned int enable) | |||
1073 | 1109 | ||
1074 | static void __init acpi_cmdline_osi_linux(unsigned int enable) | 1110 | static void __init acpi_cmdline_osi_linux(unsigned int enable) |
1075 | { | 1111 | { |
1076 | osi_linux.cmdline = 1; /* cmdline set the default */ | 1112 | osi_linux.cmdline = 1; /* cmdline set the default and override DMI */ |
1113 | osi_linux.dmi = 0; | ||
1077 | set_osi_linux(enable); | 1114 | set_osi_linux(enable); |
1078 | 1115 | ||
1079 | return; | 1116 | return; |
@@ -1081,15 +1118,12 @@ static void __init acpi_cmdline_osi_linux(unsigned int enable) | |||
1081 | 1118 | ||
1082 | void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | 1119 | void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) |
1083 | { | 1120 | { |
1084 | osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ | ||
1085 | |||
1086 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); | 1121 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); |
1087 | 1122 | ||
1088 | if (enable == -1) | 1123 | if (enable == -1) |
1089 | return; | 1124 | return; |
1090 | 1125 | ||
1091 | osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */ | 1126 | osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ |
1092 | |||
1093 | set_osi_linux(enable); | 1127 | set_osi_linux(enable); |
1094 | 1128 | ||
1095 | return; | 1129 | return; |
@@ -1104,37 +1138,44 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | |||
1104 | */ | 1138 | */ |
1105 | static void __init acpi_osi_setup_late(void) | 1139 | static void __init acpi_osi_setup_late(void) |
1106 | { | 1140 | { |
1107 | char *str = osi_setup_string; | 1141 | struct osi_setup_entry *osi; |
1142 | char *str; | ||
1143 | int i; | ||
1144 | acpi_status status; | ||
1108 | 1145 | ||
1109 | if (*str == '\0') | 1146 | for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { |
1110 | return; | 1147 | osi = &osi_setup_entries[i]; |
1148 | str = osi->string; | ||
1111 | 1149 | ||
1112 | if (!strcmp("!Linux", str)) { | 1150 | if (*str == '\0') |
1113 | acpi_cmdline_osi_linux(0); /* !enable */ | 1151 | break; |
1114 | } else if (*str == '!') { | 1152 | if (osi->enable) { |
1115 | if (acpi_remove_interface(++str) == AE_OK) | 1153 | status = acpi_install_interface(str); |
1116 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); | 1154 | |
1117 | } else if (!strcmp("Linux", str)) { | 1155 | if (ACPI_SUCCESS(status)) |
1118 | acpi_cmdline_osi_linux(1); /* enable */ | 1156 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); |
1119 | } else { | 1157 | } else { |
1120 | if (acpi_install_interface(str) == AE_OK) | 1158 | status = acpi_remove_interface(str); |
1121 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); | 1159 | |
1160 | if (ACPI_SUCCESS(status)) | ||
1161 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); | ||
1162 | } | ||
1122 | } | 1163 | } |
1123 | } | 1164 | } |
1124 | 1165 | ||
1125 | int __init acpi_osi_setup(char *str) | 1166 | static int __init osi_setup(char *str) |
1126 | { | 1167 | { |
1127 | if (str == NULL || *str == '\0') { | 1168 | if (str && !strcmp("Linux", str)) |
1128 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | 1169 | acpi_cmdline_osi_linux(1); |
1129 | acpi_gbl_create_osi_method = FALSE; | 1170 | else if (str && !strcmp("!Linux", str)) |
1130 | } else { | 1171 | acpi_cmdline_osi_linux(0); |
1131 | strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); | 1172 | else |
1132 | } | 1173 | acpi_osi_setup(str); |
1133 | 1174 | ||
1134 | return 1; | 1175 | return 1; |
1135 | } | 1176 | } |
1136 | 1177 | ||
1137 | __setup("acpi_osi=", acpi_osi_setup); | 1178 | __setup("acpi_osi=", osi_setup); |
1138 | 1179 | ||
1139 | /* enable serialization to combat AE_ALREADY_EXISTS errors */ | 1180 | /* enable serialization to combat AE_ALREADY_EXISTS errors */ |
1140 | static int __init acpi_serialize_setup(char *str) | 1181 | static int __init acpi_serialize_setup(char *str) |
@@ -1530,7 +1571,7 @@ acpi_status __init acpi_os_initialize(void) | |||
1530 | return AE_OK; | 1571 | return AE_OK; |
1531 | } | 1572 | } |
1532 | 1573 | ||
1533 | acpi_status acpi_os_initialize1(void) | 1574 | acpi_status __init acpi_os_initialize1(void) |
1534 | { | 1575 | { |
1535 | kacpid_wq = create_workqueue("kacpid"); | 1576 | kacpid_wq = create_workqueue("kacpid"); |
1536 | kacpi_notify_wq = create_workqueue("kacpi_notify"); | 1577 | kacpi_notify_wq = create_workqueue("kacpi_notify"); |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 67dedeed144c..4c9c2fb5d98f 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -213,11 +213,13 @@ static int acpi_power_on(acpi_handle handle) | |||
213 | resource->name)); | 213 | resource->name)); |
214 | } else { | 214 | } else { |
215 | result = __acpi_power_on(resource); | 215 | result = __acpi_power_on(resource); |
216 | if (result) | ||
217 | resource->ref_count--; | ||
216 | } | 218 | } |
217 | 219 | ||
218 | mutex_unlock(&resource->resource_lock); | 220 | mutex_unlock(&resource->resource_lock); |
219 | 221 | ||
220 | return 0; | 222 | return result; |
221 | } | 223 | } |
222 | 224 | ||
223 | static int acpi_power_off_device(acpi_handle handle) | 225 | static int acpi_power_off_device(acpi_handle handle) |
@@ -465,10 +467,12 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
465 | struct acpi_handle_list *tl = NULL; /* Target Resources */ | 467 | struct acpi_handle_list *tl = NULL; /* Target Resources */ |
466 | int i = 0; | 468 | int i = 0; |
467 | 469 | ||
468 | |||
469 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) | 470 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) |
470 | return -EINVAL; | 471 | return -EINVAL; |
471 | 472 | ||
473 | if (device->power.state == state) | ||
474 | return 0; | ||
475 | |||
472 | if ((device->power.state < ACPI_STATE_D0) | 476 | if ((device->power.state < ACPI_STATE_D0) |
473 | || (device->power.state > ACPI_STATE_D3)) | 477 | || (device->power.state > ACPI_STATE_D3)) |
474 | return -ENODEV; | 478 | return -ENODEV; |
@@ -488,10 +492,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
488 | goto end; | 492 | goto end; |
489 | } | 493 | } |
490 | 494 | ||
491 | if (device->power.state == state) { | ||
492 | goto end; | ||
493 | } | ||
494 | |||
495 | /* | 495 | /* |
496 | * Then we dereference all power resources used in the current list. | 496 | * Then we dereference all power resources used in the current list. |
497 | */ | 497 | */ |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index fde49b9b1d99..79cb65332894 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -156,15 +156,6 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) | |||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | static int acpi_thermal_cpufreq_increase(unsigned int cpu) | ||
160 | { | ||
161 | return -ENODEV; | ||
162 | } | ||
163 | static int acpi_thermal_cpufreq_decrease(unsigned int cpu) | ||
164 | { | ||
165 | return -ENODEV; | ||
166 | } | ||
167 | |||
168 | #endif | 159 | #endif |
169 | 160 | ||
170 | int acpi_processor_get_limit_info(struct acpi_processor *pr) | 161 | int acpi_processor_get_limit_info(struct acpi_processor *pr) |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 2b6c21d86b98..29ef505c487b 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -705,54 +705,85 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device) | |||
705 | } | 705 | } |
706 | 706 | ||
707 | static acpi_status | 707 | static acpi_status |
708 | acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, | 708 | acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, |
709 | union acpi_object *package) | 709 | struct acpi_device_wakeup *wakeup) |
710 | { | 710 | { |
711 | int i = 0; | 711 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
712 | union acpi_object *package = NULL; | ||
712 | union acpi_object *element = NULL; | 713 | union acpi_object *element = NULL; |
714 | acpi_status status; | ||
715 | int i = 0; | ||
713 | 716 | ||
714 | if (!device || !package || (package->package.count < 2)) | 717 | if (!wakeup) |
715 | return AE_BAD_PARAMETER; | 718 | return AE_BAD_PARAMETER; |
716 | 719 | ||
720 | /* _PRW */ | ||
721 | status = acpi_evaluate_object(handle, "_PRW", NULL, &buffer); | ||
722 | if (ACPI_FAILURE(status)) { | ||
723 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); | ||
724 | return status; | ||
725 | } | ||
726 | |||
727 | package = (union acpi_object *)buffer.pointer; | ||
728 | |||
729 | if (!package || (package->package.count < 2)) { | ||
730 | status = AE_BAD_DATA; | ||
731 | goto out; | ||
732 | } | ||
733 | |||
717 | element = &(package->package.elements[0]); | 734 | element = &(package->package.elements[0]); |
718 | if (!element) | 735 | if (!element) { |
719 | return AE_BAD_PARAMETER; | 736 | status = AE_BAD_DATA; |
737 | goto out; | ||
738 | } | ||
720 | if (element->type == ACPI_TYPE_PACKAGE) { | 739 | if (element->type == ACPI_TYPE_PACKAGE) { |
721 | if ((element->package.count < 2) || | 740 | if ((element->package.count < 2) || |
722 | (element->package.elements[0].type != | 741 | (element->package.elements[0].type != |
723 | ACPI_TYPE_LOCAL_REFERENCE) | 742 | ACPI_TYPE_LOCAL_REFERENCE) |
724 | || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) | 743 | || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) { |
725 | return AE_BAD_DATA; | 744 | status = AE_BAD_DATA; |
726 | device->wakeup.gpe_device = | 745 | goto out; |
746 | } | ||
747 | wakeup->gpe_device = | ||
727 | element->package.elements[0].reference.handle; | 748 | element->package.elements[0].reference.handle; |
728 | device->wakeup.gpe_number = | 749 | wakeup->gpe_number = |
729 | (u32) element->package.elements[1].integer.value; | 750 | (u32) element->package.elements[1].integer.value; |
730 | } else if (element->type == ACPI_TYPE_INTEGER) { | 751 | } else if (element->type == ACPI_TYPE_INTEGER) { |
731 | device->wakeup.gpe_number = element->integer.value; | 752 | wakeup->gpe_device = NULL; |
732 | } else | 753 | wakeup->gpe_number = element->integer.value; |
733 | return AE_BAD_DATA; | 754 | } else { |
755 | status = AE_BAD_DATA; | ||
756 | goto out; | ||
757 | } | ||
734 | 758 | ||
735 | element = &(package->package.elements[1]); | 759 | element = &(package->package.elements[1]); |
736 | if (element->type != ACPI_TYPE_INTEGER) { | 760 | if (element->type != ACPI_TYPE_INTEGER) { |
737 | return AE_BAD_DATA; | 761 | status = AE_BAD_DATA; |
762 | goto out; | ||
738 | } | 763 | } |
739 | device->wakeup.sleep_state = element->integer.value; | 764 | wakeup->sleep_state = element->integer.value; |
740 | 765 | ||
741 | if ((package->package.count - 2) > ACPI_MAX_HANDLES) { | 766 | if ((package->package.count - 2) > ACPI_MAX_HANDLES) { |
742 | return AE_NO_MEMORY; | 767 | status = AE_NO_MEMORY; |
768 | goto out; | ||
743 | } | 769 | } |
744 | device->wakeup.resources.count = package->package.count - 2; | 770 | wakeup->resources.count = package->package.count - 2; |
745 | for (i = 0; i < device->wakeup.resources.count; i++) { | 771 | for (i = 0; i < wakeup->resources.count; i++) { |
746 | element = &(package->package.elements[i + 2]); | 772 | element = &(package->package.elements[i + 2]); |
747 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) | 773 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { |
748 | return AE_BAD_DATA; | 774 | status = AE_BAD_DATA; |
775 | goto out; | ||
776 | } | ||
749 | 777 | ||
750 | device->wakeup.resources.handles[i] = element->reference.handle; | 778 | wakeup->resources.handles[i] = element->reference.handle; |
751 | } | 779 | } |
752 | 780 | ||
753 | acpi_gpe_can_wake(device->wakeup.gpe_device, device->wakeup.gpe_number); | 781 | acpi_gpe_can_wake(wakeup->gpe_device, wakeup->gpe_number); |
754 | 782 | ||
755 | return AE_OK; | 783 | out: |
784 | kfree(buffer.pointer); | ||
785 | |||
786 | return status; | ||
756 | } | 787 | } |
757 | 788 | ||
758 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | 789 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) |
@@ -787,26 +818,15 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | |||
787 | static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | 818 | static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) |
788 | { | 819 | { |
789 | acpi_status status = 0; | 820 | acpi_status status = 0; |
790 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
791 | union acpi_object *package = NULL; | ||
792 | int psw_error; | 821 | int psw_error; |
793 | 822 | ||
794 | /* _PRW */ | 823 | status = acpi_bus_extract_wakeup_device_power_package(device->handle, |
795 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 824 | &device->wakeup); |
796 | if (ACPI_FAILURE(status)) { | ||
797 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); | ||
798 | goto end; | ||
799 | } | ||
800 | |||
801 | package = (union acpi_object *)buffer.pointer; | ||
802 | status = acpi_bus_extract_wakeup_device_power_package(device, package); | ||
803 | if (ACPI_FAILURE(status)) { | 825 | if (ACPI_FAILURE(status)) { |
804 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); | 826 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); |
805 | goto end; | 827 | goto end; |
806 | } | 828 | } |
807 | 829 | ||
808 | kfree(buffer.pointer); | ||
809 | |||
810 | device->wakeup.flags.valid = 1; | 830 | device->wakeup.flags.valid = 1; |
811 | device->wakeup.prepare_count = 0; | 831 | device->wakeup.prepare_count = 0; |
812 | acpi_bus_set_run_wake_flags(device); | 832 | acpi_bus_set_run_wake_flags(device); |
@@ -1351,6 +1371,7 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl, | |||
1351 | struct acpi_bus_ops *ops = context; | 1371 | struct acpi_bus_ops *ops = context; |
1352 | int type; | 1372 | int type; |
1353 | unsigned long long sta; | 1373 | unsigned long long sta; |
1374 | struct acpi_device_wakeup wakeup; | ||
1354 | struct acpi_device *device; | 1375 | struct acpi_device *device; |
1355 | acpi_status status; | 1376 | acpi_status status; |
1356 | int result; | 1377 | int result; |
@@ -1360,8 +1381,10 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl, | |||
1360 | return AE_OK; | 1381 | return AE_OK; |
1361 | 1382 | ||
1362 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && | 1383 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && |
1363 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) | 1384 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { |
1385 | acpi_bus_extract_wakeup_device_power_package(handle, &wakeup); | ||
1364 | return AE_CTRL_DEPTH; | 1386 | return AE_CTRL_DEPTH; |
1387 | } | ||
1365 | 1388 | ||
1366 | /* | 1389 | /* |
1367 | * We may already have an acpi_device from a previous enumeration. If | 1390 | * We may already have an acpi_device from a previous enumeration. If |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 721d93b3ceee..febb153b5a68 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | static u8 sleep_states[ACPI_S_STATE_COUNT]; | 28 | static u8 sleep_states[ACPI_S_STATE_COUNT]; |
29 | 29 | ||
30 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
31 | |||
32 | static void acpi_sleep_tts_switch(u32 acpi_state) | 30 | static void acpi_sleep_tts_switch(u32 acpi_state) |
33 | { | 31 | { |
34 | union acpi_object in_arg = { ACPI_TYPE_INTEGER }; | 32 | union acpi_object in_arg = { ACPI_TYPE_INTEGER }; |
@@ -81,6 +79,8 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
81 | } | 79 | } |
82 | 80 | ||
83 | #ifdef CONFIG_ACPI_SLEEP | 81 | #ifdef CONFIG_ACPI_SLEEP |
82 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
83 | |||
84 | /* | 84 | /* |
85 | * The ACPI specification wants us to save NVS memory regions during hibernation | 85 | * The ACPI specification wants us to save NVS memory regions during hibernation |
86 | * and to restore them during the subsequent resume. Windows does that also for | 86 | * and to restore them during the subsequent resume. Windows does that also for |
@@ -427,6 +427,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
427 | DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"), | 427 | DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"), |
428 | }, | 428 | }, |
429 | }, | 429 | }, |
430 | { | ||
431 | .callback = init_nvs_nosave, | ||
432 | .ident = "Sony Vaio VGN-NW130D", | ||
433 | .matches = { | ||
434 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
435 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"), | ||
436 | }, | ||
437 | }, | ||
430 | {}, | 438 | {}, |
431 | }; | 439 | }; |
432 | #endif /* CONFIG_SUSPEND */ | 440 | #endif /* CONFIG_SUSPEND */ |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 11ec911016c6..36e2319264bd 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -128,16 +128,6 @@ config PDC_ADMA | |||
128 | 128 | ||
129 | If unsure, say N. | 129 | If unsure, say N. |
130 | 130 | ||
131 | config PATA_MPC52xx | ||
132 | tristate "Freescale MPC52xx SoC internal IDE" | ||
133 | depends on PPC_MPC52xx && PPC_BESTCOMM | ||
134 | select PPC_BESTCOMM_ATA | ||
135 | help | ||
136 | This option enables support for integrated IDE controller | ||
137 | of the Freescale MPC52xx SoC. | ||
138 | |||
139 | If unsure, say N. | ||
140 | |||
141 | config PATA_OCTEON_CF | 131 | config PATA_OCTEON_CF |
142 | tristate "OCTEON Boot Bus Compact Flash support" | 132 | tristate "OCTEON Boot Bus Compact Flash support" |
143 | depends on CPU_CAVIUM_OCTEON | 133 | depends on CPU_CAVIUM_OCTEON |
@@ -366,7 +356,7 @@ config PATA_CS5535 | |||
366 | 356 | ||
367 | config PATA_CS5536 | 357 | config PATA_CS5536 |
368 | tristate "CS5536 PATA support" | 358 | tristate "CS5536 PATA support" |
369 | depends on PCI && X86 && !X86_64 | 359 | depends on PCI |
370 | help | 360 | help |
371 | This option enables support for the AMD CS5536 | 361 | This option enables support for the AMD CS5536 |
372 | companion chip used with the Geode LX processor family. | 362 | companion chip used with the Geode LX processor family. |
@@ -491,6 +481,16 @@ config PATA_MARVELL | |||
491 | 481 | ||
492 | If unsure, say N. | 482 | If unsure, say N. |
493 | 483 | ||
484 | config PATA_MPC52xx | ||
485 | tristate "Freescale MPC52xx SoC internal IDE" | ||
486 | depends on PPC_MPC52xx && PPC_BESTCOMM | ||
487 | select PPC_BESTCOMM_ATA | ||
488 | help | ||
489 | This option enables support for integrated IDE controller | ||
490 | of the Freescale MPC52xx SoC. | ||
491 | |||
492 | If unsure, say N. | ||
493 | |||
494 | config PATA_NETCELL | 494 | config PATA_NETCELL |
495 | tristate "NETCELL Revolution RAID support" | 495 | tristate "NETCELL Revolution RAID support" |
496 | depends on PCI | 496 | depends on PCI |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index c501af5b12b9..2b67c900a459 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -11,7 +11,6 @@ obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o | |||
11 | 11 | ||
12 | # SFF w/ custom DMA | 12 | # SFF w/ custom DMA |
13 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o | 13 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o |
14 | obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o | ||
15 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o | 14 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o |
16 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o | 15 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o |
17 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o | 16 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o |
@@ -52,6 +51,7 @@ obj-$(CONFIG_PATA_IT821X) += pata_it821x.o | |||
52 | obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o | 51 | obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o |
53 | obj-$(CONFIG_PATA_MACIO) += pata_macio.o | 52 | obj-$(CONFIG_PATA_MACIO) += pata_macio.o |
54 | obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o | 53 | obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o |
54 | obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o | ||
55 | obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o | 55 | obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o |
56 | obj-$(CONFIG_PATA_NINJA32) += pata_ninja32.o | 56 | obj-$(CONFIG_PATA_NINJA32) += pata_ninja32.o |
57 | obj-$(CONFIG_PATA_NS87415) += pata_ns87415.o | 57 | obj-$(CONFIG_PATA_NS87415) += pata_ns87415.o |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 7f77c67d267c..f23d6d46b95b 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4807,9 +4807,6 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) | |||
4807 | { | 4807 | { |
4808 | struct ata_device *dev = qc->dev; | 4808 | struct ata_device *dev = qc->dev; |
4809 | 4809 | ||
4810 | if (ata_tag_internal(qc->tag)) | ||
4811 | return; | ||
4812 | |||
4813 | if (ata_is_nodata(qc->tf.protocol)) | 4810 | if (ata_is_nodata(qc->tf.protocol)) |
4814 | return; | 4811 | return; |
4815 | 4812 | ||
@@ -4858,14 +4855,23 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
4858 | if (unlikely(qc->err_mask)) | 4855 | if (unlikely(qc->err_mask)) |
4859 | qc->flags |= ATA_QCFLAG_FAILED; | 4856 | qc->flags |= ATA_QCFLAG_FAILED; |
4860 | 4857 | ||
4861 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { | 4858 | /* |
4862 | /* always fill result TF for failed qc */ | 4859 | * Finish internal commands without any further processing |
4860 | * and always with the result TF filled. | ||
4861 | */ | ||
4862 | if (unlikely(ata_tag_internal(qc->tag))) { | ||
4863 | fill_result_tf(qc); | 4863 | fill_result_tf(qc); |
4864 | __ata_qc_complete(qc); | ||
4865 | return; | ||
4866 | } | ||
4864 | 4867 | ||
4865 | if (!ata_tag_internal(qc->tag)) | 4868 | /* |
4866 | ata_qc_schedule_eh(qc); | 4869 | * Non-internal qc has failed. Fill the result TF and |
4867 | else | 4870 | * summon EH. |
4868 | __ata_qc_complete(qc); | 4871 | */ |
4872 | if (unlikely(qc->flags & ATA_QCFLAG_FAILED)) { | ||
4873 | fill_result_tf(qc); | ||
4874 | ata_qc_schedule_eh(qc); | ||
4869 | return; | 4875 | return; |
4870 | } | 4876 | } |
4871 | 4877 | ||
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 5e590504f3aa..17a637877d03 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -3275,6 +3275,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
3275 | struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; | 3275 | struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; |
3276 | struct ata_eh_context *ehc = &link->eh_context; | 3276 | struct ata_eh_context *ehc = &link->eh_context; |
3277 | struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; | 3277 | struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; |
3278 | enum ata_lpm_policy old_policy = link->lpm_policy; | ||
3278 | unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; | 3279 | unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; |
3279 | unsigned int err_mask; | 3280 | unsigned int err_mask; |
3280 | int rc; | 3281 | int rc; |
@@ -3338,6 +3339,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
3338 | goto fail; | 3339 | goto fail; |
3339 | } | 3340 | } |
3340 | 3341 | ||
3342 | /* | ||
3343 | * Low level driver acked the transition. Issue DIPM command | ||
3344 | * with the new policy set. | ||
3345 | */ | ||
3346 | link->lpm_policy = policy; | ||
3347 | if (ap && ap->slave_link) | ||
3348 | ap->slave_link->lpm_policy = policy; | ||
3349 | |||
3341 | /* host config updated, enable DIPM if transitioning to MIN_POWER */ | 3350 | /* host config updated, enable DIPM if transitioning to MIN_POWER */ |
3342 | ata_for_each_dev(dev, link, ENABLED) { | 3351 | ata_for_each_dev(dev, link, ENABLED) { |
3343 | if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { | 3352 | if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { |
@@ -3353,12 +3362,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
3353 | } | 3362 | } |
3354 | } | 3363 | } |
3355 | 3364 | ||
3356 | link->lpm_policy = policy; | ||
3357 | if (ap && ap->slave_link) | ||
3358 | ap->slave_link->lpm_policy = policy; | ||
3359 | return 0; | 3365 | return 0; |
3360 | 3366 | ||
3361 | fail: | 3367 | fail: |
3368 | /* restore the old policy */ | ||
3369 | link->lpm_policy = old_policy; | ||
3370 | if (ap && ap->slave_link) | ||
3371 | ap->slave_link->lpm_policy = old_policy; | ||
3372 | |||
3362 | /* if no device or only one more chance is left, disable LPM */ | 3373 | /* if no device or only one more chance is left, disable LPM */ |
3363 | if (!dev || ehc->tries[dev->devno] <= 2) { | 3374 | if (!dev || ehc->tries[dev->devno] <= 2) { |
3364 | ata_link_printk(link, KERN_WARNING, | 3375 | ata_link_printk(link, KERN_WARNING, |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index d05387d1e14b..484697fef386 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1532,11 +1532,10 @@ static unsigned int __ata_sff_port_intr(struct ata_port *ap, | |||
1532 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | 1532 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
1533 | return ata_sff_idle_irq(ap); | 1533 | return ata_sff_idle_irq(ap); |
1534 | break; | 1534 | break; |
1535 | case HSM_ST: | 1535 | case HSM_ST_IDLE: |
1536 | case HSM_ST_LAST: | ||
1537 | break; | ||
1538 | default: | ||
1539 | return ata_sff_idle_irq(ap); | 1536 | return ata_sff_idle_irq(ap); |
1537 | default: | ||
1538 | break; | ||
1540 | } | 1539 | } |
1541 | 1540 | ||
1542 | /* check main status, clearing INTRQ if needed */ | 1541 | /* check main status, clearing INTRQ if needed */ |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index 21ee23f89e88..628c8fae5937 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
@@ -37,10 +37,22 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/libata.h> | 38 | #include <linux/libata.h> |
39 | #include <scsi/scsi_host.h> | 39 | #include <scsi/scsi_host.h> |
40 | |||
41 | #ifdef CONFIG_X86_32 | ||
40 | #include <asm/msr.h> | 42 | #include <asm/msr.h> |
43 | static int use_msr; | ||
44 | module_param_named(msr, use_msr, int, 0644); | ||
45 | MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)"); | ||
46 | #else | ||
47 | #undef rdmsr /* avoid accidental MSR usage on, e.g. x86-64 */ | ||
48 | #undef wrmsr | ||
49 | #define rdmsr(x, y, z) do { } while (0) | ||
50 | #define wrmsr(x, y, z) do { } while (0) | ||
51 | #define use_msr 0 | ||
52 | #endif | ||
41 | 53 | ||
42 | #define DRV_NAME "pata_cs5536" | 54 | #define DRV_NAME "pata_cs5536" |
43 | #define DRV_VERSION "0.0.7" | 55 | #define DRV_VERSION "0.0.8" |
44 | 56 | ||
45 | enum { | 57 | enum { |
46 | CFG = 0, | 58 | CFG = 0, |
@@ -75,8 +87,6 @@ enum { | |||
75 | IDE_ETC_NODMA = 0x03, | 87 | IDE_ETC_NODMA = 0x03, |
76 | }; | 88 | }; |
77 | 89 | ||
78 | static int use_msr; | ||
79 | |||
80 | static const u32 msr_reg[4] = { | 90 | static const u32 msr_reg[4] = { |
81 | MSR_IDE_CFG, MSR_IDE_DTC, MSR_IDE_CAST, MSR_IDE_ETC, | 91 | MSR_IDE_CFG, MSR_IDE_DTC, MSR_IDE_CAST, MSR_IDE_ETC, |
82 | }; | 92 | }; |
@@ -88,7 +98,7 @@ static const u8 pci_reg[4] = { | |||
88 | static inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val) | 98 | static inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val) |
89 | { | 99 | { |
90 | if (unlikely(use_msr)) { | 100 | if (unlikely(use_msr)) { |
91 | u32 dummy; | 101 | u32 dummy __maybe_unused; |
92 | 102 | ||
93 | rdmsr(msr_reg[reg], *val, dummy); | 103 | rdmsr(msr_reg[reg], *val, dummy); |
94 | return 0; | 104 | return 0; |
@@ -294,8 +304,6 @@ MODULE_DESCRIPTION("low-level driver for the CS5536 IDE controller"); | |||
294 | MODULE_LICENSE("GPL"); | 304 | MODULE_LICENSE("GPL"); |
295 | MODULE_DEVICE_TABLE(pci, cs5536); | 305 | MODULE_DEVICE_TABLE(pci, cs5536); |
296 | MODULE_VERSION(DRV_VERSION); | 306 | MODULE_VERSION(DRV_VERSION); |
297 | module_param_named(msr, use_msr, int, 0644); | ||
298 | MODULE_PARM_DESC(msr, "Force using MSR to configure IDE function (Default: 0)"); | ||
299 | 307 | ||
300 | module_init(cs5536_init); | 308 | module_init(cs5536_init); |
301 | module_exit(cs5536_exit); | 309 | module_exit(cs5536_exit); |
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c index 46b94762125b..f9b983ae6877 100644 --- a/drivers/atm/adummy.c +++ b/drivers/atm/adummy.c | |||
@@ -154,7 +154,7 @@ static int __init adummy_init(void) | |||
154 | err = -ENOMEM; | 154 | err = -ENOMEM; |
155 | goto out; | 155 | goto out; |
156 | } | 156 | } |
157 | atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL); | 157 | atm_dev = atm_dev_register(DEV_LABEL, NULL, &adummy_ops, -1, NULL); |
158 | if (!atm_dev) { | 158 | if (!atm_dev) { |
159 | printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); | 159 | printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); |
160 | err = -ENODEV; | 160 | err = -ENODEV; |
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index a33896a482e6..ffe9b655292e 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -2244,7 +2244,8 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_ | |||
2244 | goto out_reset; | 2244 | goto out_reset; |
2245 | } | 2245 | } |
2246 | 2246 | ||
2247 | dev->atm_dev = atm_dev_register (DEV_LABEL, &amb_ops, -1, NULL); | 2247 | dev->atm_dev = atm_dev_register (DEV_LABEL, &pci_dev->dev, &amb_ops, -1, |
2248 | NULL); | ||
2248 | if (!dev->atm_dev) { | 2249 | if (!dev->atm_dev) { |
2249 | PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); | 2250 | PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); |
2250 | err = -EINVAL; | 2251 | err = -EINVAL; |
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index b9101818b47b..2b464b631f22 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c | |||
@@ -366,7 +366,7 @@ static int atmtcp_create(int itf,int persist,struct atm_dev **result) | |||
366 | if (!dev_data) | 366 | if (!dev_data) |
367 | return -ENOMEM; | 367 | return -ENOMEM; |
368 | 368 | ||
369 | dev = atm_dev_register(DEV_LABEL,&atmtcp_v_dev_ops,itf,NULL); | 369 | dev = atm_dev_register(DEV_LABEL,NULL,&atmtcp_v_dev_ops,itf,NULL); |
370 | if (!dev) { | 370 | if (!dev) { |
371 | kfree(dev_data); | 371 | kfree(dev_data); |
372 | return itf == -1 ? -ENOMEM : -EBUSY; | 372 | return itf == -1 ? -ENOMEM : -EBUSY; |
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index 97c5898cd76e..c495fae74200 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c | |||
@@ -2244,7 +2244,7 @@ static int __devinit eni_init_one(struct pci_dev *pci_dev, | |||
2244 | &zeroes); | 2244 | &zeroes); |
2245 | if (!cpu_zeroes) goto out1; | 2245 | if (!cpu_zeroes) goto out1; |
2246 | } | 2246 | } |
2247 | dev = atm_dev_register(DEV_LABEL,&ops,-1,NULL); | 2247 | dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &ops, -1, NULL); |
2248 | if (!dev) goto out2; | 2248 | if (!dev) goto out2; |
2249 | pci_set_drvdata(pci_dev, dev); | 2249 | pci_set_drvdata(pci_dev, dev); |
2250 | eni_dev->pci_dev = pci_dev; | 2250 | eni_dev->pci_dev = pci_dev; |
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index 5d86bb803e94..7d912baf01d4 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -1911,7 +1911,7 @@ static int __devinit firestream_init_one (struct pci_dev *pci_dev, | |||
1911 | fs_dev, sizeof (struct fs_dev)); | 1911 | fs_dev, sizeof (struct fs_dev)); |
1912 | if (!fs_dev) | 1912 | if (!fs_dev) |
1913 | goto err_out; | 1913 | goto err_out; |
1914 | atm_dev = atm_dev_register("fs", &ops, -1, NULL); | 1914 | atm_dev = atm_dev_register("fs", &pci_dev->dev, &ops, -1, NULL); |
1915 | if (!atm_dev) | 1915 | if (!atm_dev) |
1916 | goto err_out_free_fs_dev; | 1916 | goto err_out_free_fs_dev; |
1917 | 1917 | ||
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index c8fc69c85a06..962c309b40c0 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -2567,14 +2567,14 @@ release: | |||
2567 | 2567 | ||
2568 | 2568 | ||
2569 | static int __devinit | 2569 | static int __devinit |
2570 | fore200e_register(struct fore200e* fore200e) | 2570 | fore200e_register(struct fore200e* fore200e, struct device *parent) |
2571 | { | 2571 | { |
2572 | struct atm_dev* atm_dev; | 2572 | struct atm_dev* atm_dev; |
2573 | 2573 | ||
2574 | DPRINTK(2, "device %s being registered\n", fore200e->name); | 2574 | DPRINTK(2, "device %s being registered\n", fore200e->name); |
2575 | 2575 | ||
2576 | atm_dev = atm_dev_register(fore200e->bus->proc_name, &fore200e_ops, -1, | 2576 | atm_dev = atm_dev_register(fore200e->bus->proc_name, parent, &fore200e_ops, |
2577 | NULL); | 2577 | -1, NULL); |
2578 | if (atm_dev == NULL) { | 2578 | if (atm_dev == NULL) { |
2579 | printk(FORE200E "unable to register device %s\n", fore200e->name); | 2579 | printk(FORE200E "unable to register device %s\n", fore200e->name); |
2580 | return -ENODEV; | 2580 | return -ENODEV; |
@@ -2594,9 +2594,9 @@ fore200e_register(struct fore200e* fore200e) | |||
2594 | 2594 | ||
2595 | 2595 | ||
2596 | static int __devinit | 2596 | static int __devinit |
2597 | fore200e_init(struct fore200e* fore200e) | 2597 | fore200e_init(struct fore200e* fore200e, struct device *parent) |
2598 | { | 2598 | { |
2599 | if (fore200e_register(fore200e) < 0) | 2599 | if (fore200e_register(fore200e, parent) < 0) |
2600 | return -ENODEV; | 2600 | return -ENODEV; |
2601 | 2601 | ||
2602 | if (fore200e->bus->configure(fore200e) < 0) | 2602 | if (fore200e->bus->configure(fore200e) < 0) |
@@ -2662,7 +2662,7 @@ static int __devinit fore200e_sba_probe(struct platform_device *op, | |||
2662 | 2662 | ||
2663 | sprintf(fore200e->name, "%s-%d", bus->model_name, index); | 2663 | sprintf(fore200e->name, "%s-%d", bus->model_name, index); |
2664 | 2664 | ||
2665 | err = fore200e_init(fore200e); | 2665 | err = fore200e_init(fore200e, &op->dev); |
2666 | if (err < 0) { | 2666 | if (err < 0) { |
2667 | fore200e_shutdown(fore200e); | 2667 | fore200e_shutdown(fore200e); |
2668 | kfree(fore200e); | 2668 | kfree(fore200e); |
@@ -2740,7 +2740,7 @@ fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent | |||
2740 | 2740 | ||
2741 | sprintf(fore200e->name, "%s-%d", bus->model_name, index); | 2741 | sprintf(fore200e->name, "%s-%d", bus->model_name, index); |
2742 | 2742 | ||
2743 | err = fore200e_init(fore200e); | 2743 | err = fore200e_init(fore200e, &pci_dev->dev); |
2744 | if (err < 0) { | 2744 | if (err < 0) { |
2745 | fore200e_shutdown(fore200e); | 2745 | fore200e_shutdown(fore200e); |
2746 | goto out_free; | 2746 | goto out_free; |
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 801e8b6e9d1f..6cf59bf281dc 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -366,7 +366,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) | |||
366 | goto init_one_failure; | 366 | goto init_one_failure; |
367 | } | 367 | } |
368 | 368 | ||
369 | atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, NULL); | 369 | atm_dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &he_ops, -1, NULL); |
370 | if (!atm_dev) { | 370 | if (!atm_dev) { |
371 | err = -ENODEV; | 371 | err = -ENODEV; |
372 | goto init_one_failure; | 372 | goto init_one_failure; |
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index a95790452a68..24761e1d6642 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c | |||
@@ -2733,7 +2733,8 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_ | |||
2733 | PRINTD(DBG_INFO, "found Madge ATM adapter (hrz) at: IO %x, IRQ %u, MEM %p", | 2733 | PRINTD(DBG_INFO, "found Madge ATM adapter (hrz) at: IO %x, IRQ %u, MEM %p", |
2734 | iobase, irq, membase); | 2734 | iobase, irq, membase); |
2735 | 2735 | ||
2736 | dev->atm_dev = atm_dev_register(DEV_LABEL, &hrz_ops, -1, NULL); | 2736 | dev->atm_dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &hrz_ops, -1, |
2737 | NULL); | ||
2737 | if (!(dev->atm_dev)) { | 2738 | if (!(dev->atm_dev)) { |
2738 | PRINTD(DBG_ERR, "failed to register Madge ATM adapter"); | 2739 | PRINTD(DBG_ERR, "failed to register Madge ATM adapter"); |
2739 | err = -EINVAL; | 2740 | err = -EINVAL; |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index bce57328ddde..bfb7feee0400 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -3698,7 +3698,8 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) | |||
3698 | goto err_out_iounmap; | 3698 | goto err_out_iounmap; |
3699 | } | 3699 | } |
3700 | 3700 | ||
3701 | dev = atm_dev_register("idt77252", &idt77252_ops, -1, NULL); | 3701 | dev = atm_dev_register("idt77252", &pcidev->dev, &idt77252_ops, -1, |
3702 | NULL); | ||
3702 | if (!dev) { | 3703 | if (!dev) { |
3703 | printk("%s: can't register atm device\n", card->name); | 3704 | printk("%s: can't register atm device\n", card->name); |
3704 | err = -EIO; | 3705 | err = -EIO; |
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 9309d4724e13..729254053758 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c | |||
@@ -3172,7 +3172,7 @@ static int __devinit ia_init_one(struct pci_dev *pdev, | |||
3172 | ret = -ENODEV; | 3172 | ret = -ENODEV; |
3173 | goto err_out_free_iadev; | 3173 | goto err_out_free_iadev; |
3174 | } | 3174 | } |
3175 | dev = atm_dev_register(DEV_LABEL, &ops, -1, NULL); | 3175 | dev = atm_dev_register(DEV_LABEL, &pdev->dev, &ops, -1, NULL); |
3176 | if (!dev) { | 3176 | if (!dev) { |
3177 | ret = -ENOMEM; | 3177 | ret = -ENOMEM; |
3178 | goto err_out_disable_dev; | 3178 | goto err_out_disable_dev; |
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index cbe15a86c669..a395c9aab146 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c | |||
@@ -2591,7 +2591,7 @@ static int __devinit lanai_init_one(struct pci_dev *pci, | |||
2591 | return -ENOMEM; | 2591 | return -ENOMEM; |
2592 | } | 2592 | } |
2593 | 2593 | ||
2594 | atmdev = atm_dev_register(DEV_LABEL, &ops, -1, NULL); | 2594 | atmdev = atm_dev_register(DEV_LABEL, &pci->dev, &ops, -1, NULL); |
2595 | if (atmdev == NULL) { | 2595 | if (atmdev == NULL) { |
2596 | printk(KERN_ERR DEV_LABEL | 2596 | printk(KERN_ERR DEV_LABEL |
2597 | ": couldn't register atm device!\n"); | 2597 | ": couldn't register atm device!\n"); |
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index 2f3516b7f118..6b313ee9231b 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c | |||
@@ -771,7 +771,8 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev) | |||
771 | } | 771 | } |
772 | 772 | ||
773 | /* Register device */ | 773 | /* Register device */ |
774 | card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL); | 774 | card->atmdev = atm_dev_register("nicstar", &card->pcidev->dev, &atm_ops, |
775 | -1, NULL); | ||
775 | if (card->atmdev == NULL) { | 776 | if (card->atmdev == NULL) { |
776 | printk("nicstar%d: can't register device.\n", i); | 777 | printk("nicstar%d: can't register device.\n", i); |
777 | error = 17; | 778 | error = 17; |
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 2e08c996fd30..73fb1c4f4cd4 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -166,7 +166,7 @@ static irqreturn_t solos_irq(int irq, void *dev_id); | |||
166 | static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); | 166 | static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); |
167 | static int list_vccs(int vci); | 167 | static int list_vccs(int vci); |
168 | static void release_vccs(struct atm_dev *dev); | 168 | static void release_vccs(struct atm_dev *dev); |
169 | static int atm_init(struct solos_card *); | 169 | static int atm_init(struct solos_card *, struct device *); |
170 | static void atm_remove(struct solos_card *); | 170 | static void atm_remove(struct solos_card *); |
171 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); | 171 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); |
172 | static void solos_bh(unsigned long); | 172 | static void solos_bh(unsigned long); |
@@ -1210,7 +1210,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1210 | if (db_firmware_upgrade) | 1210 | if (db_firmware_upgrade) |
1211 | flash_upgrade(card, 3); | 1211 | flash_upgrade(card, 3); |
1212 | 1212 | ||
1213 | err = atm_init(card); | 1213 | err = atm_init(card, &dev->dev); |
1214 | if (err) | 1214 | if (err) |
1215 | goto out_free_irq; | 1215 | goto out_free_irq; |
1216 | 1216 | ||
@@ -1233,7 +1233,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1233 | return err; | 1233 | return err; |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | static int atm_init(struct solos_card *card) | 1236 | static int atm_init(struct solos_card *card, struct device *parent) |
1237 | { | 1237 | { |
1238 | int i; | 1238 | int i; |
1239 | 1239 | ||
@@ -1244,7 +1244,7 @@ static int atm_init(struct solos_card *card) | |||
1244 | skb_queue_head_init(&card->tx_queue[i]); | 1244 | skb_queue_head_init(&card->tx_queue[i]); |
1245 | skb_queue_head_init(&card->cli_queue[i]); | 1245 | skb_queue_head_init(&card->cli_queue[i]); |
1246 | 1246 | ||
1247 | card->atmdev[i] = atm_dev_register("solos-pci", &fpga_ops, -1, NULL); | 1247 | card->atmdev[i] = atm_dev_register("solos-pci", parent, &fpga_ops, -1, NULL); |
1248 | if (!card->atmdev[i]) { | 1248 | if (!card->atmdev[i]) { |
1249 | dev_err(&card->dev->dev, "Could not register ATM device %d\n", i); | 1249 | dev_err(&card->dev->dev, "Could not register ATM device %d\n", i); |
1250 | atm_remove(card); | 1250 | atm_remove(card); |
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index 4e885d2da49c..624917902b65 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c | |||
@@ -1597,7 +1597,7 @@ static int __devinit zatm_init_one(struct pci_dev *pci_dev, | |||
1597 | goto out; | 1597 | goto out; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | dev = atm_dev_register(DEV_LABEL, &ops, -1, NULL); | 1600 | dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &ops, -1, NULL); |
1601 | if (!dev) | 1601 | if (!dev) |
1602 | goto out_free; | 1602 | goto out_free; |
1603 | 1603 | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index f291587d753e..8e0f9256eb58 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -2834,6 +2834,8 @@ static int cciss_revalidate(struct gendisk *disk) | |||
2834 | InquiryData_struct *inq_buff = NULL; | 2834 | InquiryData_struct *inq_buff = NULL; |
2835 | 2835 | ||
2836 | for (logvol = 0; logvol < CISS_MAX_LUN; logvol++) { | 2836 | for (logvol = 0; logvol < CISS_MAX_LUN; logvol++) { |
2837 | if (!h->drv[logvol]) | ||
2838 | continue; | ||
2837 | if (memcmp(h->drv[logvol]->LunID, drv->LunID, | 2839 | if (memcmp(h->drv[logvol]->LunID, drv->LunID, |
2838 | sizeof(drv->LunID)) == 0) { | 2840 | sizeof(drv->LunID)) == 0) { |
2839 | FOUND = 1; | 2841 | FOUND = 1; |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 89d8a7cc4054..24487d4fb202 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -3627,17 +3627,19 @@ static void drbdd(struct drbd_conf *mdev) | |||
3627 | } | 3627 | } |
3628 | 3628 | ||
3629 | shs = drbd_cmd_handler[cmd].pkt_size - sizeof(union p_header); | 3629 | shs = drbd_cmd_handler[cmd].pkt_size - sizeof(union p_header); |
3630 | rv = drbd_recv(mdev, &header->h80.payload, shs); | ||
3631 | if (unlikely(rv != shs)) { | ||
3632 | dev_err(DEV, "short read while reading sub header: rv=%d\n", rv); | ||
3633 | goto err_out; | ||
3634 | } | ||
3635 | |||
3636 | if (packet_size - shs > 0 && !drbd_cmd_handler[cmd].expect_payload) { | 3630 | if (packet_size - shs > 0 && !drbd_cmd_handler[cmd].expect_payload) { |
3637 | dev_err(DEV, "No payload expected %s l:%d\n", cmdname(cmd), packet_size); | 3631 | dev_err(DEV, "No payload expected %s l:%d\n", cmdname(cmd), packet_size); |
3638 | goto err_out; | 3632 | goto err_out; |
3639 | } | 3633 | } |
3640 | 3634 | ||
3635 | if (shs) { | ||
3636 | rv = drbd_recv(mdev, &header->h80.payload, shs); | ||
3637 | if (unlikely(rv != shs)) { | ||
3638 | dev_err(DEV, "short read while reading sub header: rv=%d\n", rv); | ||
3639 | goto err_out; | ||
3640 | } | ||
3641 | } | ||
3642 | |||
3641 | rv = drbd_cmd_handler[cmd].function(mdev, cmd, packet_size - shs); | 3643 | rv = drbd_cmd_handler[cmd].function(mdev, cmd, packet_size - shs); |
3642 | 3644 | ||
3643 | if (unlikely(!rv)) { | 3645 | if (unlikely(!rv)) { |
diff --git a/drivers/block/drbd/drbd_req.h b/drivers/block/drbd/drbd_req.h index 181ea0364822..ab2bd09d54b4 100644 --- a/drivers/block/drbd/drbd_req.h +++ b/drivers/block/drbd/drbd_req.h | |||
@@ -339,7 +339,8 @@ static inline int _req_mod(struct drbd_request *req, enum drbd_req_event what) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | /* completion of master bio is outside of spinlock. | 341 | /* completion of master bio is outside of spinlock. |
342 | * If you need it irqsave, do it your self! */ | 342 | * If you need it irqsave, do it your self! |
343 | * Which means: don't use from bio endio callback. */ | ||
343 | static inline int req_mod(struct drbd_request *req, | 344 | static inline int req_mod(struct drbd_request *req, |
344 | enum drbd_req_event what) | 345 | enum drbd_req_event what) |
345 | { | 346 | { |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 47d223c2409c..34f224b018b3 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -193,8 +193,10 @@ void drbd_endio_sec(struct bio *bio, int error) | |||
193 | */ | 193 | */ |
194 | void drbd_endio_pri(struct bio *bio, int error) | 194 | void drbd_endio_pri(struct bio *bio, int error) |
195 | { | 195 | { |
196 | unsigned long flags; | ||
196 | struct drbd_request *req = bio->bi_private; | 197 | struct drbd_request *req = bio->bi_private; |
197 | struct drbd_conf *mdev = req->mdev; | 198 | struct drbd_conf *mdev = req->mdev; |
199 | struct bio_and_error m; | ||
198 | enum drbd_req_event what; | 200 | enum drbd_req_event what; |
199 | int uptodate = bio_flagged(bio, BIO_UPTODATE); | 201 | int uptodate = bio_flagged(bio, BIO_UPTODATE); |
200 | 202 | ||
@@ -220,7 +222,13 @@ void drbd_endio_pri(struct bio *bio, int error) | |||
220 | bio_put(req->private_bio); | 222 | bio_put(req->private_bio); |
221 | req->private_bio = ERR_PTR(error); | 223 | req->private_bio = ERR_PTR(error); |
222 | 224 | ||
223 | req_mod(req, what); | 225 | /* not req_mod(), we need irqsave here! */ |
226 | spin_lock_irqsave(&mdev->req_lock, flags); | ||
227 | __req_mod(req, what, &m); | ||
228 | spin_unlock_irqrestore(&mdev->req_lock, flags); | ||
229 | |||
230 | if (m.bio) | ||
231 | complete_master_bio(mdev, &m); | ||
224 | } | 232 | } |
225 | 233 | ||
226 | int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | 234 | int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int cancel) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 6ec9d53806c5..008d4a00b50d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -21,80 +21,9 @@ | |||
21 | 21 | ||
22 | 22 | ||
23 | 23 | ||
24 | Instructions for use | 24 | For usage instructions, please refer to: |
25 | -------------------- | ||
26 | 25 | ||
27 | 1) Map a Linux block device to an existing rbd image. | 26 | Documentation/ABI/testing/sysfs-bus-rbd |
28 | |||
29 | Usage: <mon ip addr> <options> <pool name> <rbd image name> [snap name] | ||
30 | |||
31 | $ echo "192.168.0.1 name=admin rbd foo" > /sys/class/rbd/add | ||
32 | |||
33 | The snapshot name can be "-" or omitted to map the image read/write. | ||
34 | |||
35 | 2) List all active blkdev<->object mappings. | ||
36 | |||
37 | In this example, we have performed step #1 twice, creating two blkdevs, | ||
38 | mapped to two separate rados objects in the rados rbd pool | ||
39 | |||
40 | $ cat /sys/class/rbd/list | ||
41 | #id major client_name pool name snap KB | ||
42 | 0 254 client4143 rbd foo - 1024000 | ||
43 | |||
44 | The columns, in order, are: | ||
45 | - blkdev unique id | ||
46 | - blkdev assigned major | ||
47 | - rados client id | ||
48 | - rados pool name | ||
49 | - rados block device name | ||
50 | - mapped snapshot ("-" if none) | ||
51 | - device size in KB | ||
52 | |||
53 | |||
54 | 3) Create a snapshot. | ||
55 | |||
56 | Usage: <blkdev id> <snapname> | ||
57 | |||
58 | $ echo "0 mysnap" > /sys/class/rbd/snap_create | ||
59 | |||
60 | |||
61 | 4) Listing a snapshot. | ||
62 | |||
63 | $ cat /sys/class/rbd/snaps_list | ||
64 | #id snap KB | ||
65 | 0 - 1024000 (*) | ||
66 | 0 foo 1024000 | ||
67 | |||
68 | The columns, in order, are: | ||
69 | - blkdev unique id | ||
70 | - snapshot name, '-' means none (active read/write version) | ||
71 | - size of device at time of snapshot | ||
72 | - the (*) indicates this is the active version | ||
73 | |||
74 | 5) Rollback to snapshot. | ||
75 | |||
76 | Usage: <blkdev id> <snapname> | ||
77 | |||
78 | $ echo "0 mysnap" > /sys/class/rbd/snap_rollback | ||
79 | |||
80 | |||
81 | 6) Mapping an image using snapshot. | ||
82 | |||
83 | A snapshot mapping is read-only. This is being done by passing | ||
84 | snap=<snapname> to the options when adding a device. | ||
85 | |||
86 | $ echo "192.168.0.1 name=admin,snap=mysnap rbd foo" > /sys/class/rbd/add | ||
87 | |||
88 | |||
89 | 7) Remove an active blkdev<->rbd image mapping. | ||
90 | |||
91 | In this example, we remove the mapping with blkdev unique id 1. | ||
92 | |||
93 | $ echo 1 > /sys/class/rbd/remove | ||
94 | |||
95 | |||
96 | NOTE: The actual creation and deletion of rados objects is outside the scope | ||
97 | of this driver. | ||
98 | 27 | ||
99 | */ | 28 | */ |
100 | 29 | ||
@@ -163,6 +92,14 @@ struct rbd_request { | |||
163 | u64 len; | 92 | u64 len; |
164 | }; | 93 | }; |
165 | 94 | ||
95 | struct rbd_snap { | ||
96 | struct device dev; | ||
97 | const char *name; | ||
98 | size_t size; | ||
99 | struct list_head node; | ||
100 | u64 id; | ||
101 | }; | ||
102 | |||
166 | /* | 103 | /* |
167 | * a single device | 104 | * a single device |
168 | */ | 105 | */ |
@@ -193,21 +130,60 @@ struct rbd_device { | |||
193 | int read_only; | 130 | int read_only; |
194 | 131 | ||
195 | struct list_head node; | 132 | struct list_head node; |
133 | |||
134 | /* list of snapshots */ | ||
135 | struct list_head snaps; | ||
136 | |||
137 | /* sysfs related */ | ||
138 | struct device dev; | ||
139 | }; | ||
140 | |||
141 | static struct bus_type rbd_bus_type = { | ||
142 | .name = "rbd", | ||
196 | }; | 143 | }; |
197 | 144 | ||
198 | static spinlock_t node_lock; /* protects client get/put */ | 145 | static spinlock_t node_lock; /* protects client get/put */ |
199 | 146 | ||
200 | static struct class *class_rbd; /* /sys/class/rbd */ | ||
201 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ | 147 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ |
202 | static LIST_HEAD(rbd_dev_list); /* devices */ | 148 | static LIST_HEAD(rbd_dev_list); /* devices */ |
203 | static LIST_HEAD(rbd_client_list); /* clients */ | 149 | static LIST_HEAD(rbd_client_list); /* clients */ |
204 | 150 | ||
151 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev); | ||
152 | static void rbd_dev_release(struct device *dev); | ||
153 | static ssize_t rbd_snap_rollback(struct device *dev, | ||
154 | struct device_attribute *attr, | ||
155 | const char *buf, | ||
156 | size_t size); | ||
157 | static ssize_t rbd_snap_add(struct device *dev, | ||
158 | struct device_attribute *attr, | ||
159 | const char *buf, | ||
160 | size_t count); | ||
161 | static void __rbd_remove_snap_dev(struct rbd_device *rbd_dev, | ||
162 | struct rbd_snap *snap);; | ||
163 | |||
164 | |||
165 | static struct rbd_device *dev_to_rbd(struct device *dev) | ||
166 | { | ||
167 | return container_of(dev, struct rbd_device, dev); | ||
168 | } | ||
169 | |||
170 | static struct device *rbd_get_dev(struct rbd_device *rbd_dev) | ||
171 | { | ||
172 | return get_device(&rbd_dev->dev); | ||
173 | } | ||
174 | |||
175 | static void rbd_put_dev(struct rbd_device *rbd_dev) | ||
176 | { | ||
177 | put_device(&rbd_dev->dev); | ||
178 | } | ||
205 | 179 | ||
206 | static int rbd_open(struct block_device *bdev, fmode_t mode) | 180 | static int rbd_open(struct block_device *bdev, fmode_t mode) |
207 | { | 181 | { |
208 | struct gendisk *disk = bdev->bd_disk; | 182 | struct gendisk *disk = bdev->bd_disk; |
209 | struct rbd_device *rbd_dev = disk->private_data; | 183 | struct rbd_device *rbd_dev = disk->private_data; |
210 | 184 | ||
185 | rbd_get_dev(rbd_dev); | ||
186 | |||
211 | set_device_ro(bdev, rbd_dev->read_only); | 187 | set_device_ro(bdev, rbd_dev->read_only); |
212 | 188 | ||
213 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) | 189 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) |
@@ -216,9 +192,19 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) | |||
216 | return 0; | 192 | return 0; |
217 | } | 193 | } |
218 | 194 | ||
195 | static int rbd_release(struct gendisk *disk, fmode_t mode) | ||
196 | { | ||
197 | struct rbd_device *rbd_dev = disk->private_data; | ||
198 | |||
199 | rbd_put_dev(rbd_dev); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
219 | static const struct block_device_operations rbd_bd_ops = { | 204 | static const struct block_device_operations rbd_bd_ops = { |
220 | .owner = THIS_MODULE, | 205 | .owner = THIS_MODULE, |
221 | .open = rbd_open, | 206 | .open = rbd_open, |
207 | .release = rbd_release, | ||
222 | }; | 208 | }; |
223 | 209 | ||
224 | /* | 210 | /* |
@@ -361,7 +347,6 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
361 | int ret = -ENOMEM; | 347 | int ret = -ENOMEM; |
362 | 348 | ||
363 | init_rwsem(&header->snap_rwsem); | 349 | init_rwsem(&header->snap_rwsem); |
364 | |||
365 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); | 350 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); |
366 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + | 351 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + |
367 | snap_count * | 352 | snap_count * |
@@ -1256,10 +1241,20 @@ bad: | |||
1256 | return -ERANGE; | 1241 | return -ERANGE; |
1257 | } | 1242 | } |
1258 | 1243 | ||
1244 | static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev) | ||
1245 | { | ||
1246 | struct rbd_snap *snap; | ||
1247 | |||
1248 | while (!list_empty(&rbd_dev->snaps)) { | ||
1249 | snap = list_first_entry(&rbd_dev->snaps, struct rbd_snap, node); | ||
1250 | __rbd_remove_snap_dev(rbd_dev, snap); | ||
1251 | } | ||
1252 | } | ||
1253 | |||
1259 | /* | 1254 | /* |
1260 | * only read the first part of the ondisk header, without the snaps info | 1255 | * only read the first part of the ondisk header, without the snaps info |
1261 | */ | 1256 | */ |
1262 | static int rbd_update_snaps(struct rbd_device *rbd_dev) | 1257 | static int __rbd_update_snaps(struct rbd_device *rbd_dev) |
1263 | { | 1258 | { |
1264 | int ret; | 1259 | int ret; |
1265 | struct rbd_image_header h; | 1260 | struct rbd_image_header h; |
@@ -1280,12 +1275,15 @@ static int rbd_update_snaps(struct rbd_device *rbd_dev) | |||
1280 | rbd_dev->header.total_snaps = h.total_snaps; | 1275 | rbd_dev->header.total_snaps = h.total_snaps; |
1281 | rbd_dev->header.snapc = h.snapc; | 1276 | rbd_dev->header.snapc = h.snapc; |
1282 | rbd_dev->header.snap_names = h.snap_names; | 1277 | rbd_dev->header.snap_names = h.snap_names; |
1278 | rbd_dev->header.snap_names_len = h.snap_names_len; | ||
1283 | rbd_dev->header.snap_sizes = h.snap_sizes; | 1279 | rbd_dev->header.snap_sizes = h.snap_sizes; |
1284 | rbd_dev->header.snapc->seq = snap_seq; | 1280 | rbd_dev->header.snapc->seq = snap_seq; |
1285 | 1281 | ||
1282 | ret = __rbd_init_snaps_header(rbd_dev); | ||
1283 | |||
1286 | up_write(&rbd_dev->header.snap_rwsem); | 1284 | up_write(&rbd_dev->header.snap_rwsem); |
1287 | 1285 | ||
1288 | return 0; | 1286 | return ret; |
1289 | } | 1287 | } |
1290 | 1288 | ||
1291 | static int rbd_init_disk(struct rbd_device *rbd_dev) | 1289 | static int rbd_init_disk(struct rbd_device *rbd_dev) |
@@ -1300,6 +1298,11 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) | |||
1300 | if (rc) | 1298 | if (rc) |
1301 | return rc; | 1299 | return rc; |
1302 | 1300 | ||
1301 | /* no need to lock here, as rbd_dev is not registered yet */ | ||
1302 | rc = __rbd_init_snaps_header(rbd_dev); | ||
1303 | if (rc) | ||
1304 | return rc; | ||
1305 | |||
1303 | rc = rbd_header_set_snap(rbd_dev, rbd_dev->snap_name, &total_size); | 1306 | rc = rbd_header_set_snap(rbd_dev, rbd_dev->snap_name, &total_size); |
1304 | if (rc) | 1307 | if (rc) |
1305 | return rc; | 1308 | return rc; |
@@ -1343,54 +1346,360 @@ out: | |||
1343 | return rc; | 1346 | return rc; |
1344 | } | 1347 | } |
1345 | 1348 | ||
1346 | /******************************************************************** | 1349 | /* |
1347 | * /sys/class/rbd/ | 1350 | sysfs |
1348 | * add map rados objects to blkdev | 1351 | */ |
1349 | * remove unmap rados objects | 1352 | |
1350 | * list show mappings | 1353 | static ssize_t rbd_size_show(struct device *dev, |
1351 | *******************************************************************/ | 1354 | struct device_attribute *attr, char *buf) |
1355 | { | ||
1356 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
1357 | |||
1358 | return sprintf(buf, "%llu\n", (unsigned long long)rbd_dev->header.image_size); | ||
1359 | } | ||
1360 | |||
1361 | static ssize_t rbd_major_show(struct device *dev, | ||
1362 | struct device_attribute *attr, char *buf) | ||
1363 | { | ||
1364 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
1352 | 1365 | ||
1353 | static void class_rbd_release(struct class *cls) | 1366 | return sprintf(buf, "%d\n", rbd_dev->major); |
1367 | } | ||
1368 | |||
1369 | static ssize_t rbd_client_id_show(struct device *dev, | ||
1370 | struct device_attribute *attr, char *buf) | ||
1354 | { | 1371 | { |
1355 | kfree(cls); | 1372 | struct rbd_device *rbd_dev = dev_to_rbd(dev); |
1373 | |||
1374 | return sprintf(buf, "client%lld\n", ceph_client_id(rbd_dev->client)); | ||
1356 | } | 1375 | } |
1357 | 1376 | ||
1358 | static ssize_t class_rbd_list(struct class *c, | 1377 | static ssize_t rbd_pool_show(struct device *dev, |
1359 | struct class_attribute *attr, | 1378 | struct device_attribute *attr, char *buf) |
1360 | char *data) | ||
1361 | { | 1379 | { |
1362 | int n = 0; | 1380 | struct rbd_device *rbd_dev = dev_to_rbd(dev); |
1363 | struct list_head *tmp; | 1381 | |
1364 | int max = PAGE_SIZE; | 1382 | return sprintf(buf, "%s\n", rbd_dev->pool_name); |
1383 | } | ||
1384 | |||
1385 | static ssize_t rbd_name_show(struct device *dev, | ||
1386 | struct device_attribute *attr, char *buf) | ||
1387 | { | ||
1388 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
1389 | |||
1390 | return sprintf(buf, "%s\n", rbd_dev->obj); | ||
1391 | } | ||
1392 | |||
1393 | static ssize_t rbd_snap_show(struct device *dev, | ||
1394 | struct device_attribute *attr, | ||
1395 | char *buf) | ||
1396 | { | ||
1397 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
1398 | |||
1399 | return sprintf(buf, "%s\n", rbd_dev->snap_name); | ||
1400 | } | ||
1401 | |||
1402 | static ssize_t rbd_image_refresh(struct device *dev, | ||
1403 | struct device_attribute *attr, | ||
1404 | const char *buf, | ||
1405 | size_t size) | ||
1406 | { | ||
1407 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
1408 | int rc; | ||
1409 | int ret = size; | ||
1365 | 1410 | ||
1366 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1411 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
1367 | 1412 | ||
1368 | n += snprintf(data, max, | 1413 | rc = __rbd_update_snaps(rbd_dev); |
1369 | "#id\tmajor\tclient_name\tpool\tname\tsnap\tKB\n"); | 1414 | if (rc < 0) |
1415 | ret = rc; | ||
1370 | 1416 | ||
1371 | list_for_each(tmp, &rbd_dev_list) { | 1417 | mutex_unlock(&ctl_mutex); |
1372 | struct rbd_device *rbd_dev; | 1418 | return ret; |
1419 | } | ||
1373 | 1420 | ||
1374 | rbd_dev = list_entry(tmp, struct rbd_device, node); | 1421 | static DEVICE_ATTR(size, S_IRUGO, rbd_size_show, NULL); |
1375 | n += snprintf(data+n, max-n, | 1422 | static DEVICE_ATTR(major, S_IRUGO, rbd_major_show, NULL); |
1376 | "%d\t%d\tclient%lld\t%s\t%s\t%s\t%lld\n", | 1423 | static DEVICE_ATTR(client_id, S_IRUGO, rbd_client_id_show, NULL); |
1377 | rbd_dev->id, | 1424 | static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL); |
1378 | rbd_dev->major, | 1425 | static DEVICE_ATTR(name, S_IRUGO, rbd_name_show, NULL); |
1379 | ceph_client_id(rbd_dev->client), | 1426 | static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); |
1380 | rbd_dev->pool_name, | 1427 | static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); |
1381 | rbd_dev->obj, rbd_dev->snap_name, | 1428 | static DEVICE_ATTR(create_snap, S_IWUSR, NULL, rbd_snap_add); |
1382 | rbd_dev->header.image_size >> 10); | 1429 | static DEVICE_ATTR(rollback_snap, S_IWUSR, NULL, rbd_snap_rollback); |
1383 | if (n == max) | 1430 | |
1431 | static struct attribute *rbd_attrs[] = { | ||
1432 | &dev_attr_size.attr, | ||
1433 | &dev_attr_major.attr, | ||
1434 | &dev_attr_client_id.attr, | ||
1435 | &dev_attr_pool.attr, | ||
1436 | &dev_attr_name.attr, | ||
1437 | &dev_attr_current_snap.attr, | ||
1438 | &dev_attr_refresh.attr, | ||
1439 | &dev_attr_create_snap.attr, | ||
1440 | &dev_attr_rollback_snap.attr, | ||
1441 | NULL | ||
1442 | }; | ||
1443 | |||
1444 | static struct attribute_group rbd_attr_group = { | ||
1445 | .attrs = rbd_attrs, | ||
1446 | }; | ||
1447 | |||
1448 | static const struct attribute_group *rbd_attr_groups[] = { | ||
1449 | &rbd_attr_group, | ||
1450 | NULL | ||
1451 | }; | ||
1452 | |||
1453 | static void rbd_sysfs_dev_release(struct device *dev) | ||
1454 | { | ||
1455 | } | ||
1456 | |||
1457 | static struct device_type rbd_device_type = { | ||
1458 | .name = "rbd", | ||
1459 | .groups = rbd_attr_groups, | ||
1460 | .release = rbd_sysfs_dev_release, | ||
1461 | }; | ||
1462 | |||
1463 | |||
1464 | /* | ||
1465 | sysfs - snapshots | ||
1466 | */ | ||
1467 | |||
1468 | static ssize_t rbd_snap_size_show(struct device *dev, | ||
1469 | struct device_attribute *attr, | ||
1470 | char *buf) | ||
1471 | { | ||
1472 | struct rbd_snap *snap = container_of(dev, struct rbd_snap, dev); | ||
1473 | |||
1474 | return sprintf(buf, "%lld\n", (long long)snap->size); | ||
1475 | } | ||
1476 | |||
1477 | static ssize_t rbd_snap_id_show(struct device *dev, | ||
1478 | struct device_attribute *attr, | ||
1479 | char *buf) | ||
1480 | { | ||
1481 | struct rbd_snap *snap = container_of(dev, struct rbd_snap, dev); | ||
1482 | |||
1483 | return sprintf(buf, "%lld\n", (long long)snap->id); | ||
1484 | } | ||
1485 | |||
1486 | static DEVICE_ATTR(snap_size, S_IRUGO, rbd_snap_size_show, NULL); | ||
1487 | static DEVICE_ATTR(snap_id, S_IRUGO, rbd_snap_id_show, NULL); | ||
1488 | |||
1489 | static struct attribute *rbd_snap_attrs[] = { | ||
1490 | &dev_attr_snap_size.attr, | ||
1491 | &dev_attr_snap_id.attr, | ||
1492 | NULL, | ||
1493 | }; | ||
1494 | |||
1495 | static struct attribute_group rbd_snap_attr_group = { | ||
1496 | .attrs = rbd_snap_attrs, | ||
1497 | }; | ||
1498 | |||
1499 | static void rbd_snap_dev_release(struct device *dev) | ||
1500 | { | ||
1501 | struct rbd_snap *snap = container_of(dev, struct rbd_snap, dev); | ||
1502 | kfree(snap->name); | ||
1503 | kfree(snap); | ||
1504 | } | ||
1505 | |||
1506 | static const struct attribute_group *rbd_snap_attr_groups[] = { | ||
1507 | &rbd_snap_attr_group, | ||
1508 | NULL | ||
1509 | }; | ||
1510 | |||
1511 | static struct device_type rbd_snap_device_type = { | ||
1512 | .groups = rbd_snap_attr_groups, | ||
1513 | .release = rbd_snap_dev_release, | ||
1514 | }; | ||
1515 | |||
1516 | static void __rbd_remove_snap_dev(struct rbd_device *rbd_dev, | ||
1517 | struct rbd_snap *snap) | ||
1518 | { | ||
1519 | list_del(&snap->node); | ||
1520 | device_unregister(&snap->dev); | ||
1521 | } | ||
1522 | |||
1523 | static int rbd_register_snap_dev(struct rbd_device *rbd_dev, | ||
1524 | struct rbd_snap *snap, | ||
1525 | struct device *parent) | ||
1526 | { | ||
1527 | struct device *dev = &snap->dev; | ||
1528 | int ret; | ||
1529 | |||
1530 | dev->type = &rbd_snap_device_type; | ||
1531 | dev->parent = parent; | ||
1532 | dev->release = rbd_snap_dev_release; | ||
1533 | dev_set_name(dev, "snap_%s", snap->name); | ||
1534 | ret = device_register(dev); | ||
1535 | |||
1536 | return ret; | ||
1537 | } | ||
1538 | |||
1539 | static int __rbd_add_snap_dev(struct rbd_device *rbd_dev, | ||
1540 | int i, const char *name, | ||
1541 | struct rbd_snap **snapp) | ||
1542 | { | ||
1543 | int ret; | ||
1544 | struct rbd_snap *snap = kzalloc(sizeof(*snap), GFP_KERNEL); | ||
1545 | if (!snap) | ||
1546 | return -ENOMEM; | ||
1547 | snap->name = kstrdup(name, GFP_KERNEL); | ||
1548 | snap->size = rbd_dev->header.snap_sizes[i]; | ||
1549 | snap->id = rbd_dev->header.snapc->snaps[i]; | ||
1550 | if (device_is_registered(&rbd_dev->dev)) { | ||
1551 | ret = rbd_register_snap_dev(rbd_dev, snap, | ||
1552 | &rbd_dev->dev); | ||
1553 | if (ret < 0) | ||
1554 | goto err; | ||
1555 | } | ||
1556 | *snapp = snap; | ||
1557 | return 0; | ||
1558 | err: | ||
1559 | kfree(snap->name); | ||
1560 | kfree(snap); | ||
1561 | return ret; | ||
1562 | } | ||
1563 | |||
1564 | /* | ||
1565 | * search for the previous snap in a null delimited string list | ||
1566 | */ | ||
1567 | const char *rbd_prev_snap_name(const char *name, const char *start) | ||
1568 | { | ||
1569 | if (name < start + 2) | ||
1570 | return NULL; | ||
1571 | |||
1572 | name -= 2; | ||
1573 | while (*name) { | ||
1574 | if (name == start) | ||
1575 | return start; | ||
1576 | name--; | ||
1577 | } | ||
1578 | return name + 1; | ||
1579 | } | ||
1580 | |||
1581 | /* | ||
1582 | * compare the old list of snapshots that we have to what's in the header | ||
1583 | * and update it accordingly. Note that the header holds the snapshots | ||
1584 | * in a reverse order (from newest to oldest) and we need to go from | ||
1585 | * older to new so that we don't get a duplicate snap name when | ||
1586 | * doing the process (e.g., removed snapshot and recreated a new | ||
1587 | * one with the same name. | ||
1588 | */ | ||
1589 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev) | ||
1590 | { | ||
1591 | const char *name, *first_name; | ||
1592 | int i = rbd_dev->header.total_snaps; | ||
1593 | struct rbd_snap *snap, *old_snap = NULL; | ||
1594 | int ret; | ||
1595 | struct list_head *p, *n; | ||
1596 | |||
1597 | first_name = rbd_dev->header.snap_names; | ||
1598 | name = first_name + rbd_dev->header.snap_names_len; | ||
1599 | |||
1600 | list_for_each_prev_safe(p, n, &rbd_dev->snaps) { | ||
1601 | u64 cur_id; | ||
1602 | |||
1603 | old_snap = list_entry(p, struct rbd_snap, node); | ||
1604 | |||
1605 | if (i) | ||
1606 | cur_id = rbd_dev->header.snapc->snaps[i - 1]; | ||
1607 | |||
1608 | if (!i || old_snap->id < cur_id) { | ||
1609 | /* old_snap->id was skipped, thus was removed */ | ||
1610 | __rbd_remove_snap_dev(rbd_dev, old_snap); | ||
1611 | continue; | ||
1612 | } | ||
1613 | if (old_snap->id == cur_id) { | ||
1614 | /* we have this snapshot already */ | ||
1615 | i--; | ||
1616 | name = rbd_prev_snap_name(name, first_name); | ||
1617 | continue; | ||
1618 | } | ||
1619 | for (; i > 0; | ||
1620 | i--, name = rbd_prev_snap_name(name, first_name)) { | ||
1621 | if (!name) { | ||
1622 | WARN_ON(1); | ||
1623 | return -EINVAL; | ||
1624 | } | ||
1625 | cur_id = rbd_dev->header.snapc->snaps[i]; | ||
1626 | /* snapshot removal? handle it above */ | ||
1627 | if (cur_id >= old_snap->id) | ||
1628 | break; | ||
1629 | /* a new snapshot */ | ||
1630 | ret = __rbd_add_snap_dev(rbd_dev, i - 1, name, &snap); | ||
1631 | if (ret < 0) | ||
1632 | return ret; | ||
1633 | |||
1634 | /* note that we add it backward so using n and not p */ | ||
1635 | list_add(&snap->node, n); | ||
1636 | p = &snap->node; | ||
1637 | } | ||
1638 | } | ||
1639 | /* we're done going over the old snap list, just add what's left */ | ||
1640 | for (; i > 0; i--) { | ||
1641 | name = rbd_prev_snap_name(name, first_name); | ||
1642 | if (!name) { | ||
1643 | WARN_ON(1); | ||
1644 | return -EINVAL; | ||
1645 | } | ||
1646 | ret = __rbd_add_snap_dev(rbd_dev, i - 1, name, &snap); | ||
1647 | if (ret < 0) | ||
1648 | return ret; | ||
1649 | list_add(&snap->node, &rbd_dev->snaps); | ||
1650 | } | ||
1651 | |||
1652 | return 0; | ||
1653 | } | ||
1654 | |||
1655 | |||
1656 | static void rbd_root_dev_release(struct device *dev) | ||
1657 | { | ||
1658 | } | ||
1659 | |||
1660 | static struct device rbd_root_dev = { | ||
1661 | .init_name = "rbd", | ||
1662 | .release = rbd_root_dev_release, | ||
1663 | }; | ||
1664 | |||
1665 | static int rbd_bus_add_dev(struct rbd_device *rbd_dev) | ||
1666 | { | ||
1667 | int ret = -ENOMEM; | ||
1668 | struct device *dev; | ||
1669 | struct rbd_snap *snap; | ||
1670 | |||
1671 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
1672 | dev = &rbd_dev->dev; | ||
1673 | |||
1674 | dev->bus = &rbd_bus_type; | ||
1675 | dev->type = &rbd_device_type; | ||
1676 | dev->parent = &rbd_root_dev; | ||
1677 | dev->release = rbd_dev_release; | ||
1678 | dev_set_name(dev, "%d", rbd_dev->id); | ||
1679 | ret = device_register(dev); | ||
1680 | if (ret < 0) | ||
1681 | goto done_free; | ||
1682 | |||
1683 | list_for_each_entry(snap, &rbd_dev->snaps, node) { | ||
1684 | ret = rbd_register_snap_dev(rbd_dev, snap, | ||
1685 | &rbd_dev->dev); | ||
1686 | if (ret < 0) | ||
1384 | break; | 1687 | break; |
1385 | } | 1688 | } |
1386 | 1689 | ||
1387 | mutex_unlock(&ctl_mutex); | 1690 | mutex_unlock(&ctl_mutex); |
1388 | return n; | 1691 | return 0; |
1692 | done_free: | ||
1693 | mutex_unlock(&ctl_mutex); | ||
1694 | return ret; | ||
1389 | } | 1695 | } |
1390 | 1696 | ||
1391 | static ssize_t class_rbd_add(struct class *c, | 1697 | static void rbd_bus_del_dev(struct rbd_device *rbd_dev) |
1392 | struct class_attribute *attr, | 1698 | { |
1393 | const char *buf, size_t count) | 1699 | device_unregister(&rbd_dev->dev); |
1700 | } | ||
1701 | |||
1702 | static ssize_t rbd_add(struct bus_type *bus, const char *buf, size_t count) | ||
1394 | { | 1703 | { |
1395 | struct ceph_osd_client *osdc; | 1704 | struct ceph_osd_client *osdc; |
1396 | struct rbd_device *rbd_dev; | 1705 | struct rbd_device *rbd_dev; |
@@ -1419,6 +1728,7 @@ static ssize_t class_rbd_add(struct class *c, | |||
1419 | /* static rbd_device initialization */ | 1728 | /* static rbd_device initialization */ |
1420 | spin_lock_init(&rbd_dev->lock); | 1729 | spin_lock_init(&rbd_dev->lock); |
1421 | INIT_LIST_HEAD(&rbd_dev->node); | 1730 | INIT_LIST_HEAD(&rbd_dev->node); |
1731 | INIT_LIST_HEAD(&rbd_dev->snaps); | ||
1422 | 1732 | ||
1423 | /* generate unique id: find highest unique id, add one */ | 1733 | /* generate unique id: find highest unique id, add one */ |
1424 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1734 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
@@ -1478,6 +1788,9 @@ static ssize_t class_rbd_add(struct class *c, | |||
1478 | } | 1788 | } |
1479 | rbd_dev->major = irc; | 1789 | rbd_dev->major = irc; |
1480 | 1790 | ||
1791 | rc = rbd_bus_add_dev(rbd_dev); | ||
1792 | if (rc) | ||
1793 | goto err_out_disk; | ||
1481 | /* set up and announce blkdev mapping */ | 1794 | /* set up and announce blkdev mapping */ |
1482 | rc = rbd_init_disk(rbd_dev); | 1795 | rc = rbd_init_disk(rbd_dev); |
1483 | if (rc) | 1796 | if (rc) |
@@ -1487,6 +1800,8 @@ static ssize_t class_rbd_add(struct class *c, | |||
1487 | 1800 | ||
1488 | err_out_blkdev: | 1801 | err_out_blkdev: |
1489 | unregister_blkdev(rbd_dev->major, rbd_dev->name); | 1802 | unregister_blkdev(rbd_dev->major, rbd_dev->name); |
1803 | err_out_disk: | ||
1804 | rbd_free_disk(rbd_dev); | ||
1490 | err_out_client: | 1805 | err_out_client: |
1491 | rbd_put_client(rbd_dev); | 1806 | rbd_put_client(rbd_dev); |
1492 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1807 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
@@ -1518,35 +1833,10 @@ static struct rbd_device *__rbd_get_dev(unsigned long id) | |||
1518 | return NULL; | 1833 | return NULL; |
1519 | } | 1834 | } |
1520 | 1835 | ||
1521 | static ssize_t class_rbd_remove(struct class *c, | 1836 | static void rbd_dev_release(struct device *dev) |
1522 | struct class_attribute *attr, | ||
1523 | const char *buf, | ||
1524 | size_t count) | ||
1525 | { | 1837 | { |
1526 | struct rbd_device *rbd_dev = NULL; | 1838 | struct rbd_device *rbd_dev = |
1527 | int target_id, rc; | 1839 | container_of(dev, struct rbd_device, dev); |
1528 | unsigned long ul; | ||
1529 | |||
1530 | rc = strict_strtoul(buf, 10, &ul); | ||
1531 | if (rc) | ||
1532 | return rc; | ||
1533 | |||
1534 | /* convert to int; abort if we lost anything in the conversion */ | ||
1535 | target_id = (int) ul; | ||
1536 | if (target_id != ul) | ||
1537 | return -EINVAL; | ||
1538 | |||
1539 | /* remove object from list immediately */ | ||
1540 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
1541 | |||
1542 | rbd_dev = __rbd_get_dev(target_id); | ||
1543 | if (rbd_dev) | ||
1544 | list_del_init(&rbd_dev->node); | ||
1545 | |||
1546 | mutex_unlock(&ctl_mutex); | ||
1547 | |||
1548 | if (!rbd_dev) | ||
1549 | return -ENOENT; | ||
1550 | 1840 | ||
1551 | rbd_put_client(rbd_dev); | 1841 | rbd_put_client(rbd_dev); |
1552 | 1842 | ||
@@ -1557,67 +1847,11 @@ static ssize_t class_rbd_remove(struct class *c, | |||
1557 | 1847 | ||
1558 | /* release module ref */ | 1848 | /* release module ref */ |
1559 | module_put(THIS_MODULE); | 1849 | module_put(THIS_MODULE); |
1560 | |||
1561 | return count; | ||
1562 | } | 1850 | } |
1563 | 1851 | ||
1564 | static ssize_t class_rbd_snaps_list(struct class *c, | 1852 | static ssize_t rbd_remove(struct bus_type *bus, |
1565 | struct class_attribute *attr, | 1853 | const char *buf, |
1566 | char *data) | 1854 | size_t count) |
1567 | { | ||
1568 | struct rbd_device *rbd_dev = NULL; | ||
1569 | struct list_head *tmp; | ||
1570 | struct rbd_image_header *header; | ||
1571 | int i, n = 0, max = PAGE_SIZE; | ||
1572 | int ret; | ||
1573 | |||
1574 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
1575 | |||
1576 | n += snprintf(data, max, "#id\tsnap\tKB\n"); | ||
1577 | |||
1578 | list_for_each(tmp, &rbd_dev_list) { | ||
1579 | char *names, *p; | ||
1580 | struct ceph_snap_context *snapc; | ||
1581 | |||
1582 | rbd_dev = list_entry(tmp, struct rbd_device, node); | ||
1583 | header = &rbd_dev->header; | ||
1584 | |||
1585 | down_read(&header->snap_rwsem); | ||
1586 | |||
1587 | names = header->snap_names; | ||
1588 | snapc = header->snapc; | ||
1589 | |||
1590 | n += snprintf(data + n, max - n, "%d\t%s\t%lld%s\n", | ||
1591 | rbd_dev->id, RBD_SNAP_HEAD_NAME, | ||
1592 | header->image_size >> 10, | ||
1593 | (!rbd_dev->cur_snap ? " (*)" : "")); | ||
1594 | if (n == max) | ||
1595 | break; | ||
1596 | |||
1597 | p = names; | ||
1598 | for (i = 0; i < header->total_snaps; i++, p += strlen(p) + 1) { | ||
1599 | n += snprintf(data + n, max - n, "%d\t%s\t%lld%s\n", | ||
1600 | rbd_dev->id, p, header->snap_sizes[i] >> 10, | ||
1601 | (rbd_dev->cur_snap && | ||
1602 | (snap_index(header, i) == rbd_dev->cur_snap) ? | ||
1603 | " (*)" : "")); | ||
1604 | if (n == max) | ||
1605 | break; | ||
1606 | } | ||
1607 | |||
1608 | up_read(&header->snap_rwsem); | ||
1609 | } | ||
1610 | |||
1611 | |||
1612 | ret = n; | ||
1613 | mutex_unlock(&ctl_mutex); | ||
1614 | return ret; | ||
1615 | } | ||
1616 | |||
1617 | static ssize_t class_rbd_snaps_refresh(struct class *c, | ||
1618 | struct class_attribute *attr, | ||
1619 | const char *buf, | ||
1620 | size_t count) | ||
1621 | { | 1855 | { |
1622 | struct rbd_device *rbd_dev = NULL; | 1856 | struct rbd_device *rbd_dev = NULL; |
1623 | int target_id, rc; | 1857 | int target_id, rc; |
@@ -1641,95 +1875,70 @@ static ssize_t class_rbd_snaps_refresh(struct class *c, | |||
1641 | goto done; | 1875 | goto done; |
1642 | } | 1876 | } |
1643 | 1877 | ||
1644 | rc = rbd_update_snaps(rbd_dev); | 1878 | list_del_init(&rbd_dev->node); |
1645 | if (rc < 0) | 1879 | |
1646 | ret = rc; | 1880 | __rbd_remove_all_snaps(rbd_dev); |
1881 | rbd_bus_del_dev(rbd_dev); | ||
1647 | 1882 | ||
1648 | done: | 1883 | done: |
1649 | mutex_unlock(&ctl_mutex); | 1884 | mutex_unlock(&ctl_mutex); |
1650 | return ret; | 1885 | return ret; |
1651 | } | 1886 | } |
1652 | 1887 | ||
1653 | static ssize_t class_rbd_snap_create(struct class *c, | 1888 | static ssize_t rbd_snap_add(struct device *dev, |
1654 | struct class_attribute *attr, | 1889 | struct device_attribute *attr, |
1655 | const char *buf, | 1890 | const char *buf, |
1656 | size_t count) | 1891 | size_t count) |
1657 | { | 1892 | { |
1658 | struct rbd_device *rbd_dev = NULL; | 1893 | struct rbd_device *rbd_dev = dev_to_rbd(dev); |
1659 | int target_id, ret; | 1894 | int ret; |
1660 | char *name; | 1895 | char *name = kmalloc(count + 1, GFP_KERNEL); |
1661 | |||
1662 | name = kmalloc(RBD_MAX_SNAP_NAME_LEN + 1, GFP_KERNEL); | ||
1663 | if (!name) | 1896 | if (!name) |
1664 | return -ENOMEM; | 1897 | return -ENOMEM; |
1665 | 1898 | ||
1666 | /* parse snaps add command */ | 1899 | snprintf(name, count, "%s", buf); |
1667 | if (sscanf(buf, "%d " | ||
1668 | "%" __stringify(RBD_MAX_SNAP_NAME_LEN) "s", | ||
1669 | &target_id, | ||
1670 | name) != 2) { | ||
1671 | ret = -EINVAL; | ||
1672 | goto done; | ||
1673 | } | ||
1674 | 1900 | ||
1675 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1901 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
1676 | 1902 | ||
1677 | rbd_dev = __rbd_get_dev(target_id); | ||
1678 | if (!rbd_dev) { | ||
1679 | ret = -ENOENT; | ||
1680 | goto done_unlock; | ||
1681 | } | ||
1682 | |||
1683 | ret = rbd_header_add_snap(rbd_dev, | 1903 | ret = rbd_header_add_snap(rbd_dev, |
1684 | name, GFP_KERNEL); | 1904 | name, GFP_KERNEL); |
1685 | if (ret < 0) | 1905 | if (ret < 0) |
1686 | goto done_unlock; | 1906 | goto done_unlock; |
1687 | 1907 | ||
1688 | ret = rbd_update_snaps(rbd_dev); | 1908 | ret = __rbd_update_snaps(rbd_dev); |
1689 | if (ret < 0) | 1909 | if (ret < 0) |
1690 | goto done_unlock; | 1910 | goto done_unlock; |
1691 | 1911 | ||
1692 | ret = count; | 1912 | ret = count; |
1693 | done_unlock: | 1913 | done_unlock: |
1694 | mutex_unlock(&ctl_mutex); | 1914 | mutex_unlock(&ctl_mutex); |
1695 | done: | ||
1696 | kfree(name); | 1915 | kfree(name); |
1697 | return ret; | 1916 | return ret; |
1698 | } | 1917 | } |
1699 | 1918 | ||
1700 | static ssize_t class_rbd_rollback(struct class *c, | 1919 | static ssize_t rbd_snap_rollback(struct device *dev, |
1701 | struct class_attribute *attr, | 1920 | struct device_attribute *attr, |
1702 | const char *buf, | 1921 | const char *buf, |
1703 | size_t count) | 1922 | size_t count) |
1704 | { | 1923 | { |
1705 | struct rbd_device *rbd_dev = NULL; | 1924 | struct rbd_device *rbd_dev = dev_to_rbd(dev); |
1706 | int target_id, ret; | 1925 | int ret; |
1707 | u64 snapid; | 1926 | u64 snapid; |
1708 | char snap_name[RBD_MAX_SNAP_NAME_LEN]; | ||
1709 | u64 cur_ofs; | 1927 | u64 cur_ofs; |
1710 | char *seg_name; | 1928 | char *seg_name = NULL; |
1929 | char *snap_name = kmalloc(count + 1, GFP_KERNEL); | ||
1930 | ret = -ENOMEM; | ||
1931 | if (!snap_name) | ||
1932 | return ret; | ||
1711 | 1933 | ||
1712 | /* parse snaps add command */ | 1934 | /* parse snaps add command */ |
1713 | if (sscanf(buf, "%d " | 1935 | snprintf(snap_name, count, "%s", buf); |
1714 | "%" __stringify(RBD_MAX_SNAP_NAME_LEN) "s", | ||
1715 | &target_id, | ||
1716 | snap_name) != 2) { | ||
1717 | return -EINVAL; | ||
1718 | } | ||
1719 | |||
1720 | ret = -ENOMEM; | ||
1721 | seg_name = kmalloc(RBD_MAX_SEG_NAME_LEN + 1, GFP_NOIO); | 1936 | seg_name = kmalloc(RBD_MAX_SEG_NAME_LEN + 1, GFP_NOIO); |
1722 | if (!seg_name) | 1937 | if (!seg_name) |
1723 | return ret; | 1938 | goto done; |
1724 | 1939 | ||
1725 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | 1940 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
1726 | 1941 | ||
1727 | rbd_dev = __rbd_get_dev(target_id); | ||
1728 | if (!rbd_dev) { | ||
1729 | ret = -ENOENT; | ||
1730 | goto done_unlock; | ||
1731 | } | ||
1732 | |||
1733 | ret = snap_by_name(&rbd_dev->header, snap_name, &snapid, NULL); | 1942 | ret = snap_by_name(&rbd_dev->header, snap_name, &snapid, NULL); |
1734 | if (ret < 0) | 1943 | if (ret < 0) |
1735 | goto done_unlock; | 1944 | goto done_unlock; |
@@ -1750,7 +1959,7 @@ static ssize_t class_rbd_rollback(struct class *c, | |||
1750 | seg_name, ret); | 1959 | seg_name, ret); |
1751 | } | 1960 | } |
1752 | 1961 | ||
1753 | ret = rbd_update_snaps(rbd_dev); | 1962 | ret = __rbd_update_snaps(rbd_dev); |
1754 | if (ret < 0) | 1963 | if (ret < 0) |
1755 | goto done_unlock; | 1964 | goto done_unlock; |
1756 | 1965 | ||
@@ -1758,57 +1967,42 @@ static ssize_t class_rbd_rollback(struct class *c, | |||
1758 | 1967 | ||
1759 | done_unlock: | 1968 | done_unlock: |
1760 | mutex_unlock(&ctl_mutex); | 1969 | mutex_unlock(&ctl_mutex); |
1970 | done: | ||
1761 | kfree(seg_name); | 1971 | kfree(seg_name); |
1972 | kfree(snap_name); | ||
1762 | 1973 | ||
1763 | return ret; | 1974 | return ret; |
1764 | } | 1975 | } |
1765 | 1976 | ||
1766 | static struct class_attribute class_rbd_attrs[] = { | 1977 | static struct bus_attribute rbd_bus_attrs[] = { |
1767 | __ATTR(add, 0200, NULL, class_rbd_add), | 1978 | __ATTR(add, S_IWUSR, NULL, rbd_add), |
1768 | __ATTR(remove, 0200, NULL, class_rbd_remove), | 1979 | __ATTR(remove, S_IWUSR, NULL, rbd_remove), |
1769 | __ATTR(list, 0444, class_rbd_list, NULL), | ||
1770 | __ATTR(snaps_refresh, 0200, NULL, class_rbd_snaps_refresh), | ||
1771 | __ATTR(snap_create, 0200, NULL, class_rbd_snap_create), | ||
1772 | __ATTR(snaps_list, 0444, class_rbd_snaps_list, NULL), | ||
1773 | __ATTR(snap_rollback, 0200, NULL, class_rbd_rollback), | ||
1774 | __ATTR_NULL | 1980 | __ATTR_NULL |
1775 | }; | 1981 | }; |
1776 | 1982 | ||
1777 | /* | 1983 | /* |
1778 | * create control files in sysfs | 1984 | * create control files in sysfs |
1779 | * /sys/class/rbd/... | 1985 | * /sys/bus/rbd/... |
1780 | */ | 1986 | */ |
1781 | static int rbd_sysfs_init(void) | 1987 | static int rbd_sysfs_init(void) |
1782 | { | 1988 | { |
1783 | int ret = -ENOMEM; | 1989 | int ret; |
1784 | 1990 | ||
1785 | class_rbd = kzalloc(sizeof(*class_rbd), GFP_KERNEL); | 1991 | rbd_bus_type.bus_attrs = rbd_bus_attrs; |
1786 | if (!class_rbd) | ||
1787 | goto out; | ||
1788 | 1992 | ||
1789 | class_rbd->name = DRV_NAME; | 1993 | ret = bus_register(&rbd_bus_type); |
1790 | class_rbd->owner = THIS_MODULE; | 1994 | if (ret < 0) |
1791 | class_rbd->class_release = class_rbd_release; | 1995 | return ret; |
1792 | class_rbd->class_attrs = class_rbd_attrs; | ||
1793 | 1996 | ||
1794 | ret = class_register(class_rbd); | 1997 | ret = device_register(&rbd_root_dev); |
1795 | if (ret) | ||
1796 | goto out_class; | ||
1797 | return 0; | ||
1798 | 1998 | ||
1799 | out_class: | ||
1800 | kfree(class_rbd); | ||
1801 | class_rbd = NULL; | ||
1802 | pr_err(DRV_NAME ": failed to create class rbd\n"); | ||
1803 | out: | ||
1804 | return ret; | 1999 | return ret; |
1805 | } | 2000 | } |
1806 | 2001 | ||
1807 | static void rbd_sysfs_cleanup(void) | 2002 | static void rbd_sysfs_cleanup(void) |
1808 | { | 2003 | { |
1809 | if (class_rbd) | 2004 | device_unregister(&rbd_root_dev); |
1810 | class_destroy(class_rbd); | 2005 | bus_unregister(&rbd_bus_type); |
1811 | class_rbd = NULL; | ||
1812 | } | 2006 | } |
1813 | 2007 | ||
1814 | int __init rbd_init(void) | 2008 | int __init rbd_init(void) |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 4f9e22f29138..657873e4328d 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -72,7 +72,7 @@ struct blk_shadow { | |||
72 | static DEFINE_MUTEX(blkfront_mutex); | 72 | static DEFINE_MUTEX(blkfront_mutex); |
73 | static const struct block_device_operations xlvbd_block_fops; | 73 | static const struct block_device_operations xlvbd_block_fops; |
74 | 74 | ||
75 | #define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) | 75 | #define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE) |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * We have one of these per vbd, whether ide, scsi or 'other'. They | 78 | * We have one of these per vbd, whether ide, scsi or 'other'. They |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 128cae4e8629..949ed09c6361 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -35,6 +35,10 @@ | |||
35 | static struct usb_device_id ath3k_table[] = { | 35 | static struct usb_device_id ath3k_table[] = { |
36 | /* Atheros AR3011 */ | 36 | /* Atheros AR3011 */ |
37 | { USB_DEVICE(0x0CF3, 0x3000) }, | 37 | { USB_DEVICE(0x0CF3, 0x3000) }, |
38 | |||
39 | /* Atheros AR3011 with sflash firmware*/ | ||
40 | { USB_DEVICE(0x0CF3, 0x3002) }, | ||
41 | |||
38 | { } /* Terminating entry */ | 42 | { } /* Terminating entry */ |
39 | }; | 43 | }; |
40 | 44 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index ab3894f742c3..1da773f899a2 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -99,6 +99,9 @@ static struct usb_device_id blacklist_table[] = { | |||
99 | /* Broadcom BCM2033 without firmware */ | 99 | /* Broadcom BCM2033 without firmware */ |
100 | { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, | 100 | { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, |
101 | 101 | ||
102 | /* Atheros 3011 with sflash firmware */ | ||
103 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, | ||
104 | |||
102 | /* Broadcom BCM2035 */ | 105 | /* Broadcom BCM2035 */ |
103 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, | 106 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, |
104 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, | 107 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, |
@@ -239,7 +242,8 @@ static void btusb_intr_complete(struct urb *urb) | |||
239 | 242 | ||
240 | err = usb_submit_urb(urb, GFP_ATOMIC); | 243 | err = usb_submit_urb(urb, GFP_ATOMIC); |
241 | if (err < 0) { | 244 | if (err < 0) { |
242 | BT_ERR("%s urb %p failed to resubmit (%d)", | 245 | if (err != -EPERM) |
246 | BT_ERR("%s urb %p failed to resubmit (%d)", | ||
243 | hdev->name, urb, -err); | 247 | hdev->name, urb, -err); |
244 | usb_unanchor_urb(urb); | 248 | usb_unanchor_urb(urb); |
245 | } | 249 | } |
@@ -323,7 +327,8 @@ static void btusb_bulk_complete(struct urb *urb) | |||
323 | 327 | ||
324 | err = usb_submit_urb(urb, GFP_ATOMIC); | 328 | err = usb_submit_urb(urb, GFP_ATOMIC); |
325 | if (err < 0) { | 329 | if (err < 0) { |
326 | BT_ERR("%s urb %p failed to resubmit (%d)", | 330 | if (err != -EPERM) |
331 | BT_ERR("%s urb %p failed to resubmit (%d)", | ||
327 | hdev->name, urb, -err); | 332 | hdev->name, urb, -err); |
328 | usb_unanchor_urb(urb); | 333 | usb_unanchor_urb(urb); |
329 | } | 334 | } |
@@ -412,7 +417,8 @@ static void btusb_isoc_complete(struct urb *urb) | |||
412 | 417 | ||
413 | err = usb_submit_urb(urb, GFP_ATOMIC); | 418 | err = usb_submit_urb(urb, GFP_ATOMIC); |
414 | if (err < 0) { | 419 | if (err < 0) { |
415 | BT_ERR("%s urb %p failed to resubmit (%d)", | 420 | if (err != -EPERM) |
421 | BT_ERR("%s urb %p failed to resubmit (%d)", | ||
416 | hdev->name, urb, -err); | 422 | hdev->name, urb, -err); |
417 | usb_unanchor_urb(urb); | 423 | usb_unanchor_urb(urb); |
418 | } | 424 | } |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 720148294e64..3c6cabcb7d84 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -311,8 +311,10 @@ static void hci_uart_tty_close(struct tty_struct *tty) | |||
311 | 311 | ||
312 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { | 312 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { |
313 | hu->proto->close(hu); | 313 | hu->proto->close(hu); |
314 | hci_unregister_dev(hdev); | 314 | if (hdev) { |
315 | hci_free_dev(hdev); | 315 | hci_unregister_dev(hdev); |
316 | hci_free_dev(hdev); | ||
317 | } | ||
316 | } | 318 | } |
317 | } | 319 | } |
318 | } | 320 | } |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 9272c38dd3c6..29ac6d499fa6 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -812,8 +812,10 @@ static int intel_fake_agp_fetch_size(void) | |||
812 | 812 | ||
813 | static void i830_cleanup(void) | 813 | static void i830_cleanup(void) |
814 | { | 814 | { |
815 | kunmap(intel_private.i8xx_page); | 815 | if (intel_private.i8xx_flush_page) { |
816 | intel_private.i8xx_flush_page = NULL; | 816 | kunmap(intel_private.i8xx_flush_page); |
817 | intel_private.i8xx_flush_page = NULL; | ||
818 | } | ||
817 | 819 | ||
818 | __free_page(intel_private.i8xx_page); | 820 | __free_page(intel_private.i8xx_page); |
819 | intel_private.i8xx_page = NULL; | 821 | intel_private.i8xx_page = NULL; |
@@ -1190,12 +1192,19 @@ static void i9xx_chipset_flush(void) | |||
1190 | writel(1, intel_private.i9xx_flush_page); | 1192 | writel(1, intel_private.i9xx_flush_page); |
1191 | } | 1193 | } |
1192 | 1194 | ||
1193 | static void i965_write_entry(dma_addr_t addr, unsigned int entry, | 1195 | static void i965_write_entry(dma_addr_t addr, |
1196 | unsigned int entry, | ||
1194 | unsigned int flags) | 1197 | unsigned int flags) |
1195 | { | 1198 | { |
1199 | u32 pte_flags; | ||
1200 | |||
1201 | pte_flags = I810_PTE_VALID; | ||
1202 | if (flags == AGP_USER_CACHED_MEMORY) | ||
1203 | pte_flags |= I830_PTE_SYSTEM_CACHED; | ||
1204 | |||
1196 | /* Shift high bits down */ | 1205 | /* Shift high bits down */ |
1197 | addr |= (addr >> 28) & 0xf0; | 1206 | addr |= (addr >> 28) & 0xf0; |
1198 | writel(addr | I810_PTE_VALID, intel_private.gtt + entry); | 1207 | writel(addr | pte_flags, intel_private.gtt + entry); |
1199 | } | 1208 | } |
1200 | 1209 | ||
1201 | static bool gen6_check_flags(unsigned int flags) | 1210 | static bool gen6_check_flags(unsigned int flags) |
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 73dcb0ee41fd..d3d63be2cd37 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/ramoops.h> | 29 | #include <linux/ramoops.h> |
30 | 30 | ||
31 | #define RAMOOPS_KERNMSG_HDR "====" | 31 | #define RAMOOPS_KERNMSG_HDR "====" |
32 | #define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) | ||
33 | 32 | ||
34 | #define RECORD_SIZE 4096 | 33 | #define RECORD_SIZE 4096 |
35 | 34 | ||
@@ -65,8 +64,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
65 | struct ramoops_context, dump); | 64 | struct ramoops_context, dump); |
66 | unsigned long s1_start, s2_start; | 65 | unsigned long s1_start, s2_start; |
67 | unsigned long l1_cpy, l2_cpy; | 66 | unsigned long l1_cpy, l2_cpy; |
68 | int res; | 67 | int res, hdr_size; |
69 | char *buf; | 68 | char *buf, *buf_orig; |
70 | struct timeval timestamp; | 69 | struct timeval timestamp; |
71 | 70 | ||
72 | /* Only dump oopses if dump_oops is set */ | 71 | /* Only dump oopses if dump_oops is set */ |
@@ -74,6 +73,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
74 | return; | 73 | return; |
75 | 74 | ||
76 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); | 75 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); |
76 | buf_orig = buf; | ||
77 | |||
77 | memset(buf, '\0', RECORD_SIZE); | 78 | memset(buf, '\0', RECORD_SIZE); |
78 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); | 79 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); |
79 | buf += res; | 80 | buf += res; |
@@ -81,8 +82,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
81 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); | 82 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); |
82 | buf += res; | 83 | buf += res; |
83 | 84 | ||
84 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); | 85 | hdr_size = buf - buf_orig; |
85 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); | 86 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size)); |
87 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy); | ||
86 | 88 | ||
87 | s2_start = l2 - l2_cpy; | 89 | s2_start = l2 - l2_cpy; |
88 | s1_start = l1 - l1_cpy; | 90 | s1_start = l1 - l1_cpy; |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 1030f8420137..c17a305ecb28 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
28 | #include <linux/acpi.h> | ||
28 | #include "tpm.h" | 29 | #include "tpm.h" |
29 | 30 | ||
30 | #define TPM_HEADER_SIZE 10 | 31 | #define TPM_HEADER_SIZE 10 |
@@ -78,6 +79,26 @@ enum tis_defaults { | |||
78 | static LIST_HEAD(tis_chips); | 79 | static LIST_HEAD(tis_chips); |
79 | static DEFINE_SPINLOCK(tis_lock); | 80 | static DEFINE_SPINLOCK(tis_lock); |
80 | 81 | ||
82 | #ifdef CONFIG_ACPI | ||
83 | static int is_itpm(struct pnp_dev *dev) | ||
84 | { | ||
85 | struct acpi_device *acpi = pnp_acpi_device(dev); | ||
86 | struct acpi_hardware_id *id; | ||
87 | |||
88 | list_for_each_entry(id, &acpi->pnp.ids, list) { | ||
89 | if (!strcmp("INTC0102", id->id)) | ||
90 | return 1; | ||
91 | } | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | #else | ||
96 | static int is_itpm(struct pnp_dev *dev) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | #endif | ||
101 | |||
81 | static int check_locality(struct tpm_chip *chip, int l) | 102 | static int check_locality(struct tpm_chip *chip, int l) |
82 | { | 103 | { |
83 | if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & | 104 | if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & |
@@ -472,6 +493,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
472 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | 493 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
473 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | 494 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
474 | 495 | ||
496 | if (is_itpm(to_pnp_dev(dev))) | ||
497 | itpm = 1; | ||
498 | |||
475 | if (itpm) | 499 | if (itpm) |
476 | dev_info(dev, "Intel iTPM workaround enabled\n"); | 500 | dev_info(dev, "Intel iTPM workaround enabled\n"); |
477 | 501 | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index d68d3aa1814b..f975d24890fa 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -283,16 +283,21 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p, | |||
283 | } while (delay); | 283 | } while (delay); |
284 | } | 284 | } |
285 | 285 | ||
286 | static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) | 286 | static void __sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) |
287 | { | 287 | { |
288 | unsigned long flags; | ||
289 | |||
290 | if (delta > p->max_match_value) | 288 | if (delta > p->max_match_value) |
291 | dev_warn(&p->pdev->dev, "delta out of range\n"); | 289 | dev_warn(&p->pdev->dev, "delta out of range\n"); |
292 | 290 | ||
293 | spin_lock_irqsave(&p->lock, flags); | ||
294 | p->next_match_value = delta; | 291 | p->next_match_value = delta; |
295 | sh_cmt_clock_event_program_verify(p, 0); | 292 | sh_cmt_clock_event_program_verify(p, 0); |
293 | } | ||
294 | |||
295 | static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) | ||
296 | { | ||
297 | unsigned long flags; | ||
298 | |||
299 | spin_lock_irqsave(&p->lock, flags); | ||
300 | __sh_cmt_set_next(p, delta); | ||
296 | spin_unlock_irqrestore(&p->lock, flags); | 301 | spin_unlock_irqrestore(&p->lock, flags); |
297 | } | 302 | } |
298 | 303 | ||
@@ -359,7 +364,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag) | |||
359 | 364 | ||
360 | /* setup timeout if no clockevent */ | 365 | /* setup timeout if no clockevent */ |
361 | if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) | 366 | if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) |
362 | sh_cmt_set_next(p, p->max_match_value); | 367 | __sh_cmt_set_next(p, p->max_match_value); |
363 | out: | 368 | out: |
364 | spin_unlock_irqrestore(&p->lock, flags); | 369 | spin_unlock_irqrestore(&p->lock, flags); |
365 | 370 | ||
@@ -381,7 +386,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag) | |||
381 | 386 | ||
382 | /* adjust the timeout to maximum if only clocksource left */ | 387 | /* adjust the timeout to maximum if only clocksource left */ |
383 | if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) | 388 | if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) |
384 | sh_cmt_set_next(p, p->max_match_value); | 389 | __sh_cmt_set_next(p, p->max_match_value); |
385 | 390 | ||
386 | spin_unlock_irqrestore(&p->lock, flags); | 391 | spin_unlock_irqrestore(&p->lock, flags); |
387 | } | 392 | } |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index e16c3fa8d2e3..05117f1ad867 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -36,6 +36,7 @@ | |||
36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
37 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); | 37 | MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); |
38 | MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector."); | 38 | MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector."); |
39 | MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_CONNECTOR); | ||
39 | 40 | ||
40 | static struct cn_dev cdev; | 41 | static struct cn_dev cdev; |
41 | 42 | ||
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 6ee23592700a..ef138731c0ea 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -109,7 +109,7 @@ config FSL_DMA | |||
109 | 109 | ||
110 | config MPC512X_DMA | 110 | config MPC512X_DMA |
111 | tristate "Freescale MPC512x built-in DMA engine support" | 111 | tristate "Freescale MPC512x built-in DMA engine support" |
112 | depends on PPC_MPC512x | 112 | depends on PPC_MPC512x || PPC_MPC831x |
113 | select DMA_ENGINE | 113 | select DMA_ENGINE |
114 | ---help--- | 114 | ---help--- |
115 | Enable support for the Freescale MPC512x built-in DMA engine. | 115 | Enable support for the Freescale MPC512x built-in DMA engine. |
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index a8a84f4587f2..64b21f5cd740 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile | |||
@@ -1,8 +1,8 @@ | |||
1 | ifeq ($(CONFIG_DMADEVICES_DEBUG),y) | 1 | ifeq ($(CONFIG_DMADEVICES_DEBUG),y) |
2 | EXTRA_CFLAGS += -DDEBUG | 2 | ccflags-y += -DDEBUG |
3 | endif | 3 | endif |
4 | ifeq ($(CONFIG_DMADEVICES_VDEBUG),y) | 4 | ifeq ($(CONFIG_DMADEVICES_VDEBUG),y) |
5 | EXTRA_CFLAGS += -DVERBOSE_DEBUG | 5 | ccflags-y += -DVERBOSE_DEBUG |
6 | endif | 6 | endif |
7 | 7 | ||
8 | obj-$(CONFIG_DMA_ENGINE) += dmaengine.o | 8 | obj-$(CONFIG_DMA_ENGINE) += dmaengine.o |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index a0f3e6a06e06..ea0ee81cff53 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -722,7 +722,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
722 | desc->lli.daddr = mem; | 722 | desc->lli.daddr = mem; |
723 | desc->lli.ctrla = ctrla | 723 | desc->lli.ctrla = ctrla |
724 | | ATC_DST_WIDTH(mem_width) | 724 | | ATC_DST_WIDTH(mem_width) |
725 | | len >> mem_width; | 725 | | len >> reg_width; |
726 | desc->lli.ctrlb = ctrlb; | 726 | desc->lli.ctrlb = ctrlb; |
727 | 727 | ||
728 | if (!first) { | 728 | if (!first) { |
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 286c3ac6bdcc..e5e172d21692 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
@@ -50,9 +50,11 @@ static void dma_init(struct fsldma_chan *chan) | |||
50 | * EIE - Error interrupt enable | 50 | * EIE - Error interrupt enable |
51 | * EOSIE - End of segments interrupt enable (basic mode) | 51 | * EOSIE - End of segments interrupt enable (basic mode) |
52 | * EOLNIE - End of links interrupt enable | 52 | * EOLNIE - End of links interrupt enable |
53 | * BWC - Bandwidth sharing among channels | ||
53 | */ | 54 | */ |
54 | DMA_OUT(chan, &chan->regs->mr, FSL_DMA_MR_EIE | 55 | DMA_OUT(chan, &chan->regs->mr, FSL_DMA_MR_BWC |
55 | | FSL_DMA_MR_EOLNIE | FSL_DMA_MR_EOSIE, 32); | 56 | | FSL_DMA_MR_EIE | FSL_DMA_MR_EOLNIE |
57 | | FSL_DMA_MR_EOSIE, 32); | ||
56 | break; | 58 | break; |
57 | case FSL_DMA_IP_83XX: | 59 | case FSL_DMA_IP_83XX: |
58 | /* Set the channel to below modes: | 60 | /* Set the channel to below modes: |
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index cb4d6ff51597..ba9f403c0fbe 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved. | 2 | * Copyright (C) 2007-2010 Freescale Semiconductor, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * Author: | 4 | * Author: |
5 | * Zhang Wei <wei.zhang@freescale.com>, Jul 2007 | 5 | * Zhang Wei <wei.zhang@freescale.com>, Jul 2007 |
@@ -36,6 +36,13 @@ | |||
36 | #define FSL_DMA_MR_DAHE 0x00002000 | 36 | #define FSL_DMA_MR_DAHE 0x00002000 |
37 | #define FSL_DMA_MR_SAHE 0x00001000 | 37 | #define FSL_DMA_MR_SAHE 0x00001000 |
38 | 38 | ||
39 | /* | ||
40 | * Bandwidth/pause control determines how many bytes a given | ||
41 | * channel is allowed to transfer before the DMA engine pauses | ||
42 | * the current channel and switches to the next channel | ||
43 | */ | ||
44 | #define FSL_DMA_MR_BWC 0x08000000 | ||
45 | |||
39 | /* Special MR definition for MPC8349 */ | 46 | /* Special MR definition for MPC8349 */ |
40 | #define FSL_DMA_MR_EOTIE 0x00000080 | 47 | #define FSL_DMA_MR_EOTIE 0x00000080 |
41 | #define FSL_DMA_MR_PRC_RM 0x00000800 | 48 | #define FSL_DMA_MR_PRC_RM 0x00000800 |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index f629e4961af5..e53d438142bb 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -379,7 +379,7 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
379 | return 0; | 379 | return 0; |
380 | 380 | ||
381 | err_init: | 381 | err_init: |
382 | while (i-- >= 0) { | 382 | while (--i >= 0) { |
383 | struct imxdma_channel *imxdmac = &imxdma->channel[i]; | 383 | struct imxdma_channel *imxdmac = &imxdma->channel[i]; |
384 | imx_dma_free(imxdmac->imxdma_channel); | 384 | imx_dma_free(imxdmac->imxdma_channel); |
385 | } | 385 | } |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 0834323a0599..d0602dd5d1b2 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -951,7 +951,7 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg( | |||
951 | struct sdma_buffer_descriptor *bd = &sdmac->bd[i]; | 951 | struct sdma_buffer_descriptor *bd = &sdmac->bd[i]; |
952 | int param; | 952 | int param; |
953 | 953 | ||
954 | bd->buffer_addr = sgl->dma_address; | 954 | bd->buffer_addr = sg->dma_address; |
955 | 955 | ||
956 | count = sg->length; | 956 | count = sg->length; |
957 | 957 | ||
@@ -1385,7 +1385,7 @@ static int __init sdma_module_init(void) | |||
1385 | { | 1385 | { |
1386 | return platform_driver_probe(&sdma_driver, sdma_probe); | 1386 | return platform_driver_probe(&sdma_driver, sdma_probe); |
1387 | } | 1387 | } |
1388 | subsys_initcall(sdma_module_init); | 1388 | module_init(sdma_module_init); |
1389 | 1389 | ||
1390 | MODULE_AUTHOR("Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>"); | 1390 | MODULE_AUTHOR("Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>"); |
1391 | MODULE_DESCRIPTION("i.MX SDMA driver"); | 1391 | MODULE_DESCRIPTION("i.MX SDMA driver"); |
diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index 338bc4eed1f3..3109bd94bc4f 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c | |||
@@ -1075,7 +1075,6 @@ static int mid_setup_dma(struct pci_dev *pdev) | |||
1075 | if (NULL == dma->dma_pool) { | 1075 | if (NULL == dma->dma_pool) { |
1076 | pr_err("ERR_MDMA:pci_pool_create failed\n"); | 1076 | pr_err("ERR_MDMA:pci_pool_create failed\n"); |
1077 | err = -ENOMEM; | 1077 | err = -ENOMEM; |
1078 | kfree(dma); | ||
1079 | goto err_dma_pool; | 1078 | goto err_dma_pool; |
1080 | } | 1079 | } |
1081 | 1080 | ||
@@ -1186,7 +1185,6 @@ err_engine: | |||
1186 | free_irq(pdev->irq, dma); | 1185 | free_irq(pdev->irq, dma); |
1187 | err_irq: | 1186 | err_irq: |
1188 | pci_pool_destroy(dma->dma_pool); | 1187 | pci_pool_destroy(dma->dma_pool); |
1189 | kfree(dma); | ||
1190 | err_dma_pool: | 1188 | err_dma_pool: |
1191 | pr_err("ERR_MDMA:setup_dma failed: %d\n", err); | 1189 | pr_err("ERR_MDMA:setup_dma failed: %d\n", err); |
1192 | return err; | 1190 | return err; |
@@ -1413,7 +1411,7 @@ static const struct dev_pm_ops intel_mid_dma_pm = { | |||
1413 | .runtime_idle = dma_runtime_idle, | 1411 | .runtime_idle = dma_runtime_idle, |
1414 | }; | 1412 | }; |
1415 | 1413 | ||
1416 | static struct pci_driver intel_mid_dma_pci = { | 1414 | static struct pci_driver intel_mid_dma_pci_driver = { |
1417 | .name = "Intel MID DMA", | 1415 | .name = "Intel MID DMA", |
1418 | .id_table = intel_mid_dma_ids, | 1416 | .id_table = intel_mid_dma_ids, |
1419 | .probe = intel_mid_dma_probe, | 1417 | .probe = intel_mid_dma_probe, |
@@ -1431,13 +1429,13 @@ static int __init intel_mid_dma_init(void) | |||
1431 | { | 1429 | { |
1432 | pr_debug("INFO_MDMA: LNW DMA Driver Version %s\n", | 1430 | pr_debug("INFO_MDMA: LNW DMA Driver Version %s\n", |
1433 | INTEL_MID_DMA_DRIVER_VERSION); | 1431 | INTEL_MID_DMA_DRIVER_VERSION); |
1434 | return pci_register_driver(&intel_mid_dma_pci); | 1432 | return pci_register_driver(&intel_mid_dma_pci_driver); |
1435 | } | 1433 | } |
1436 | fs_initcall(intel_mid_dma_init); | 1434 | fs_initcall(intel_mid_dma_init); |
1437 | 1435 | ||
1438 | static void __exit intel_mid_dma_exit(void) | 1436 | static void __exit intel_mid_dma_exit(void) |
1439 | { | 1437 | { |
1440 | pci_unregister_driver(&intel_mid_dma_pci); | 1438 | pci_unregister_driver(&intel_mid_dma_pci_driver); |
1441 | } | 1439 | } |
1442 | module_exit(intel_mid_dma_exit); | 1440 | module_exit(intel_mid_dma_exit); |
1443 | 1441 | ||
diff --git a/drivers/dma/ioat/Makefile b/drivers/dma/ioat/Makefile index 8997d3fb9051..0ff7270af25b 100644 --- a/drivers/dma/ioat/Makefile +++ b/drivers/dma/ioat/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o | 1 | obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o |
2 | ioatdma-objs := pci.o dma.o dma_v2.o dma_v3.o dca.o | 2 | ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o dca.o |
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 4e9cbf300594..59c270192ccc 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Freescale Semicondutor, Inc. 2007, 2008. | 2 | * Copyright (C) Freescale Semicondutor, Inc. 2007, 2008. |
3 | * Copyright (C) Semihalf 2009 | 3 | * Copyright (C) Semihalf 2009 |
4 | * Copyright (C) Ilya Yanok, Emcraft Systems 2010 | ||
4 | * | 5 | * |
5 | * Written by Piotr Ziecik <kosmo@semihalf.com>. Hardware description | 6 | * Written by Piotr Ziecik <kosmo@semihalf.com>. Hardware description |
6 | * (defines, structures and comments) was taken from MPC5121 DMA driver | 7 | * (defines, structures and comments) was taken from MPC5121 DMA driver |
@@ -70,6 +71,8 @@ | |||
70 | #define MPC_DMA_DMAES_SBE (1 << 1) | 71 | #define MPC_DMA_DMAES_SBE (1 << 1) |
71 | #define MPC_DMA_DMAES_DBE (1 << 0) | 72 | #define MPC_DMA_DMAES_DBE (1 << 0) |
72 | 73 | ||
74 | #define MPC_DMA_DMAGPOR_SNOOP_ENABLE (1 << 6) | ||
75 | |||
73 | #define MPC_DMA_TSIZE_1 0x00 | 76 | #define MPC_DMA_TSIZE_1 0x00 |
74 | #define MPC_DMA_TSIZE_2 0x01 | 77 | #define MPC_DMA_TSIZE_2 0x01 |
75 | #define MPC_DMA_TSIZE_4 0x02 | 78 | #define MPC_DMA_TSIZE_4 0x02 |
@@ -104,7 +107,10 @@ struct __attribute__ ((__packed__)) mpc_dma_regs { | |||
104 | /* 0x30 */ | 107 | /* 0x30 */ |
105 | u32 dmahrsh; /* DMA hw request status high(ch63~32) */ | 108 | u32 dmahrsh; /* DMA hw request status high(ch63~32) */ |
106 | u32 dmahrsl; /* DMA hardware request status low(ch31~0) */ | 109 | u32 dmahrsl; /* DMA hardware request status low(ch31~0) */ |
107 | u32 dmaihsa; /* DMA interrupt high select AXE(ch63~32) */ | 110 | union { |
111 | u32 dmaihsa; /* DMA interrupt high select AXE(ch63~32) */ | ||
112 | u32 dmagpor; /* (General purpose register on MPC8308) */ | ||
113 | }; | ||
108 | u32 dmailsa; /* DMA interrupt low select AXE(ch31~0) */ | 114 | u32 dmailsa; /* DMA interrupt low select AXE(ch31~0) */ |
109 | /* 0x40 ~ 0xff */ | 115 | /* 0x40 ~ 0xff */ |
110 | u32 reserve0[48]; /* Reserved */ | 116 | u32 reserve0[48]; /* Reserved */ |
@@ -195,7 +201,9 @@ struct mpc_dma { | |||
195 | struct mpc_dma_regs __iomem *regs; | 201 | struct mpc_dma_regs __iomem *regs; |
196 | struct mpc_dma_tcd __iomem *tcd; | 202 | struct mpc_dma_tcd __iomem *tcd; |
197 | int irq; | 203 | int irq; |
204 | int irq2; | ||
198 | uint error_status; | 205 | uint error_status; |
206 | int is_mpc8308; | ||
199 | 207 | ||
200 | /* Lock for error_status field in this structure */ | 208 | /* Lock for error_status field in this structure */ |
201 | spinlock_t error_status_lock; | 209 | spinlock_t error_status_lock; |
@@ -252,11 +260,13 @@ static void mpc_dma_execute(struct mpc_dma_chan *mchan) | |||
252 | prev = mdesc; | 260 | prev = mdesc; |
253 | } | 261 | } |
254 | 262 | ||
255 | prev->tcd->start = 0; | ||
256 | prev->tcd->int_maj = 1; | 263 | prev->tcd->int_maj = 1; |
257 | 264 | ||
258 | /* Send first descriptor in chain into hardware */ | 265 | /* Send first descriptor in chain into hardware */ |
259 | memcpy_toio(&mdma->tcd[cid], first->tcd, sizeof(struct mpc_dma_tcd)); | 266 | memcpy_toio(&mdma->tcd[cid], first->tcd, sizeof(struct mpc_dma_tcd)); |
267 | |||
268 | if (first != prev) | ||
269 | mdma->tcd[cid].e_sg = 1; | ||
260 | out_8(&mdma->regs->dmassrt, cid); | 270 | out_8(&mdma->regs->dmassrt, cid); |
261 | } | 271 | } |
262 | 272 | ||
@@ -274,6 +284,9 @@ static void mpc_dma_irq_process(struct mpc_dma *mdma, u32 is, u32 es, int off) | |||
274 | 284 | ||
275 | spin_lock(&mchan->lock); | 285 | spin_lock(&mchan->lock); |
276 | 286 | ||
287 | out_8(&mdma->regs->dmacint, ch + off); | ||
288 | out_8(&mdma->regs->dmacerr, ch + off); | ||
289 | |||
277 | /* Check error status */ | 290 | /* Check error status */ |
278 | if (es & (1 << ch)) | 291 | if (es & (1 << ch)) |
279 | list_for_each_entry(mdesc, &mchan->active, node) | 292 | list_for_each_entry(mdesc, &mchan->active, node) |
@@ -302,36 +315,68 @@ static irqreturn_t mpc_dma_irq(int irq, void *data) | |||
302 | spin_unlock(&mdma->error_status_lock); | 315 | spin_unlock(&mdma->error_status_lock); |
303 | 316 | ||
304 | /* Handle interrupt on each channel */ | 317 | /* Handle interrupt on each channel */ |
305 | mpc_dma_irq_process(mdma, in_be32(&mdma->regs->dmainth), | 318 | if (mdma->dma.chancnt > 32) { |
319 | mpc_dma_irq_process(mdma, in_be32(&mdma->regs->dmainth), | ||
306 | in_be32(&mdma->regs->dmaerrh), 32); | 320 | in_be32(&mdma->regs->dmaerrh), 32); |
321 | } | ||
307 | mpc_dma_irq_process(mdma, in_be32(&mdma->regs->dmaintl), | 322 | mpc_dma_irq_process(mdma, in_be32(&mdma->regs->dmaintl), |
308 | in_be32(&mdma->regs->dmaerrl), 0); | 323 | in_be32(&mdma->regs->dmaerrl), 0); |
309 | 324 | ||
310 | /* Ack interrupt on all channels */ | ||
311 | out_be32(&mdma->regs->dmainth, 0xFFFFFFFF); | ||
312 | out_be32(&mdma->regs->dmaintl, 0xFFFFFFFF); | ||
313 | out_be32(&mdma->regs->dmaerrh, 0xFFFFFFFF); | ||
314 | out_be32(&mdma->regs->dmaerrl, 0xFFFFFFFF); | ||
315 | |||
316 | /* Schedule tasklet */ | 325 | /* Schedule tasklet */ |
317 | tasklet_schedule(&mdma->tasklet); | 326 | tasklet_schedule(&mdma->tasklet); |
318 | 327 | ||
319 | return IRQ_HANDLED; | 328 | return IRQ_HANDLED; |
320 | } | 329 | } |
321 | 330 | ||
322 | /* DMA Tasklet */ | 331 | /* proccess completed descriptors */ |
323 | static void mpc_dma_tasklet(unsigned long data) | 332 | static void mpc_dma_process_completed(struct mpc_dma *mdma) |
324 | { | 333 | { |
325 | struct mpc_dma *mdma = (void *)data; | ||
326 | dma_cookie_t last_cookie = 0; | 334 | dma_cookie_t last_cookie = 0; |
327 | struct mpc_dma_chan *mchan; | 335 | struct mpc_dma_chan *mchan; |
328 | struct mpc_dma_desc *mdesc; | 336 | struct mpc_dma_desc *mdesc; |
329 | struct dma_async_tx_descriptor *desc; | 337 | struct dma_async_tx_descriptor *desc; |
330 | unsigned long flags; | 338 | unsigned long flags; |
331 | LIST_HEAD(list); | 339 | LIST_HEAD(list); |
332 | uint es; | ||
333 | int i; | 340 | int i; |
334 | 341 | ||
342 | for (i = 0; i < mdma->dma.chancnt; i++) { | ||
343 | mchan = &mdma->channels[i]; | ||
344 | |||
345 | /* Get all completed descriptors */ | ||
346 | spin_lock_irqsave(&mchan->lock, flags); | ||
347 | if (!list_empty(&mchan->completed)) | ||
348 | list_splice_tail_init(&mchan->completed, &list); | ||
349 | spin_unlock_irqrestore(&mchan->lock, flags); | ||
350 | |||
351 | if (list_empty(&list)) | ||
352 | continue; | ||
353 | |||
354 | /* Execute callbacks and run dependencies */ | ||
355 | list_for_each_entry(mdesc, &list, node) { | ||
356 | desc = &mdesc->desc; | ||
357 | |||
358 | if (desc->callback) | ||
359 | desc->callback(desc->callback_param); | ||
360 | |||
361 | last_cookie = desc->cookie; | ||
362 | dma_run_dependencies(desc); | ||
363 | } | ||
364 | |||
365 | /* Free descriptors */ | ||
366 | spin_lock_irqsave(&mchan->lock, flags); | ||
367 | list_splice_tail_init(&list, &mchan->free); | ||
368 | mchan->completed_cookie = last_cookie; | ||
369 | spin_unlock_irqrestore(&mchan->lock, flags); | ||
370 | } | ||
371 | } | ||
372 | |||
373 | /* DMA Tasklet */ | ||
374 | static void mpc_dma_tasklet(unsigned long data) | ||
375 | { | ||
376 | struct mpc_dma *mdma = (void *)data; | ||
377 | unsigned long flags; | ||
378 | uint es; | ||
379 | |||
335 | spin_lock_irqsave(&mdma->error_status_lock, flags); | 380 | spin_lock_irqsave(&mdma->error_status_lock, flags); |
336 | es = mdma->error_status; | 381 | es = mdma->error_status; |
337 | mdma->error_status = 0; | 382 | mdma->error_status = 0; |
@@ -370,35 +415,7 @@ static void mpc_dma_tasklet(unsigned long data) | |||
370 | dev_err(mdma->dma.dev, "- Destination Bus Error\n"); | 415 | dev_err(mdma->dma.dev, "- Destination Bus Error\n"); |
371 | } | 416 | } |
372 | 417 | ||
373 | for (i = 0; i < mdma->dma.chancnt; i++) { | 418 | mpc_dma_process_completed(mdma); |
374 | mchan = &mdma->channels[i]; | ||
375 | |||
376 | /* Get all completed descriptors */ | ||
377 | spin_lock_irqsave(&mchan->lock, flags); | ||
378 | if (!list_empty(&mchan->completed)) | ||
379 | list_splice_tail_init(&mchan->completed, &list); | ||
380 | spin_unlock_irqrestore(&mchan->lock, flags); | ||
381 | |||
382 | if (list_empty(&list)) | ||
383 | continue; | ||
384 | |||
385 | /* Execute callbacks and run dependencies */ | ||
386 | list_for_each_entry(mdesc, &list, node) { | ||
387 | desc = &mdesc->desc; | ||
388 | |||
389 | if (desc->callback) | ||
390 | desc->callback(desc->callback_param); | ||
391 | |||
392 | last_cookie = desc->cookie; | ||
393 | dma_run_dependencies(desc); | ||
394 | } | ||
395 | |||
396 | /* Free descriptors */ | ||
397 | spin_lock_irqsave(&mchan->lock, flags); | ||
398 | list_splice_tail_init(&list, &mchan->free); | ||
399 | mchan->completed_cookie = last_cookie; | ||
400 | spin_unlock_irqrestore(&mchan->lock, flags); | ||
401 | } | ||
402 | } | 419 | } |
403 | 420 | ||
404 | /* Submit descriptor to hardware */ | 421 | /* Submit descriptor to hardware */ |
@@ -563,6 +580,7 @@ static struct dma_async_tx_descriptor * | |||
563 | mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, dma_addr_t src, | 580 | mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, dma_addr_t src, |
564 | size_t len, unsigned long flags) | 581 | size_t len, unsigned long flags) |
565 | { | 582 | { |
583 | struct mpc_dma *mdma = dma_chan_to_mpc_dma(chan); | ||
566 | struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); | 584 | struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); |
567 | struct mpc_dma_desc *mdesc = NULL; | 585 | struct mpc_dma_desc *mdesc = NULL; |
568 | struct mpc_dma_tcd *tcd; | 586 | struct mpc_dma_tcd *tcd; |
@@ -577,8 +595,11 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, dma_addr_t src, | |||
577 | } | 595 | } |
578 | spin_unlock_irqrestore(&mchan->lock, iflags); | 596 | spin_unlock_irqrestore(&mchan->lock, iflags); |
579 | 597 | ||
580 | if (!mdesc) | 598 | if (!mdesc) { |
599 | /* try to free completed descriptors */ | ||
600 | mpc_dma_process_completed(mdma); | ||
581 | return NULL; | 601 | return NULL; |
602 | } | ||
582 | 603 | ||
583 | mdesc->error = 0; | 604 | mdesc->error = 0; |
584 | tcd = mdesc->tcd; | 605 | tcd = mdesc->tcd; |
@@ -591,7 +612,8 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, dma_addr_t src, | |||
591 | tcd->dsize = MPC_DMA_TSIZE_32; | 612 | tcd->dsize = MPC_DMA_TSIZE_32; |
592 | tcd->soff = 32; | 613 | tcd->soff = 32; |
593 | tcd->doff = 32; | 614 | tcd->doff = 32; |
594 | } else if (IS_ALIGNED(src | dst | len, 16)) { | 615 | } else if (!mdma->is_mpc8308 && IS_ALIGNED(src | dst | len, 16)) { |
616 | /* MPC8308 doesn't support 16 byte transfers */ | ||
595 | tcd->ssize = MPC_DMA_TSIZE_16; | 617 | tcd->ssize = MPC_DMA_TSIZE_16; |
596 | tcd->dsize = MPC_DMA_TSIZE_16; | 618 | tcd->dsize = MPC_DMA_TSIZE_16; |
597 | tcd->soff = 16; | 619 | tcd->soff = 16; |
@@ -651,6 +673,15 @@ static int __devinit mpc_dma_probe(struct platform_device *op, | |||
651 | return -EINVAL; | 673 | return -EINVAL; |
652 | } | 674 | } |
653 | 675 | ||
676 | if (of_device_is_compatible(dn, "fsl,mpc8308-dma")) { | ||
677 | mdma->is_mpc8308 = 1; | ||
678 | mdma->irq2 = irq_of_parse_and_map(dn, 1); | ||
679 | if (mdma->irq2 == NO_IRQ) { | ||
680 | dev_err(dev, "Error mapping IRQ!\n"); | ||
681 | return -EINVAL; | ||
682 | } | ||
683 | } | ||
684 | |||
654 | retval = of_address_to_resource(dn, 0, &res); | 685 | retval = of_address_to_resource(dn, 0, &res); |
655 | if (retval) { | 686 | if (retval) { |
656 | dev_err(dev, "Error parsing memory region!\n"); | 687 | dev_err(dev, "Error parsing memory region!\n"); |
@@ -681,11 +712,23 @@ static int __devinit mpc_dma_probe(struct platform_device *op, | |||
681 | return -EINVAL; | 712 | return -EINVAL; |
682 | } | 713 | } |
683 | 714 | ||
715 | if (mdma->is_mpc8308) { | ||
716 | retval = devm_request_irq(dev, mdma->irq2, &mpc_dma_irq, 0, | ||
717 | DRV_NAME, mdma); | ||
718 | if (retval) { | ||
719 | dev_err(dev, "Error requesting IRQ2!\n"); | ||
720 | return -EINVAL; | ||
721 | } | ||
722 | } | ||
723 | |||
684 | spin_lock_init(&mdma->error_status_lock); | 724 | spin_lock_init(&mdma->error_status_lock); |
685 | 725 | ||
686 | dma = &mdma->dma; | 726 | dma = &mdma->dma; |
687 | dma->dev = dev; | 727 | dma->dev = dev; |
688 | dma->chancnt = MPC_DMA_CHANNELS; | 728 | if (!mdma->is_mpc8308) |
729 | dma->chancnt = MPC_DMA_CHANNELS; | ||
730 | else | ||
731 | dma->chancnt = 16; /* MPC8308 DMA has only 16 channels */ | ||
689 | dma->device_alloc_chan_resources = mpc_dma_alloc_chan_resources; | 732 | dma->device_alloc_chan_resources = mpc_dma_alloc_chan_resources; |
690 | dma->device_free_chan_resources = mpc_dma_free_chan_resources; | 733 | dma->device_free_chan_resources = mpc_dma_free_chan_resources; |
691 | dma->device_issue_pending = mpc_dma_issue_pending; | 734 | dma->device_issue_pending = mpc_dma_issue_pending; |
@@ -721,26 +764,40 @@ static int __devinit mpc_dma_probe(struct platform_device *op, | |||
721 | * - Round-robin group arbitration, | 764 | * - Round-robin group arbitration, |
722 | * - Round-robin channel arbitration. | 765 | * - Round-robin channel arbitration. |
723 | */ | 766 | */ |
724 | out_be32(&mdma->regs->dmacr, MPC_DMA_DMACR_EDCG | | 767 | if (!mdma->is_mpc8308) { |
725 | MPC_DMA_DMACR_ERGA | MPC_DMA_DMACR_ERCA); | 768 | out_be32(&mdma->regs->dmacr, MPC_DMA_DMACR_EDCG | |
726 | 769 | MPC_DMA_DMACR_ERGA | MPC_DMA_DMACR_ERCA); | |
727 | /* Disable hardware DMA requests */ | 770 | |
728 | out_be32(&mdma->regs->dmaerqh, 0); | 771 | /* Disable hardware DMA requests */ |
729 | out_be32(&mdma->regs->dmaerql, 0); | 772 | out_be32(&mdma->regs->dmaerqh, 0); |
730 | 773 | out_be32(&mdma->regs->dmaerql, 0); | |
731 | /* Disable error interrupts */ | 774 | |
732 | out_be32(&mdma->regs->dmaeeih, 0); | 775 | /* Disable error interrupts */ |
733 | out_be32(&mdma->regs->dmaeeil, 0); | 776 | out_be32(&mdma->regs->dmaeeih, 0); |
734 | 777 | out_be32(&mdma->regs->dmaeeil, 0); | |
735 | /* Clear interrupts status */ | 778 | |
736 | out_be32(&mdma->regs->dmainth, 0xFFFFFFFF); | 779 | /* Clear interrupts status */ |
737 | out_be32(&mdma->regs->dmaintl, 0xFFFFFFFF); | 780 | out_be32(&mdma->regs->dmainth, 0xFFFFFFFF); |
738 | out_be32(&mdma->regs->dmaerrh, 0xFFFFFFFF); | 781 | out_be32(&mdma->regs->dmaintl, 0xFFFFFFFF); |
739 | out_be32(&mdma->regs->dmaerrl, 0xFFFFFFFF); | 782 | out_be32(&mdma->regs->dmaerrh, 0xFFFFFFFF); |
740 | 783 | out_be32(&mdma->regs->dmaerrl, 0xFFFFFFFF); | |
741 | /* Route interrupts to IPIC */ | 784 | |
742 | out_be32(&mdma->regs->dmaihsa, 0); | 785 | /* Route interrupts to IPIC */ |
743 | out_be32(&mdma->regs->dmailsa, 0); | 786 | out_be32(&mdma->regs->dmaihsa, 0); |
787 | out_be32(&mdma->regs->dmailsa, 0); | ||
788 | } else { | ||
789 | /* MPC8308 has 16 channels and lacks some registers */ | ||
790 | out_be32(&mdma->regs->dmacr, MPC_DMA_DMACR_ERCA); | ||
791 | |||
792 | /* enable snooping */ | ||
793 | out_be32(&mdma->regs->dmagpor, MPC_DMA_DMAGPOR_SNOOP_ENABLE); | ||
794 | /* Disable error interrupts */ | ||
795 | out_be32(&mdma->regs->dmaeeil, 0); | ||
796 | |||
797 | /* Clear interrupts status */ | ||
798 | out_be32(&mdma->regs->dmaintl, 0xFFFF); | ||
799 | out_be32(&mdma->regs->dmaerrl, 0xFFFF); | ||
800 | } | ||
744 | 801 | ||
745 | /* Register DMA engine */ | 802 | /* Register DMA engine */ |
746 | dev_set_drvdata(dev, mdma); | 803 | dev_set_drvdata(dev, mdma); |
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index 92b679024fed..c064c89420d0 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c | |||
@@ -259,11 +259,6 @@ static void pdc_dostart(struct pch_dma_chan *pd_chan, struct pch_dma_desc* desc) | |||
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | 261 | ||
262 | channel_writel(pd_chan, DEV_ADDR, desc->regs.dev_addr); | ||
263 | channel_writel(pd_chan, MEM_ADDR, desc->regs.mem_addr); | ||
264 | channel_writel(pd_chan, SIZE, desc->regs.size); | ||
265 | channel_writel(pd_chan, NEXT, desc->regs.next); | ||
266 | |||
267 | dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> dev_addr: %x\n", | 262 | dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> dev_addr: %x\n", |
268 | pd_chan->chan.chan_id, desc->regs.dev_addr); | 263 | pd_chan->chan.chan_id, desc->regs.dev_addr); |
269 | dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> mem_addr: %x\n", | 264 | dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> mem_addr: %x\n", |
@@ -273,10 +268,16 @@ static void pdc_dostart(struct pch_dma_chan *pd_chan, struct pch_dma_desc* desc) | |||
273 | dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> next: %x\n", | 268 | dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> next: %x\n", |
274 | pd_chan->chan.chan_id, desc->regs.next); | 269 | pd_chan->chan.chan_id, desc->regs.next); |
275 | 270 | ||
276 | if (list_empty(&desc->tx_list)) | 271 | if (list_empty(&desc->tx_list)) { |
272 | channel_writel(pd_chan, DEV_ADDR, desc->regs.dev_addr); | ||
273 | channel_writel(pd_chan, MEM_ADDR, desc->regs.mem_addr); | ||
274 | channel_writel(pd_chan, SIZE, desc->regs.size); | ||
275 | channel_writel(pd_chan, NEXT, desc->regs.next); | ||
277 | pdc_set_mode(&pd_chan->chan, DMA_CTL0_ONESHOT); | 276 | pdc_set_mode(&pd_chan->chan, DMA_CTL0_ONESHOT); |
278 | else | 277 | } else { |
278 | channel_writel(pd_chan, NEXT, desc->txd.phys); | ||
279 | pdc_set_mode(&pd_chan->chan, DMA_CTL0_SG); | 279 | pdc_set_mode(&pd_chan->chan, DMA_CTL0_SG); |
280 | } | ||
280 | 281 | ||
281 | val = dma_readl(pd, CTL2); | 282 | val = dma_readl(pd, CTL2); |
282 | val |= 1 << (DMA_CTL2_START_SHIFT_BITS + pd_chan->chan.chan_id); | 283 | val |= 1 << (DMA_CTL2_START_SHIFT_BITS + pd_chan->chan.chan_id); |
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index 0d58a4a4487f..cef584533ee8 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c | |||
@@ -4449,9 +4449,8 @@ static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev, | |||
4449 | 4449 | ||
4450 | if (!request_mem_region(res.start, resource_size(&res), | 4450 | if (!request_mem_region(res.start, resource_size(&res), |
4451 | dev_driver_string(&ofdev->dev))) { | 4451 | dev_driver_string(&ofdev->dev))) { |
4452 | dev_err(&ofdev->dev, "failed to request memory region " | 4452 | dev_err(&ofdev->dev, "failed to request memory region %pR\n", |
4453 | "(0x%016llx-0x%016llx)\n", | 4453 | &res); |
4454 | (u64)res.start, (u64)res.end); | ||
4455 | initcode = PPC_ADMA_INIT_MEMREG; | 4454 | initcode = PPC_ADMA_INIT_MEMREG; |
4456 | ret = -EBUSY; | 4455 | ret = -EBUSY; |
4457 | goto out; | 4456 | goto out; |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index eb6b54dbb806..85ffd5e38c50 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -1213,3 +1213,4 @@ module_exit(sh_dmae_exit); | |||
1213 | MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>"); | 1213 | MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>"); |
1214 | MODULE_DESCRIPTION("Renesas SH DMA Engine driver"); | 1214 | MODULE_DESCRIPTION("Renesas SH DMA Engine driver"); |
1215 | MODULE_LICENSE("GPL"); | 1215 | MODULE_LICENSE("GPL"); |
1216 | MODULE_ALIAS("platform:sh-dma-engine"); | ||
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile index b3781399b38a..ba2898b3639b 100644 --- a/drivers/edac/Makefile +++ b/drivers/edac/Makefile | |||
@@ -10,16 +10,16 @@ obj-$(CONFIG_EDAC) := edac_stub.o | |||
10 | obj-$(CONFIG_EDAC_MM_EDAC) += edac_core.o | 10 | obj-$(CONFIG_EDAC_MM_EDAC) += edac_core.o |
11 | obj-$(CONFIG_EDAC_MCE) += edac_mce.o | 11 | obj-$(CONFIG_EDAC_MCE) += edac_mce.o |
12 | 12 | ||
13 | edac_core-objs := edac_mc.o edac_device.o edac_mc_sysfs.o edac_pci_sysfs.o | 13 | edac_core-y := edac_mc.o edac_device.o edac_mc_sysfs.o edac_pci_sysfs.o |
14 | edac_core-objs += edac_module.o edac_device_sysfs.o | 14 | edac_core-y += edac_module.o edac_device_sysfs.o |
15 | 15 | ||
16 | ifdef CONFIG_PCI | 16 | ifdef CONFIG_PCI |
17 | edac_core-objs += edac_pci.o edac_pci_sysfs.o | 17 | edac_core-y += edac_pci.o edac_pci_sysfs.o |
18 | endif | 18 | endif |
19 | 19 | ||
20 | obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o | 20 | obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o |
21 | 21 | ||
22 | edac_mce_amd-objs := mce_amd.o | 22 | edac_mce_amd-y := mce_amd.o |
23 | obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o | 23 | obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o |
24 | 24 | ||
25 | obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o | 25 | obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 8521401bbd75..eca9ba193e94 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -1572,7 +1572,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int dram_range, | |||
1572 | debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n", | 1572 | debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n", |
1573 | hole_off, hole_valid, intlv_sel); | 1573 | hole_off, hole_valid, intlv_sel); |
1574 | 1574 | ||
1575 | if (intlv_en || | 1575 | if (intlv_en && |
1576 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) | 1576 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) |
1577 | return -EINVAL; | 1577 | return -EINVAL; |
1578 | 1578 | ||
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index d7ca43a828bd..251440cd50a3 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h | |||
@@ -41,10 +41,10 @@ | |||
41 | #define MC_PROC_NAME_MAX_LEN 7 | 41 | #define MC_PROC_NAME_MAX_LEN 7 |
42 | 42 | ||
43 | #if PAGE_SHIFT < 20 | 43 | #if PAGE_SHIFT < 20 |
44 | #define PAGES_TO_MiB( pages ) ( ( pages ) >> ( 20 - PAGE_SHIFT ) ) | 44 | #define PAGES_TO_MiB(pages) ((pages) >> (20 - PAGE_SHIFT)) |
45 | #define MiB_TO_PAGES(mb) ((mb) >> (20 - PAGE_SHIFT)) | 45 | #define MiB_TO_PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) |
46 | #else /* PAGE_SHIFT > 20 */ | 46 | #else /* PAGE_SHIFT > 20 */ |
47 | #define PAGES_TO_MiB( pages ) ( ( pages ) << ( PAGE_SHIFT - 20 ) ) | 47 | #define PAGES_TO_MiB(pages) ((pages) << (PAGE_SHIFT - 20)) |
48 | #define MiB_TO_PAGES(mb) ((mb) >> (PAGE_SHIFT - 20)) | 48 | #define MiB_TO_PAGES(mb) ((mb) >> (PAGE_SHIFT - 20)) |
49 | #endif | 49 | #endif |
50 | 50 | ||
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index ba6586a69ccc..795ea69c4d8f 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -586,14 +586,16 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev) | |||
586 | return NULL; | 586 | return NULL; |
587 | } | 587 | } |
588 | 588 | ||
589 | /* marking MCI offline */ | ||
590 | mci->op_state = OP_OFFLINE; | ||
591 | |||
592 | del_mc_from_global_list(mci); | 589 | del_mc_from_global_list(mci); |
593 | mutex_unlock(&mem_ctls_mutex); | 590 | mutex_unlock(&mem_ctls_mutex); |
594 | 591 | ||
595 | /* flush workq processes and remove sysfs */ | 592 | /* flush workq processes */ |
596 | edac_mc_workq_teardown(mci); | 593 | edac_mc_workq_teardown(mci); |
594 | |||
595 | /* marking MCI offline */ | ||
596 | mci->op_state = OP_OFFLINE; | ||
597 | |||
598 | /* remove from sysfs */ | ||
597 | edac_remove_sysfs_mci_device(mci); | 599 | edac_remove_sysfs_mci_device(mci); |
598 | 600 | ||
599 | edac_printk(KERN_INFO, EDAC_MC, | 601 | edac_printk(KERN_INFO, EDAC_MC, |
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c index 8d0688f36d4c..39faded3cadd 100644 --- a/drivers/edac/mce_amd_inj.c +++ b/drivers/edac/mce_amd_inj.c | |||
@@ -139,7 +139,7 @@ static int __init edac_init_mce_inject(void) | |||
139 | return 0; | 139 | return 0; |
140 | 140 | ||
141 | err_sysfs_create: | 141 | err_sysfs_create: |
142 | while (i-- >= 0) | 142 | while (--i >= 0) |
143 | sysfs_remove_file(mce_kobj, &sysfs_attrs[i]->attr); | 143 | sysfs_remove_file(mce_kobj, &sysfs_attrs[i]->attr); |
144 | 144 | ||
145 | kobject_del(mce_kobj); | 145 | kobject_del(mce_kobj); |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 84eb607d6c03..e3c8b60bd86b 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -242,6 +242,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card) | |||
242 | 242 | ||
243 | static char ohci_driver_name[] = KBUILD_MODNAME; | 243 | static char ohci_driver_name[] = KBUILD_MODNAME; |
244 | 244 | ||
245 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 | ||
245 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 | 246 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 |
246 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 | 247 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 |
247 | 248 | ||
@@ -253,18 +254,34 @@ static char ohci_driver_name[] = KBUILD_MODNAME; | |||
253 | 254 | ||
254 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ | 255 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ |
255 | static const struct { | 256 | static const struct { |
256 | unsigned short vendor, device, flags; | 257 | unsigned short vendor, device, revision, flags; |
257 | } ohci_quirks[] = { | 258 | } ohci_quirks[] = { |
258 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER | | 259 | {PCI_VENDOR_ID_AL, PCI_ANY_ID, PCI_ANY_ID, |
259 | QUIRK_RESET_PACKET | | 260 | QUIRK_CYCLE_TIMER}, |
260 | QUIRK_NO_1394A}, | 261 | |
261 | {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET}, | 262 | {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, PCI_ANY_ID, |
262 | {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 263 | QUIRK_BE_HEADERS}, |
263 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI}, | 264 | |
264 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 265 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, |
265 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 266 | QUIRK_NO_MSI}, |
266 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 267 | |
267 | {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS}, | 268 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, |
269 | QUIRK_NO_MSI}, | ||
270 | |||
271 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID, | ||
272 | QUIRK_CYCLE_TIMER}, | ||
273 | |||
274 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, | ||
275 | QUIRK_CYCLE_TIMER}, | ||
276 | |||
277 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, | ||
278 | QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, | ||
279 | |||
280 | {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID, | ||
281 | QUIRK_RESET_PACKET}, | ||
282 | |||
283 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID, | ||
284 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, | ||
268 | }; | 285 | }; |
269 | 286 | ||
270 | /* This overrides anything that was found in ohci_quirks[]. */ | 287 | /* This overrides anything that was found in ohci_quirks[]. */ |
@@ -2927,9 +2944,11 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2927 | } | 2944 | } |
2928 | 2945 | ||
2929 | for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++) | 2946 | for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++) |
2930 | if (ohci_quirks[i].vendor == dev->vendor && | 2947 | if ((ohci_quirks[i].vendor == dev->vendor) && |
2931 | (ohci_quirks[i].device == dev->device || | 2948 | (ohci_quirks[i].device == (unsigned short)PCI_ANY_ID || |
2932 | ohci_quirks[i].device == (unsigned short)PCI_ANY_ID)) { | 2949 | ohci_quirks[i].device == dev->device) && |
2950 | (ohci_quirks[i].revision == (unsigned short)PCI_ANY_ID || | ||
2951 | ohci_quirks[i].revision >= dev->revision)) { | ||
2933 | ohci->quirks = ohci_quirks[i].flags; | 2952 | ohci->quirks = ohci_quirks[i].flags; |
2934 | break; | 2953 | break; |
2935 | } | 2954 | } |
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index e23c06893d19..d3e55a0ae92b 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -56,6 +56,29 @@ static struct cs5535_gpio_chip { | |||
56 | * registers, see include/linux/cs5535.h. | 56 | * registers, see include/linux/cs5535.h. |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static void errata_outl(struct cs5535_gpio_chip *chip, u32 val, | ||
60 | unsigned int reg) | ||
61 | { | ||
62 | unsigned long addr = chip->base + 0x80 + reg; | ||
63 | |||
64 | /* | ||
65 | * According to the CS5536 errata (#36), after suspend | ||
66 | * a write to the high bank GPIO register will clear all | ||
67 | * non-selected bits; the recommended workaround is a | ||
68 | * read-modify-write operation. | ||
69 | * | ||
70 | * Don't apply this errata to the edge status GPIOs, as writing | ||
71 | * to their lower bits will clear them. | ||
72 | */ | ||
73 | if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) { | ||
74 | if (val & 0xffff) | ||
75 | val |= (inl(addr) & 0xffff); /* ignore the high bits */ | ||
76 | else | ||
77 | val |= (inl(addr) ^ (val >> 16)); | ||
78 | } | ||
79 | outl(val, addr); | ||
80 | } | ||
81 | |||
59 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | 82 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, |
60 | unsigned int reg) | 83 | unsigned int reg) |
61 | { | 84 | { |
@@ -64,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | |||
64 | outl(1 << offset, chip->base + reg); | 87 | outl(1 << offset, chip->base + reg); |
65 | else | 88 | else |
66 | /* high bank register */ | 89 | /* high bank register */ |
67 | outl(1 << (offset - 16), chip->base + 0x80 + reg); | 90 | errata_outl(chip, 1 << (offset - 16), reg); |
68 | } | 91 | } |
69 | 92 | ||
70 | void cs5535_gpio_set(unsigned offset, unsigned int reg) | 93 | void cs5535_gpio_set(unsigned offset, unsigned int reg) |
@@ -86,7 +109,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, | |||
86 | outl(1 << (offset + 16), chip->base + reg); | 109 | outl(1 << (offset + 16), chip->base + reg); |
87 | else | 110 | else |
88 | /* high bank register */ | 111 | /* high bank register */ |
89 | outl(1 << offset, chip->base + 0x80 + reg); | 112 | errata_outl(chip, 1 << offset, reg); |
90 | } | 113 | } |
91 | 114 | ||
92 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) | 115 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 21da9c19a0cb..649550e2cae9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1281,6 +1281,9 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | |||
1281 | err = gpio_direction_output(gpio, | 1281 | err = gpio_direction_output(gpio, |
1282 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); | 1282 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); |
1283 | 1283 | ||
1284 | if (err) | ||
1285 | gpio_free(gpio); | ||
1286 | |||
1284 | return err; | 1287 | return err; |
1285 | } | 1288 | } |
1286 | EXPORT_SYMBOL_GPL(gpio_request_one); | 1289 | EXPORT_SYMBOL_GPL(gpio_request_one); |
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c index 2762698e0204..897e0577e65e 100644 --- a/drivers/gpio/rdc321x-gpio.c +++ b/drivers/gpio/rdc321x-gpio.c | |||
@@ -135,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev) | |||
135 | struct rdc321x_gpio *rdc321x_gpio_dev; | 135 | struct rdc321x_gpio *rdc321x_gpio_dev; |
136 | struct rdc321x_gpio_pdata *pdata; | 136 | struct rdc321x_gpio_pdata *pdata; |
137 | 137 | ||
138 | pdata = pdev->dev.platform_data; | 138 | pdata = platform_get_drvdata(pdev); |
139 | if (!pdata) { | 139 | if (!pdata) { |
140 | dev_err(&pdev->dev, "no platform data supplied\n"); | 140 | dev_err(&pdev->dev, "no platform data supplied\n"); |
141 | return -ENODEV; | 141 | return -ENODEV; |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 6985cb1da72c..2baa6708e44c 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -156,12 +156,12 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = | |||
156 | { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, | 156 | { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, |
157 | { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, | 157 | { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, |
158 | { DRM_MODE_CONNECTOR_Component, "Component", 0 }, | 158 | { DRM_MODE_CONNECTOR_Component, "Component", 0 }, |
159 | { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, | 159 | { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, |
160 | { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, | 160 | { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 }, |
161 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, | 161 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 }, |
162 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, | 162 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 }, |
163 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, | 163 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, |
164 | { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, | 164 | { DRM_MODE_CONNECTOR_eDP, "eDP", 0 }, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static struct drm_prop_enum_list drm_encoder_enum_list[] = | 167 | static struct drm_prop_enum_list drm_encoder_enum_list[] = |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index f7af91cb273d..2d4e17a004db 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -471,6 +471,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
471 | int count = 0, ro, fail = 0; | 471 | int count = 0, ro, fail = 0; |
472 | struct drm_crtc_helper_funcs *crtc_funcs; | 472 | struct drm_crtc_helper_funcs *crtc_funcs; |
473 | int ret = 0; | 473 | int ret = 0; |
474 | int i; | ||
474 | 475 | ||
475 | DRM_DEBUG_KMS("\n"); | 476 | DRM_DEBUG_KMS("\n"); |
476 | 477 | ||
@@ -666,6 +667,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
666 | if (ret != 0) | 667 | if (ret != 0) |
667 | goto fail; | 668 | goto fail; |
668 | } | 669 | } |
670 | DRM_DEBUG_KMS("Setting connector DPMS state to on\n"); | ||
671 | for (i = 0; i < set->num_connectors; i++) { | ||
672 | DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id, | ||
673 | drm_get_connector_name(set->connectors[i])); | ||
674 | set->connectors[i]->dpms = DRM_MODE_DPMS_ON; | ||
675 | } | ||
669 | 676 | ||
670 | kfree(save_connectors); | 677 | kfree(save_connectors); |
671 | kfree(save_encoders); | 678 | kfree(save_encoders); |
@@ -841,7 +848,7 @@ static void output_poll_execute(struct work_struct *work) | |||
841 | struct delayed_work *delayed_work = to_delayed_work(work); | 848 | struct delayed_work *delayed_work = to_delayed_work(work); |
842 | struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); | 849 | struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); |
843 | struct drm_connector *connector; | 850 | struct drm_connector *connector; |
844 | enum drm_connector_status old_status, status; | 851 | enum drm_connector_status old_status; |
845 | bool repoll = false, changed = false; | 852 | bool repoll = false, changed = false; |
846 | 853 | ||
847 | if (!drm_kms_helper_poll) | 854 | if (!drm_kms_helper_poll) |
@@ -866,8 +873,12 @@ static void output_poll_execute(struct work_struct *work) | |||
866 | !(connector->polled & DRM_CONNECTOR_POLL_HPD)) | 873 | !(connector->polled & DRM_CONNECTOR_POLL_HPD)) |
867 | continue; | 874 | continue; |
868 | 875 | ||
869 | status = connector->funcs->detect(connector, false); | 876 | connector->status = connector->funcs->detect(connector, false); |
870 | if (old_status != status) | 877 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n", |
878 | connector->base.id, | ||
879 | drm_get_connector_name(connector), | ||
880 | old_status, connector->status); | ||
881 | if (old_status != connector->status) | ||
871 | changed = true; | 882 | changed = true; |
872 | } | 883 | } |
873 | 884 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 9d3a5030b6e1..16d5155edad1 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -585,10 +585,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, | |||
585 | struct timeval now; | 585 | struct timeval now; |
586 | unsigned long flags; | 586 | unsigned long flags; |
587 | unsigned int seq; | 587 | unsigned int seq; |
588 | int ret; | ||
588 | 589 | ||
589 | e = kzalloc(sizeof *e, GFP_KERNEL); | 590 | e = kzalloc(sizeof *e, GFP_KERNEL); |
590 | if (e == NULL) | 591 | if (e == NULL) { |
591 | return -ENOMEM; | 592 | ret = -ENOMEM; |
593 | goto err_put; | ||
594 | } | ||
592 | 595 | ||
593 | e->pipe = pipe; | 596 | e->pipe = pipe; |
594 | e->base.pid = current->pid; | 597 | e->base.pid = current->pid; |
@@ -603,9 +606,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, | |||
603 | spin_lock_irqsave(&dev->event_lock, flags); | 606 | spin_lock_irqsave(&dev->event_lock, flags); |
604 | 607 | ||
605 | if (file_priv->event_space < sizeof e->event) { | 608 | if (file_priv->event_space < sizeof e->event) { |
606 | spin_unlock_irqrestore(&dev->event_lock, flags); | 609 | ret = -EBUSY; |
607 | kfree(e); | 610 | goto err_unlock; |
608 | return -ENOMEM; | ||
609 | } | 611 | } |
610 | 612 | ||
611 | file_priv->event_space -= sizeof e->event; | 613 | file_priv->event_space -= sizeof e->event; |
@@ -626,7 +628,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, | |||
626 | if ((seq - vblwait->request.sequence) <= (1 << 23)) { | 628 | if ((seq - vblwait->request.sequence) <= (1 << 23)) { |
627 | e->event.tv_sec = now.tv_sec; | 629 | e->event.tv_sec = now.tv_sec; |
628 | e->event.tv_usec = now.tv_usec; | 630 | e->event.tv_usec = now.tv_usec; |
629 | drm_vblank_put(dev, e->pipe); | 631 | drm_vblank_put(dev, pipe); |
630 | list_add_tail(&e->base.link, &e->base.file_priv->event_list); | 632 | list_add_tail(&e->base.link, &e->base.file_priv->event_list); |
631 | wake_up_interruptible(&e->base.file_priv->event_wait); | 633 | wake_up_interruptible(&e->base.file_priv->event_wait); |
632 | trace_drm_vblank_event_delivered(current->pid, pipe, | 634 | trace_drm_vblank_event_delivered(current->pid, pipe, |
@@ -638,6 +640,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, | |||
638 | spin_unlock_irqrestore(&dev->event_lock, flags); | 640 | spin_unlock_irqrestore(&dev->event_lock, flags); |
639 | 641 | ||
640 | return 0; | 642 | return 0; |
643 | |||
644 | err_unlock: | ||
645 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
646 | kfree(e); | ||
647 | err_put: | ||
648 | drm_vblank_put(dev, pipe); | ||
649 | return ret; | ||
641 | } | 650 | } |
642 | 651 | ||
643 | /** | 652 | /** |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 7a26f4dd21ae..e6800819bca8 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -767,6 +767,9 @@ static int i915_getparam(struct drm_device *dev, void *data, | |||
767 | case I915_PARAM_HAS_BLT: | 767 | case I915_PARAM_HAS_BLT: |
768 | value = HAS_BLT(dev); | 768 | value = HAS_BLT(dev); |
769 | break; | 769 | break; |
770 | case I915_PARAM_HAS_COHERENT_RINGS: | ||
771 | value = 1; | ||
772 | break; | ||
770 | default: | 773 | default: |
771 | DRM_DEBUG_DRIVER("Unknown parameter %d\n", | 774 | DRM_DEBUG_DRIVER("Unknown parameter %d\n", |
772 | param->param); | 775 | param->param); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 17b1cba3b5f1..275ec6ed43ae 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -38,8 +38,7 @@ | |||
38 | 38 | ||
39 | static uint32_t i915_gem_get_gtt_alignment(struct drm_gem_object *obj); | 39 | static uint32_t i915_gem_get_gtt_alignment(struct drm_gem_object *obj); |
40 | 40 | ||
41 | static int i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj, | 41 | static int i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj); |
42 | bool pipelined); | ||
43 | static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj); | 42 | static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj); |
44 | static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj); | 43 | static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj); |
45 | static int i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, | 44 | static int i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, |
@@ -2594,7 +2593,7 @@ i915_gem_object_put_fence_reg(struct drm_gem_object *obj, | |||
2594 | if (reg->gpu) { | 2593 | if (reg->gpu) { |
2595 | int ret; | 2594 | int ret; |
2596 | 2595 | ||
2597 | ret = i915_gem_object_flush_gpu_write_domain(obj, true); | 2596 | ret = i915_gem_object_flush_gpu_write_domain(obj); |
2598 | if (ret) | 2597 | if (ret) |
2599 | return ret; | 2598 | return ret; |
2600 | 2599 | ||
@@ -2742,8 +2741,7 @@ i915_gem_clflush_object(struct drm_gem_object *obj) | |||
2742 | 2741 | ||
2743 | /** Flushes any GPU write domain for the object if it's dirty. */ | 2742 | /** Flushes any GPU write domain for the object if it's dirty. */ |
2744 | static int | 2743 | static int |
2745 | i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj, | 2744 | i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj) |
2746 | bool pipelined) | ||
2747 | { | 2745 | { |
2748 | struct drm_device *dev = obj->dev; | 2746 | struct drm_device *dev = obj->dev; |
2749 | uint32_t old_write_domain; | 2747 | uint32_t old_write_domain; |
@@ -2762,10 +2760,7 @@ i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj, | |||
2762 | obj->read_domains, | 2760 | obj->read_domains, |
2763 | old_write_domain); | 2761 | old_write_domain); |
2764 | 2762 | ||
2765 | if (pipelined) | 2763 | return 0; |
2766 | return 0; | ||
2767 | |||
2768 | return i915_gem_object_wait_rendering(obj, true); | ||
2769 | } | 2764 | } |
2770 | 2765 | ||
2771 | /** Flushes the GTT write domain for the object if it's dirty. */ | 2766 | /** Flushes the GTT write domain for the object if it's dirty. */ |
@@ -2826,18 +2821,15 @@ i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int write) | |||
2826 | if (obj_priv->gtt_space == NULL) | 2821 | if (obj_priv->gtt_space == NULL) |
2827 | return -EINVAL; | 2822 | return -EINVAL; |
2828 | 2823 | ||
2829 | ret = i915_gem_object_flush_gpu_write_domain(obj, false); | 2824 | ret = i915_gem_object_flush_gpu_write_domain(obj); |
2830 | if (ret != 0) | 2825 | if (ret != 0) |
2831 | return ret; | 2826 | return ret; |
2827 | ret = i915_gem_object_wait_rendering(obj, true); | ||
2828 | if (ret) | ||
2829 | return ret; | ||
2832 | 2830 | ||
2833 | i915_gem_object_flush_cpu_write_domain(obj); | 2831 | i915_gem_object_flush_cpu_write_domain(obj); |
2834 | 2832 | ||
2835 | if (write) { | ||
2836 | ret = i915_gem_object_wait_rendering(obj, true); | ||
2837 | if (ret) | ||
2838 | return ret; | ||
2839 | } | ||
2840 | |||
2841 | old_write_domain = obj->write_domain; | 2833 | old_write_domain = obj->write_domain; |
2842 | old_read_domains = obj->read_domains; | 2834 | old_read_domains = obj->read_domains; |
2843 | 2835 | ||
@@ -2875,7 +2867,7 @@ i915_gem_object_set_to_display_plane(struct drm_gem_object *obj, | |||
2875 | if (obj_priv->gtt_space == NULL) | 2867 | if (obj_priv->gtt_space == NULL) |
2876 | return -EINVAL; | 2868 | return -EINVAL; |
2877 | 2869 | ||
2878 | ret = i915_gem_object_flush_gpu_write_domain(obj, true); | 2870 | ret = i915_gem_object_flush_gpu_write_domain(obj); |
2879 | if (ret) | 2871 | if (ret) |
2880 | return ret; | 2872 | return ret; |
2881 | 2873 | ||
@@ -2924,9 +2916,12 @@ i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, int write) | |||
2924 | uint32_t old_write_domain, old_read_domains; | 2916 | uint32_t old_write_domain, old_read_domains; |
2925 | int ret; | 2917 | int ret; |
2926 | 2918 | ||
2927 | ret = i915_gem_object_flush_gpu_write_domain(obj, false); | 2919 | ret = i915_gem_object_flush_gpu_write_domain(obj); |
2928 | if (ret != 0) | 2920 | if (ret != 0) |
2929 | return ret; | 2921 | return ret; |
2922 | ret = i915_gem_object_wait_rendering(obj, true); | ||
2923 | if (ret) | ||
2924 | return ret; | ||
2930 | 2925 | ||
2931 | i915_gem_object_flush_gtt_write_domain(obj); | 2926 | i915_gem_object_flush_gtt_write_domain(obj); |
2932 | 2927 | ||
@@ -2935,12 +2930,6 @@ i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, int write) | |||
2935 | */ | 2930 | */ |
2936 | i915_gem_object_set_to_full_cpu_read_domain(obj); | 2931 | i915_gem_object_set_to_full_cpu_read_domain(obj); |
2937 | 2932 | ||
2938 | if (write) { | ||
2939 | ret = i915_gem_object_wait_rendering(obj, true); | ||
2940 | if (ret) | ||
2941 | return ret; | ||
2942 | } | ||
2943 | |||
2944 | old_write_domain = obj->write_domain; | 2933 | old_write_domain = obj->write_domain; |
2945 | old_read_domains = obj->read_domains; | 2934 | old_read_domains = obj->read_domains; |
2946 | 2935 | ||
@@ -3205,9 +3194,13 @@ i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj, | |||
3205 | if (offset == 0 && size == obj->size) | 3194 | if (offset == 0 && size == obj->size) |
3206 | return i915_gem_object_set_to_cpu_domain(obj, 0); | 3195 | return i915_gem_object_set_to_cpu_domain(obj, 0); |
3207 | 3196 | ||
3208 | ret = i915_gem_object_flush_gpu_write_domain(obj, false); | 3197 | ret = i915_gem_object_flush_gpu_write_domain(obj); |
3209 | if (ret != 0) | 3198 | if (ret != 0) |
3210 | return ret; | 3199 | return ret; |
3200 | ret = i915_gem_object_wait_rendering(obj, true); | ||
3201 | if (ret) | ||
3202 | return ret; | ||
3203 | |||
3211 | i915_gem_object_flush_gtt_write_domain(obj); | 3204 | i915_gem_object_flush_gtt_write_domain(obj); |
3212 | 3205 | ||
3213 | /* If we're already fully in the CPU read domain, we're done. */ | 3206 | /* If we're already fully in the CPU read domain, we're done. */ |
@@ -3254,192 +3247,230 @@ i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj, | |||
3254 | return 0; | 3247 | return 0; |
3255 | } | 3248 | } |
3256 | 3249 | ||
3257 | /** | ||
3258 | * Pin an object to the GTT and evaluate the relocations landing in it. | ||
3259 | */ | ||
3260 | static int | 3250 | static int |
3261 | i915_gem_execbuffer_relocate(struct drm_i915_gem_object *obj, | 3251 | i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, |
3262 | struct drm_file *file_priv, | 3252 | struct drm_file *file_priv, |
3263 | struct drm_i915_gem_exec_object2 *entry) | 3253 | struct drm_i915_gem_exec_object2 *entry, |
3254 | struct drm_i915_gem_relocation_entry *reloc) | ||
3264 | { | 3255 | { |
3265 | struct drm_device *dev = obj->base.dev; | 3256 | struct drm_device *dev = obj->base.dev; |
3266 | drm_i915_private_t *dev_priv = dev->dev_private; | 3257 | struct drm_gem_object *target_obj; |
3267 | struct drm_i915_gem_relocation_entry __user *user_relocs; | 3258 | uint32_t target_offset; |
3268 | struct drm_gem_object *target_obj = NULL; | 3259 | int ret = -EINVAL; |
3269 | uint32_t target_handle = 0; | ||
3270 | int i, ret = 0; | ||
3271 | 3260 | ||
3272 | user_relocs = (void __user *)(uintptr_t)entry->relocs_ptr; | 3261 | target_obj = drm_gem_object_lookup(dev, file_priv, |
3273 | for (i = 0; i < entry->relocation_count; i++) { | 3262 | reloc->target_handle); |
3274 | struct drm_i915_gem_relocation_entry reloc; | 3263 | if (target_obj == NULL) |
3275 | uint32_t target_offset; | 3264 | return -ENOENT; |
3276 | 3265 | ||
3277 | if (__copy_from_user_inatomic(&reloc, | 3266 | target_offset = to_intel_bo(target_obj)->gtt_offset; |
3278 | user_relocs+i, | ||
3279 | sizeof(reloc))) { | ||
3280 | ret = -EFAULT; | ||
3281 | break; | ||
3282 | } | ||
3283 | 3267 | ||
3284 | if (reloc.target_handle != target_handle) { | 3268 | #if WATCH_RELOC |
3285 | drm_gem_object_unreference(target_obj); | 3269 | DRM_INFO("%s: obj %p offset %08x target %d " |
3270 | "read %08x write %08x gtt %08x " | ||
3271 | "presumed %08x delta %08x\n", | ||
3272 | __func__, | ||
3273 | obj, | ||
3274 | (int) reloc->offset, | ||
3275 | (int) reloc->target_handle, | ||
3276 | (int) reloc->read_domains, | ||
3277 | (int) reloc->write_domain, | ||
3278 | (int) target_offset, | ||
3279 | (int) reloc->presumed_offset, | ||
3280 | reloc->delta); | ||
3281 | #endif | ||
3286 | 3282 | ||
3287 | target_obj = drm_gem_object_lookup(dev, file_priv, | 3283 | /* The target buffer should have appeared before us in the |
3288 | reloc.target_handle); | 3284 | * exec_object list, so it should have a GTT space bound by now. |
3289 | if (target_obj == NULL) { | 3285 | */ |
3290 | ret = -ENOENT; | 3286 | if (target_offset == 0) { |
3291 | break; | 3287 | DRM_ERROR("No GTT space found for object %d\n", |
3292 | } | 3288 | reloc->target_handle); |
3289 | goto err; | ||
3290 | } | ||
3293 | 3291 | ||
3294 | target_handle = reloc.target_handle; | 3292 | /* Validate that the target is in a valid r/w GPU domain */ |
3295 | } | 3293 | if (reloc->write_domain & (reloc->write_domain - 1)) { |
3296 | target_offset = to_intel_bo(target_obj)->gtt_offset; | 3294 | DRM_ERROR("reloc with multiple write domains: " |
3295 | "obj %p target %d offset %d " | ||
3296 | "read %08x write %08x", | ||
3297 | obj, reloc->target_handle, | ||
3298 | (int) reloc->offset, | ||
3299 | reloc->read_domains, | ||
3300 | reloc->write_domain); | ||
3301 | goto err; | ||
3302 | } | ||
3303 | if (reloc->write_domain & I915_GEM_DOMAIN_CPU || | ||
3304 | reloc->read_domains & I915_GEM_DOMAIN_CPU) { | ||
3305 | DRM_ERROR("reloc with read/write CPU domains: " | ||
3306 | "obj %p target %d offset %d " | ||
3307 | "read %08x write %08x", | ||
3308 | obj, reloc->target_handle, | ||
3309 | (int) reloc->offset, | ||
3310 | reloc->read_domains, | ||
3311 | reloc->write_domain); | ||
3312 | goto err; | ||
3313 | } | ||
3314 | if (reloc->write_domain && target_obj->pending_write_domain && | ||
3315 | reloc->write_domain != target_obj->pending_write_domain) { | ||
3316 | DRM_ERROR("Write domain conflict: " | ||
3317 | "obj %p target %d offset %d " | ||
3318 | "new %08x old %08x\n", | ||
3319 | obj, reloc->target_handle, | ||
3320 | (int) reloc->offset, | ||
3321 | reloc->write_domain, | ||
3322 | target_obj->pending_write_domain); | ||
3323 | goto err; | ||
3324 | } | ||
3297 | 3325 | ||
3298 | #if WATCH_RELOC | 3326 | target_obj->pending_read_domains |= reloc->read_domains; |
3299 | DRM_INFO("%s: obj %p offset %08x target %d " | 3327 | target_obj->pending_write_domain |= reloc->write_domain; |
3300 | "read %08x write %08x gtt %08x " | ||
3301 | "presumed %08x delta %08x\n", | ||
3302 | __func__, | ||
3303 | obj, | ||
3304 | (int) reloc.offset, | ||
3305 | (int) reloc.target_handle, | ||
3306 | (int) reloc.read_domains, | ||
3307 | (int) reloc.write_domain, | ||
3308 | (int) target_offset, | ||
3309 | (int) reloc.presumed_offset, | ||
3310 | reloc.delta); | ||
3311 | #endif | ||
3312 | 3328 | ||
3313 | /* The target buffer should have appeared before us in the | 3329 | /* If the relocation already has the right value in it, no |
3314 | * exec_object list, so it should have a GTT space bound by now. | 3330 | * more work needs to be done. |
3315 | */ | 3331 | */ |
3316 | if (target_offset == 0) { | 3332 | if (target_offset == reloc->presumed_offset) |
3317 | DRM_ERROR("No GTT space found for object %d\n", | 3333 | goto out; |
3318 | reloc.target_handle); | ||
3319 | ret = -EINVAL; | ||
3320 | break; | ||
3321 | } | ||
3322 | 3334 | ||
3323 | /* Validate that the target is in a valid r/w GPU domain */ | 3335 | /* Check that the relocation address is valid... */ |
3324 | if (reloc.write_domain & (reloc.write_domain - 1)) { | 3336 | if (reloc->offset > obj->base.size - 4) { |
3325 | DRM_ERROR("reloc with multiple write domains: " | 3337 | DRM_ERROR("Relocation beyond object bounds: " |
3326 | "obj %p target %d offset %d " | 3338 | "obj %p target %d offset %d size %d.\n", |
3327 | "read %08x write %08x", | 3339 | obj, reloc->target_handle, |
3328 | obj, reloc.target_handle, | 3340 | (int) reloc->offset, |
3329 | (int) reloc.offset, | 3341 | (int) obj->base.size); |
3330 | reloc.read_domains, | 3342 | goto err; |
3331 | reloc.write_domain); | 3343 | } |
3332 | ret = -EINVAL; | 3344 | if (reloc->offset & 3) { |
3333 | break; | 3345 | DRM_ERROR("Relocation not 4-byte aligned: " |
3334 | } | 3346 | "obj %p target %d offset %d.\n", |
3335 | if (reloc.write_domain & I915_GEM_DOMAIN_CPU || | 3347 | obj, reloc->target_handle, |
3336 | reloc.read_domains & I915_GEM_DOMAIN_CPU) { | 3348 | (int) reloc->offset); |
3337 | DRM_ERROR("reloc with read/write CPU domains: " | 3349 | goto err; |
3338 | "obj %p target %d offset %d " | 3350 | } |
3339 | "read %08x write %08x", | ||
3340 | obj, reloc.target_handle, | ||
3341 | (int) reloc.offset, | ||
3342 | reloc.read_domains, | ||
3343 | reloc.write_domain); | ||
3344 | ret = -EINVAL; | ||
3345 | break; | ||
3346 | } | ||
3347 | if (reloc.write_domain && target_obj->pending_write_domain && | ||
3348 | reloc.write_domain != target_obj->pending_write_domain) { | ||
3349 | DRM_ERROR("Write domain conflict: " | ||
3350 | "obj %p target %d offset %d " | ||
3351 | "new %08x old %08x\n", | ||
3352 | obj, reloc.target_handle, | ||
3353 | (int) reloc.offset, | ||
3354 | reloc.write_domain, | ||
3355 | target_obj->pending_write_domain); | ||
3356 | ret = -EINVAL; | ||
3357 | break; | ||
3358 | } | ||
3359 | 3351 | ||
3360 | target_obj->pending_read_domains |= reloc.read_domains; | 3352 | /* and points to somewhere within the target object. */ |
3361 | target_obj->pending_write_domain |= reloc.write_domain; | 3353 | if (reloc->delta >= target_obj->size) { |
3354 | DRM_ERROR("Relocation beyond target object bounds: " | ||
3355 | "obj %p target %d delta %d size %d.\n", | ||
3356 | obj, reloc->target_handle, | ||
3357 | (int) reloc->delta, | ||
3358 | (int) target_obj->size); | ||
3359 | goto err; | ||
3360 | } | ||
3362 | 3361 | ||
3363 | /* If the relocation already has the right value in it, no | 3362 | reloc->delta += target_offset; |
3364 | * more work needs to be done. | 3363 | if (obj->base.write_domain == I915_GEM_DOMAIN_CPU) { |
3365 | */ | 3364 | uint32_t page_offset = reloc->offset & ~PAGE_MASK; |
3366 | if (target_offset == reloc.presumed_offset) | 3365 | char *vaddr; |
3367 | continue; | ||
3368 | 3366 | ||
3369 | /* Check that the relocation address is valid... */ | 3367 | vaddr = kmap_atomic(obj->pages[reloc->offset >> PAGE_SHIFT]); |
3370 | if (reloc.offset > obj->base.size - 4) { | 3368 | *(uint32_t *)(vaddr + page_offset) = reloc->delta; |
3371 | DRM_ERROR("Relocation beyond object bounds: " | 3369 | kunmap_atomic(vaddr); |
3372 | "obj %p target %d offset %d size %d.\n", | 3370 | } else { |
3373 | obj, reloc.target_handle, | 3371 | struct drm_i915_private *dev_priv = dev->dev_private; |
3374 | (int) reloc.offset, (int) obj->base.size); | 3372 | uint32_t __iomem *reloc_entry; |
3375 | ret = -EINVAL; | 3373 | void __iomem *reloc_page; |
3376 | break; | ||
3377 | } | ||
3378 | if (reloc.offset & 3) { | ||
3379 | DRM_ERROR("Relocation not 4-byte aligned: " | ||
3380 | "obj %p target %d offset %d.\n", | ||
3381 | obj, reloc.target_handle, | ||
3382 | (int) reloc.offset); | ||
3383 | ret = -EINVAL; | ||
3384 | break; | ||
3385 | } | ||
3386 | 3374 | ||
3387 | /* and points to somewhere within the target object. */ | 3375 | ret = i915_gem_object_set_to_gtt_domain(&obj->base, 1); |
3388 | if (reloc.delta >= target_obj->size) { | 3376 | if (ret) |
3389 | DRM_ERROR("Relocation beyond target object bounds: " | 3377 | goto err; |
3390 | "obj %p target %d delta %d size %d.\n", | ||
3391 | obj, reloc.target_handle, | ||
3392 | (int) reloc.delta, (int) target_obj->size); | ||
3393 | ret = -EINVAL; | ||
3394 | break; | ||
3395 | } | ||
3396 | 3378 | ||
3397 | reloc.delta += target_offset; | 3379 | /* Map the page containing the relocation we're going to perform. */ |
3398 | if (obj->base.write_domain == I915_GEM_DOMAIN_CPU) { | 3380 | reloc->offset += obj->gtt_offset; |
3399 | uint32_t page_offset = reloc.offset & ~PAGE_MASK; | 3381 | reloc_page = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, |
3400 | char *vaddr; | 3382 | reloc->offset & PAGE_MASK); |
3383 | reloc_entry = (uint32_t __iomem *) | ||
3384 | (reloc_page + (reloc->offset & ~PAGE_MASK)); | ||
3385 | iowrite32(reloc->delta, reloc_entry); | ||
3386 | io_mapping_unmap_atomic(reloc_page); | ||
3387 | } | ||
3401 | 3388 | ||
3402 | vaddr = kmap_atomic(obj->pages[reloc.offset >> PAGE_SHIFT]); | 3389 | /* and update the user's relocation entry */ |
3403 | *(uint32_t *)(vaddr + page_offset) = reloc.delta; | 3390 | reloc->presumed_offset = target_offset; |
3404 | kunmap_atomic(vaddr); | ||
3405 | } else { | ||
3406 | uint32_t __iomem *reloc_entry; | ||
3407 | void __iomem *reloc_page; | ||
3408 | 3391 | ||
3409 | ret = i915_gem_object_set_to_gtt_domain(&obj->base, 1); | 3392 | out: |
3410 | if (ret) | 3393 | ret = 0; |
3411 | break; | 3394 | err: |
3395 | drm_gem_object_unreference(target_obj); | ||
3396 | return ret; | ||
3397 | } | ||
3412 | 3398 | ||
3413 | /* Map the page containing the relocation we're going to perform. */ | 3399 | static int |
3414 | reloc.offset += obj->gtt_offset; | 3400 | i915_gem_execbuffer_relocate_object(struct drm_i915_gem_object *obj, |
3415 | reloc_page = io_mapping_map_atomic_wc(dev_priv->mm.gtt_mapping, | 3401 | struct drm_file *file_priv, |
3416 | reloc.offset & PAGE_MASK); | 3402 | struct drm_i915_gem_exec_object2 *entry) |
3417 | reloc_entry = (uint32_t __iomem *) | 3403 | { |
3418 | (reloc_page + (reloc.offset & ~PAGE_MASK)); | 3404 | struct drm_i915_gem_relocation_entry __user *user_relocs; |
3419 | iowrite32(reloc.delta, reloc_entry); | 3405 | int i, ret; |
3420 | io_mapping_unmap_atomic(reloc_page); | 3406 | |
3421 | } | 3407 | user_relocs = (void __user *)(uintptr_t)entry->relocs_ptr; |
3408 | for (i = 0; i < entry->relocation_count; i++) { | ||
3409 | struct drm_i915_gem_relocation_entry reloc; | ||
3410 | |||
3411 | if (__copy_from_user_inatomic(&reloc, | ||
3412 | user_relocs+i, | ||
3413 | sizeof(reloc))) | ||
3414 | return -EFAULT; | ||
3415 | |||
3416 | ret = i915_gem_execbuffer_relocate_entry(obj, file_priv, entry, &reloc); | ||
3417 | if (ret) | ||
3418 | return ret; | ||
3422 | 3419 | ||
3423 | /* and update the user's relocation entry */ | ||
3424 | reloc.presumed_offset = target_offset; | ||
3425 | if (__copy_to_user_inatomic(&user_relocs[i].presumed_offset, | 3420 | if (__copy_to_user_inatomic(&user_relocs[i].presumed_offset, |
3426 | &reloc.presumed_offset, | 3421 | &reloc.presumed_offset, |
3427 | sizeof(reloc.presumed_offset))) { | 3422 | sizeof(reloc.presumed_offset))) |
3428 | ret = -EFAULT; | 3423 | return -EFAULT; |
3429 | break; | ||
3430 | } | ||
3431 | } | 3424 | } |
3432 | 3425 | ||
3433 | drm_gem_object_unreference(target_obj); | 3426 | return 0; |
3434 | return ret; | 3427 | } |
3428 | |||
3429 | static int | ||
3430 | i915_gem_execbuffer_relocate_object_slow(struct drm_i915_gem_object *obj, | ||
3431 | struct drm_file *file_priv, | ||
3432 | struct drm_i915_gem_exec_object2 *entry, | ||
3433 | struct drm_i915_gem_relocation_entry *relocs) | ||
3434 | { | ||
3435 | int i, ret; | ||
3436 | |||
3437 | for (i = 0; i < entry->relocation_count; i++) { | ||
3438 | ret = i915_gem_execbuffer_relocate_entry(obj, file_priv, entry, &relocs[i]); | ||
3439 | if (ret) | ||
3440 | return ret; | ||
3441 | } | ||
3442 | |||
3443 | return 0; | ||
3435 | } | 3444 | } |
3436 | 3445 | ||
3437 | static int | 3446 | static int |
3438 | i915_gem_execbuffer_pin(struct drm_device *dev, | 3447 | i915_gem_execbuffer_relocate(struct drm_device *dev, |
3439 | struct drm_file *file, | 3448 | struct drm_file *file, |
3440 | struct drm_gem_object **object_list, | 3449 | struct drm_gem_object **object_list, |
3441 | struct drm_i915_gem_exec_object2 *exec_list, | 3450 | struct drm_i915_gem_exec_object2 *exec_list, |
3442 | int count) | 3451 | int count) |
3452 | { | ||
3453 | int i, ret; | ||
3454 | |||
3455 | for (i = 0; i < count; i++) { | ||
3456 | struct drm_i915_gem_object *obj = to_intel_bo(object_list[i]); | ||
3457 | obj->base.pending_read_domains = 0; | ||
3458 | obj->base.pending_write_domain = 0; | ||
3459 | ret = i915_gem_execbuffer_relocate_object(obj, file, | ||
3460 | &exec_list[i]); | ||
3461 | if (ret) | ||
3462 | return ret; | ||
3463 | } | ||
3464 | |||
3465 | return 0; | ||
3466 | } | ||
3467 | |||
3468 | static int | ||
3469 | i915_gem_execbuffer_reserve(struct drm_device *dev, | ||
3470 | struct drm_file *file, | ||
3471 | struct drm_gem_object **object_list, | ||
3472 | struct drm_i915_gem_exec_object2 *exec_list, | ||
3473 | int count) | ||
3443 | { | 3474 | { |
3444 | struct drm_i915_private *dev_priv = dev->dev_private; | 3475 | struct drm_i915_private *dev_priv = dev->dev_private; |
3445 | int ret, i, retry; | 3476 | int ret, i, retry; |
@@ -3502,6 +3533,87 @@ i915_gem_execbuffer_pin(struct drm_device *dev, | |||
3502 | } | 3533 | } |
3503 | 3534 | ||
3504 | static int | 3535 | static int |
3536 | i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | ||
3537 | struct drm_file *file, | ||
3538 | struct drm_gem_object **object_list, | ||
3539 | struct drm_i915_gem_exec_object2 *exec_list, | ||
3540 | int count) | ||
3541 | { | ||
3542 | struct drm_i915_gem_relocation_entry *reloc; | ||
3543 | int i, total, ret; | ||
3544 | |||
3545 | for (i = 0; i < count; i++) { | ||
3546 | struct drm_i915_gem_object *obj = to_intel_bo(object_list[i]); | ||
3547 | obj->in_execbuffer = false; | ||
3548 | } | ||
3549 | |||
3550 | mutex_unlock(&dev->struct_mutex); | ||
3551 | |||
3552 | total = 0; | ||
3553 | for (i = 0; i < count; i++) | ||
3554 | total += exec_list[i].relocation_count; | ||
3555 | |||
3556 | reloc = drm_malloc_ab(total, sizeof(*reloc)); | ||
3557 | if (reloc == NULL) { | ||
3558 | mutex_lock(&dev->struct_mutex); | ||
3559 | return -ENOMEM; | ||
3560 | } | ||
3561 | |||
3562 | total = 0; | ||
3563 | for (i = 0; i < count; i++) { | ||
3564 | struct drm_i915_gem_relocation_entry __user *user_relocs; | ||
3565 | |||
3566 | user_relocs = (void __user *)(uintptr_t)exec_list[i].relocs_ptr; | ||
3567 | |||
3568 | if (copy_from_user(reloc+total, user_relocs, | ||
3569 | exec_list[i].relocation_count * | ||
3570 | sizeof(*reloc))) { | ||
3571 | ret = -EFAULT; | ||
3572 | mutex_lock(&dev->struct_mutex); | ||
3573 | goto err; | ||
3574 | } | ||
3575 | |||
3576 | total += exec_list[i].relocation_count; | ||
3577 | } | ||
3578 | |||
3579 | ret = i915_mutex_lock_interruptible(dev); | ||
3580 | if (ret) { | ||
3581 | mutex_lock(&dev->struct_mutex); | ||
3582 | goto err; | ||
3583 | } | ||
3584 | |||
3585 | ret = i915_gem_execbuffer_reserve(dev, file, | ||
3586 | object_list, exec_list, | ||
3587 | count); | ||
3588 | if (ret) | ||
3589 | goto err; | ||
3590 | |||
3591 | total = 0; | ||
3592 | for (i = 0; i < count; i++) { | ||
3593 | struct drm_i915_gem_object *obj = to_intel_bo(object_list[i]); | ||
3594 | obj->base.pending_read_domains = 0; | ||
3595 | obj->base.pending_write_domain = 0; | ||
3596 | ret = i915_gem_execbuffer_relocate_object_slow(obj, file, | ||
3597 | &exec_list[i], | ||
3598 | reloc + total); | ||
3599 | if (ret) | ||
3600 | goto err; | ||
3601 | |||
3602 | total += exec_list[i].relocation_count; | ||
3603 | } | ||
3604 | |||
3605 | /* Leave the user relocations as are, this is the painfully slow path, | ||
3606 | * and we want to avoid the complication of dropping the lock whilst | ||
3607 | * having buffers reserved in the aperture and so causing spurious | ||
3608 | * ENOSPC for random operations. | ||
3609 | */ | ||
3610 | |||
3611 | err: | ||
3612 | drm_free_large(reloc); | ||
3613 | return ret; | ||
3614 | } | ||
3615 | |||
3616 | static int | ||
3505 | i915_gem_execbuffer_move_to_gpu(struct drm_device *dev, | 3617 | i915_gem_execbuffer_move_to_gpu(struct drm_device *dev, |
3506 | struct drm_file *file, | 3618 | struct drm_file *file, |
3507 | struct intel_ring_buffer *ring, | 3619 | struct intel_ring_buffer *ring, |
@@ -3630,8 +3742,15 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
3630 | 3742 | ||
3631 | for (i = 0; i < count; i++) { | 3743 | for (i = 0; i < count; i++) { |
3632 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; | 3744 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
3633 | size_t length = exec[i].relocation_count * sizeof(struct drm_i915_gem_relocation_entry); | 3745 | int length; /* limited by fault_in_pages_readable() */ |
3746 | |||
3747 | /* First check for malicious input causing overflow */ | ||
3748 | if (exec[i].relocation_count > | ||
3749 | INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) | ||
3750 | return -EINVAL; | ||
3634 | 3751 | ||
3752 | length = exec[i].relocation_count * | ||
3753 | sizeof(struct drm_i915_gem_relocation_entry); | ||
3635 | if (!access_ok(VERIFY_READ, ptr, length)) | 3754 | if (!access_ok(VERIFY_READ, ptr, length)) |
3636 | return -EFAULT; | 3755 | return -EFAULT; |
3637 | 3756 | ||
@@ -3774,18 +3893,24 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
3774 | } | 3893 | } |
3775 | 3894 | ||
3776 | /* Move the objects en-masse into the GTT, evicting if necessary. */ | 3895 | /* Move the objects en-masse into the GTT, evicting if necessary. */ |
3777 | ret = i915_gem_execbuffer_pin(dev, file, | 3896 | ret = i915_gem_execbuffer_reserve(dev, file, |
3778 | object_list, exec_list, | 3897 | object_list, exec_list, |
3779 | args->buffer_count); | 3898 | args->buffer_count); |
3780 | if (ret) | 3899 | if (ret) |
3781 | goto err; | 3900 | goto err; |
3782 | 3901 | ||
3783 | /* The objects are in their final locations, apply the relocations. */ | 3902 | /* The objects are in their final locations, apply the relocations. */ |
3784 | for (i = 0; i < args->buffer_count; i++) { | 3903 | ret = i915_gem_execbuffer_relocate(dev, file, |
3785 | struct drm_i915_gem_object *obj = to_intel_bo(object_list[i]); | 3904 | object_list, exec_list, |
3786 | obj->base.pending_read_domains = 0; | 3905 | args->buffer_count); |
3787 | obj->base.pending_write_domain = 0; | 3906 | if (ret) { |
3788 | ret = i915_gem_execbuffer_relocate(obj, file, &exec_list[i]); | 3907 | if (ret == -EFAULT) { |
3908 | ret = i915_gem_execbuffer_relocate_slow(dev, file, | ||
3909 | object_list, | ||
3910 | exec_list, | ||
3911 | args->buffer_count); | ||
3912 | BUG_ON(!mutex_is_locked(&dev->struct_mutex)); | ||
3913 | } | ||
3789 | if (ret) | 3914 | if (ret) |
3790 | goto err; | 3915 | goto err; |
3791 | } | 3916 | } |
@@ -4249,10 +4374,20 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
4249 | * use this buffer rather sooner than later, so issuing the required | 4374 | * use this buffer rather sooner than later, so issuing the required |
4250 | * flush earlier is beneficial. | 4375 | * flush earlier is beneficial. |
4251 | */ | 4376 | */ |
4252 | if (obj->write_domain & I915_GEM_GPU_DOMAINS) | 4377 | if (obj->write_domain & I915_GEM_GPU_DOMAINS) { |
4253 | i915_gem_flush_ring(dev, file_priv, | 4378 | i915_gem_flush_ring(dev, file_priv, |
4254 | obj_priv->ring, | 4379 | obj_priv->ring, |
4255 | 0, obj->write_domain); | 4380 | 0, obj->write_domain); |
4381 | } else if (obj_priv->ring->outstanding_lazy_request) { | ||
4382 | /* This ring is not being cleared by active usage, | ||
4383 | * so emit a request to do so. | ||
4384 | */ | ||
4385 | u32 seqno = i915_add_request(dev, | ||
4386 | NULL, NULL, | ||
4387 | obj_priv->ring); | ||
4388 | if (seqno == 0) | ||
4389 | ret = -ENOMEM; | ||
4390 | } | ||
4256 | 4391 | ||
4257 | /* Update the active list for the hardware's current position. | 4392 | /* Update the active list for the hardware's current position. |
4258 | * Otherwise this only updates on a delayed timer or when irqs | 4393 | * Otherwise this only updates on a delayed timer or when irqs |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 25ed911a3112..878fc766a12c 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3033,6 +3033,7 @@ | |||
3033 | #define TRANS_DP_10BPC (1<<9) | 3033 | #define TRANS_DP_10BPC (1<<9) |
3034 | #define TRANS_DP_6BPC (2<<9) | 3034 | #define TRANS_DP_6BPC (2<<9) |
3035 | #define TRANS_DP_12BPC (3<<9) | 3035 | #define TRANS_DP_12BPC (3<<9) |
3036 | #define TRANS_DP_BPC_MASK (3<<9) | ||
3036 | #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) | 3037 | #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) |
3037 | #define TRANS_DP_VSYNC_ACTIVE_LOW 0 | 3038 | #define TRANS_DP_VSYNC_ACTIVE_LOW 0 |
3038 | #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) | 3039 | #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 454c064f8ef7..42729d25da58 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -239,6 +239,16 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
239 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 239 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
240 | return; | 240 | return; |
241 | 241 | ||
242 | /* Cursor state */ | ||
243 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); | ||
244 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); | ||
245 | dev_priv->saveCURABASE = I915_READ(CURABASE); | ||
246 | dev_priv->saveCURBCNTR = I915_READ(CURBCNTR); | ||
247 | dev_priv->saveCURBPOS = I915_READ(CURBPOS); | ||
248 | dev_priv->saveCURBBASE = I915_READ(CURBBASE); | ||
249 | if (IS_GEN2(dev)) | ||
250 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); | ||
251 | |||
242 | if (HAS_PCH_SPLIT(dev)) { | 252 | if (HAS_PCH_SPLIT(dev)) { |
243 | dev_priv->savePCH_DREF_CONTROL = I915_READ(PCH_DREF_CONTROL); | 253 | dev_priv->savePCH_DREF_CONTROL = I915_READ(PCH_DREF_CONTROL); |
244 | dev_priv->saveDISP_ARB_CTL = I915_READ(DISP_ARB_CTL); | 254 | dev_priv->saveDISP_ARB_CTL = I915_READ(DISP_ARB_CTL); |
@@ -529,6 +539,16 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
529 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | 539 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); |
530 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | 540 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); |
531 | 541 | ||
542 | /* Cursor state */ | ||
543 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); | ||
544 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); | ||
545 | I915_WRITE(CURABASE, dev_priv->saveCURABASE); | ||
546 | I915_WRITE(CURBPOS, dev_priv->saveCURBPOS); | ||
547 | I915_WRITE(CURBCNTR, dev_priv->saveCURBCNTR); | ||
548 | I915_WRITE(CURBBASE, dev_priv->saveCURBBASE); | ||
549 | if (IS_GEN2(dev)) | ||
550 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); | ||
551 | |||
532 | return; | 552 | return; |
533 | } | 553 | } |
534 | 554 | ||
@@ -543,16 +563,6 @@ void i915_save_display(struct drm_device *dev) | |||
543 | /* Don't save them in KMS mode */ | 563 | /* Don't save them in KMS mode */ |
544 | i915_save_modeset_reg(dev); | 564 | i915_save_modeset_reg(dev); |
545 | 565 | ||
546 | /* Cursor state */ | ||
547 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); | ||
548 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); | ||
549 | dev_priv->saveCURABASE = I915_READ(CURABASE); | ||
550 | dev_priv->saveCURBCNTR = I915_READ(CURBCNTR); | ||
551 | dev_priv->saveCURBPOS = I915_READ(CURBPOS); | ||
552 | dev_priv->saveCURBBASE = I915_READ(CURBBASE); | ||
553 | if (IS_GEN2(dev)) | ||
554 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); | ||
555 | |||
556 | /* CRT state */ | 566 | /* CRT state */ |
557 | if (HAS_PCH_SPLIT(dev)) { | 567 | if (HAS_PCH_SPLIT(dev)) { |
558 | dev_priv->saveADPA = I915_READ(PCH_ADPA); | 568 | dev_priv->saveADPA = I915_READ(PCH_ADPA); |
@@ -657,16 +667,6 @@ void i915_restore_display(struct drm_device *dev) | |||
657 | /* Don't restore them in KMS mode */ | 667 | /* Don't restore them in KMS mode */ |
658 | i915_restore_modeset_reg(dev); | 668 | i915_restore_modeset_reg(dev); |
659 | 669 | ||
660 | /* Cursor state */ | ||
661 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); | ||
662 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); | ||
663 | I915_WRITE(CURABASE, dev_priv->saveCURABASE); | ||
664 | I915_WRITE(CURBPOS, dev_priv->saveCURBPOS); | ||
665 | I915_WRITE(CURBCNTR, dev_priv->saveCURBCNTR); | ||
666 | I915_WRITE(CURBBASE, dev_priv->saveCURBBASE); | ||
667 | if (IS_GEN2(dev)) | ||
668 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); | ||
669 | |||
670 | /* CRT state */ | 670 | /* CRT state */ |
671 | if (HAS_PCH_SPLIT(dev)) | 671 | if (HAS_PCH_SPLIT(dev)) |
672 | I915_WRITE(PCH_ADPA, dev_priv->saveADPA); | 672 | I915_WRITE(PCH_ADPA, dev_priv->saveADPA); |
diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c index 65c88f9ba12c..2cb8e0b9f1ee 100644 --- a/drivers/gpu/drm/i915/intel_acpi.c +++ b/drivers/gpu/drm/i915/intel_acpi.c | |||
@@ -190,37 +190,6 @@ out: | |||
190 | kfree(output.pointer); | 190 | kfree(output.pointer); |
191 | } | 191 | } |
192 | 192 | ||
193 | static int intel_dsm_switchto(enum vga_switcheroo_client_id id) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static int intel_dsm_power_state(enum vga_switcheroo_client_id id, | ||
199 | enum vga_switcheroo_state state) | ||
200 | { | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int intel_dsm_init(void) | ||
205 | { | ||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | static int intel_dsm_get_client_id(struct pci_dev *pdev) | ||
210 | { | ||
211 | if (intel_dsm_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) | ||
212 | return VGA_SWITCHEROO_IGD; | ||
213 | else | ||
214 | return VGA_SWITCHEROO_DIS; | ||
215 | } | ||
216 | |||
217 | static struct vga_switcheroo_handler intel_dsm_handler = { | ||
218 | .switchto = intel_dsm_switchto, | ||
219 | .power_state = intel_dsm_power_state, | ||
220 | .init = intel_dsm_init, | ||
221 | .get_client_id = intel_dsm_get_client_id, | ||
222 | }; | ||
223 | |||
224 | static bool intel_dsm_pci_probe(struct pci_dev *pdev) | 193 | static bool intel_dsm_pci_probe(struct pci_dev *pdev) |
225 | { | 194 | { |
226 | acpi_handle dhandle, intel_handle; | 195 | acpi_handle dhandle, intel_handle; |
@@ -276,11 +245,8 @@ void intel_register_dsm_handler(void) | |||
276 | { | 245 | { |
277 | if (!intel_dsm_detect()) | 246 | if (!intel_dsm_detect()) |
278 | return; | 247 | return; |
279 | |||
280 | vga_switcheroo_register_handler(&intel_dsm_handler); | ||
281 | } | 248 | } |
282 | 249 | ||
283 | void intel_unregister_dsm_handler(void) | 250 | void intel_unregister_dsm_handler(void) |
284 | { | 251 | { |
285 | vga_switcheroo_unregister_handler(); | ||
286 | } | 252 | } |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index b0b1200ed650..2b2078695d2a 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -270,7 +270,7 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
270 | general->ssc_freq ? 66 : 48; | 270 | general->ssc_freq ? 66 : 48; |
271 | else if (IS_GEN5(dev) || IS_GEN6(dev)) | 271 | else if (IS_GEN5(dev) || IS_GEN6(dev)) |
272 | dev_priv->lvds_ssc_freq = | 272 | dev_priv->lvds_ssc_freq = |
273 | general->ssc_freq ? 100 : 120; | 273 | general->ssc_freq ? 120 : 100; |
274 | else | 274 | else |
275 | dev_priv->lvds_ssc_freq = | 275 | dev_priv->lvds_ssc_freq = |
276 | general->ssc_freq ? 100 : 96; | 276 | general->ssc_freq ? 100 : 96; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bee24b1a58e8..d9b7092439ef 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2120,9 +2120,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2120 | reg = TRANS_DP_CTL(pipe); | 2120 | reg = TRANS_DP_CTL(pipe); |
2121 | temp = I915_READ(reg); | 2121 | temp = I915_READ(reg); |
2122 | temp &= ~(TRANS_DP_PORT_SEL_MASK | | 2122 | temp &= ~(TRANS_DP_PORT_SEL_MASK | |
2123 | TRANS_DP_SYNC_MASK); | 2123 | TRANS_DP_SYNC_MASK | |
2124 | TRANS_DP_BPC_MASK); | ||
2124 | temp |= (TRANS_DP_OUTPUT_ENABLE | | 2125 | temp |= (TRANS_DP_OUTPUT_ENABLE | |
2125 | TRANS_DP_ENH_FRAMING); | 2126 | TRANS_DP_ENH_FRAMING); |
2127 | temp |= TRANS_DP_8BPC; | ||
2126 | 2128 | ||
2127 | if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) | 2129 | if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) |
2128 | temp |= TRANS_DP_HSYNC_ACTIVE_HIGH; | 2130 | temp |= TRANS_DP_HSYNC_ACTIVE_HIGH; |
@@ -2712,27 +2714,19 @@ fdi_reduce_ratio(u32 *num, u32 *den) | |||
2712 | } | 2714 | } |
2713 | } | 2715 | } |
2714 | 2716 | ||
2715 | #define DATA_N 0x800000 | ||
2716 | #define LINK_N 0x80000 | ||
2717 | |||
2718 | static void | 2717 | static void |
2719 | ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock, | 2718 | ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock, |
2720 | int link_clock, struct fdi_m_n *m_n) | 2719 | int link_clock, struct fdi_m_n *m_n) |
2721 | { | 2720 | { |
2722 | u64 temp; | ||
2723 | |||
2724 | m_n->tu = 64; /* default size */ | 2721 | m_n->tu = 64; /* default size */ |
2725 | 2722 | ||
2726 | temp = (u64) DATA_N * pixel_clock; | 2723 | /* BUG_ON(pixel_clock > INT_MAX / 36); */ |
2727 | temp = div_u64(temp, link_clock); | 2724 | m_n->gmch_m = bits_per_pixel * pixel_clock; |
2728 | m_n->gmch_m = div_u64(temp * bits_per_pixel, nlanes); | 2725 | m_n->gmch_n = link_clock * nlanes * 8; |
2729 | m_n->gmch_m >>= 3; /* convert to bytes_per_pixel */ | ||
2730 | m_n->gmch_n = DATA_N; | ||
2731 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); | 2726 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); |
2732 | 2727 | ||
2733 | temp = (u64) LINK_N * pixel_clock; | 2728 | m_n->link_m = pixel_clock; |
2734 | m_n->link_m = div_u64(temp, link_clock); | 2729 | m_n->link_n = link_clock; |
2735 | m_n->link_n = LINK_N; | ||
2736 | fdi_reduce_ratio(&m_n->link_m, &m_n->link_n); | 2730 | fdi_reduce_ratio(&m_n->link_m, &m_n->link_n); |
2737 | } | 2731 | } |
2738 | 2732 | ||
@@ -3716,6 +3710,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3716 | 3710 | ||
3717 | /* FDI link */ | 3711 | /* FDI link */ |
3718 | if (HAS_PCH_SPLIT(dev)) { | 3712 | if (HAS_PCH_SPLIT(dev)) { |
3713 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); | ||
3719 | int lane = 0, link_bw, bpp; | 3714 | int lane = 0, link_bw, bpp; |
3720 | /* CPU eDP doesn't require FDI link, so just set DP M/N | 3715 | /* CPU eDP doesn't require FDI link, so just set DP M/N |
3721 | according to current link config */ | 3716 | according to current link config */ |
@@ -3799,6 +3794,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3799 | 3794 | ||
3800 | intel_crtc->fdi_lanes = lane; | 3795 | intel_crtc->fdi_lanes = lane; |
3801 | 3796 | ||
3797 | if (pixel_multiplier > 1) | ||
3798 | link_bw *= pixel_multiplier; | ||
3802 | ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n); | 3799 | ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n); |
3803 | } | 3800 | } |
3804 | 3801 | ||
@@ -5236,6 +5233,55 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { | |||
5236 | .page_flip = intel_crtc_page_flip, | 5233 | .page_flip = intel_crtc_page_flip, |
5237 | }; | 5234 | }; |
5238 | 5235 | ||
5236 | static void intel_sanitize_modesetting(struct drm_device *dev, | ||
5237 | int pipe, int plane) | ||
5238 | { | ||
5239 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5240 | u32 reg, val; | ||
5241 | |||
5242 | if (HAS_PCH_SPLIT(dev)) | ||
5243 | return; | ||
5244 | |||
5245 | /* Who knows what state these registers were left in by the BIOS or | ||
5246 | * grub? | ||
5247 | * | ||
5248 | * If we leave the registers in a conflicting state (e.g. with the | ||
5249 | * display plane reading from the other pipe than the one we intend | ||
5250 | * to use) then when we attempt to teardown the active mode, we will | ||
5251 | * not disable the pipes and planes in the correct order -- leaving | ||
5252 | * a plane reading from a disabled pipe and possibly leading to | ||
5253 | * undefined behaviour. | ||
5254 | */ | ||
5255 | |||
5256 | reg = DSPCNTR(plane); | ||
5257 | val = I915_READ(reg); | ||
5258 | |||
5259 | if ((val & DISPLAY_PLANE_ENABLE) == 0) | ||
5260 | return; | ||
5261 | if (!!(val & DISPPLANE_SEL_PIPE_MASK) == pipe) | ||
5262 | return; | ||
5263 | |||
5264 | /* This display plane is active and attached to the other CPU pipe. */ | ||
5265 | pipe = !pipe; | ||
5266 | |||
5267 | /* Disable the plane and wait for it to stop reading from the pipe. */ | ||
5268 | I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE); | ||
5269 | intel_flush_display_plane(dev, plane); | ||
5270 | |||
5271 | if (IS_GEN2(dev)) | ||
5272 | intel_wait_for_vblank(dev, pipe); | ||
5273 | |||
5274 | if (pipe == 0 && (dev_priv->quirks & QUIRK_PIPEA_FORCE)) | ||
5275 | return; | ||
5276 | |||
5277 | /* Switch off the pipe. */ | ||
5278 | reg = PIPECONF(pipe); | ||
5279 | val = I915_READ(reg); | ||
5280 | if (val & PIPECONF_ENABLE) { | ||
5281 | I915_WRITE(reg, val & ~PIPECONF_ENABLE); | ||
5282 | intel_wait_for_pipe_off(dev, pipe); | ||
5283 | } | ||
5284 | } | ||
5239 | 5285 | ||
5240 | static void intel_crtc_init(struct drm_device *dev, int pipe) | 5286 | static void intel_crtc_init(struct drm_device *dev, int pipe) |
5241 | { | 5287 | { |
@@ -5287,6 +5333,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
5287 | 5333 | ||
5288 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, | 5334 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, |
5289 | (unsigned long)intel_crtc); | 5335 | (unsigned long)intel_crtc); |
5336 | |||
5337 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
5290 | } | 5338 | } |
5291 | 5339 | ||
5292 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 5340 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
@@ -5336,9 +5384,14 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
5336 | struct drm_i915_private *dev_priv = dev->dev_private; | 5384 | struct drm_i915_private *dev_priv = dev->dev_private; |
5337 | struct intel_encoder *encoder; | 5385 | struct intel_encoder *encoder; |
5338 | bool dpd_is_edp = false; | 5386 | bool dpd_is_edp = false; |
5387 | bool has_lvds = false; | ||
5339 | 5388 | ||
5340 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 5389 | if (IS_MOBILE(dev) && !IS_I830(dev)) |
5341 | intel_lvds_init(dev); | 5390 | has_lvds = intel_lvds_init(dev); |
5391 | if (!has_lvds && !HAS_PCH_SPLIT(dev)) { | ||
5392 | /* disable the panel fitter on everything but LVDS */ | ||
5393 | I915_WRITE(PFIT_CONTROL, 0); | ||
5394 | } | ||
5342 | 5395 | ||
5343 | if (HAS_PCH_SPLIT(dev)) { | 5396 | if (HAS_PCH_SPLIT(dev)) { |
5344 | dpd_is_edp = intel_dpd_is_edp(dev); | 5397 | dpd_is_edp = intel_dpd_is_edp(dev); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c8e005553310..864417cffe9a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -479,6 +479,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | |||
479 | uint16_t address = algo_data->address; | 479 | uint16_t address = algo_data->address; |
480 | uint8_t msg[5]; | 480 | uint8_t msg[5]; |
481 | uint8_t reply[2]; | 481 | uint8_t reply[2]; |
482 | unsigned retry; | ||
482 | int msg_bytes; | 483 | int msg_bytes; |
483 | int reply_bytes; | 484 | int reply_bytes; |
484 | int ret; | 485 | int ret; |
@@ -513,14 +514,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | |||
513 | break; | 514 | break; |
514 | } | 515 | } |
515 | 516 | ||
516 | for (;;) { | 517 | for (retry = 0; retry < 5; retry++) { |
517 | ret = intel_dp_aux_ch(intel_dp, | 518 | ret = intel_dp_aux_ch(intel_dp, |
518 | msg, msg_bytes, | 519 | msg, msg_bytes, |
519 | reply, reply_bytes); | 520 | reply, reply_bytes); |
520 | if (ret < 0) { | 521 | if (ret < 0) { |
521 | DRM_DEBUG_KMS("aux_ch failed %d\n", ret); | 522 | DRM_DEBUG_KMS("aux_ch failed %d\n", ret); |
522 | return ret; | 523 | return ret; |
523 | } | 524 | } |
525 | |||
526 | switch (reply[0] & AUX_NATIVE_REPLY_MASK) { | ||
527 | case AUX_NATIVE_REPLY_ACK: | ||
528 | /* I2C-over-AUX Reply field is only valid | ||
529 | * when paired with AUX ACK. | ||
530 | */ | ||
531 | break; | ||
532 | case AUX_NATIVE_REPLY_NACK: | ||
533 | DRM_DEBUG_KMS("aux_ch native nack\n"); | ||
534 | return -EREMOTEIO; | ||
535 | case AUX_NATIVE_REPLY_DEFER: | ||
536 | udelay(100); | ||
537 | continue; | ||
538 | default: | ||
539 | DRM_ERROR("aux_ch invalid native reply 0x%02x\n", | ||
540 | reply[0]); | ||
541 | return -EREMOTEIO; | ||
542 | } | ||
543 | |||
524 | switch (reply[0] & AUX_I2C_REPLY_MASK) { | 544 | switch (reply[0] & AUX_I2C_REPLY_MASK) { |
525 | case AUX_I2C_REPLY_ACK: | 545 | case AUX_I2C_REPLY_ACK: |
526 | if (mode == MODE_I2C_READ) { | 546 | if (mode == MODE_I2C_READ) { |
@@ -528,17 +548,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | |||
528 | } | 548 | } |
529 | return reply_bytes - 1; | 549 | return reply_bytes - 1; |
530 | case AUX_I2C_REPLY_NACK: | 550 | case AUX_I2C_REPLY_NACK: |
531 | DRM_DEBUG_KMS("aux_ch nack\n"); | 551 | DRM_DEBUG_KMS("aux_i2c nack\n"); |
532 | return -EREMOTEIO; | 552 | return -EREMOTEIO; |
533 | case AUX_I2C_REPLY_DEFER: | 553 | case AUX_I2C_REPLY_DEFER: |
534 | DRM_DEBUG_KMS("aux_ch defer\n"); | 554 | DRM_DEBUG_KMS("aux_i2c defer\n"); |
535 | udelay(100); | 555 | udelay(100); |
536 | break; | 556 | break; |
537 | default: | 557 | default: |
538 | DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); | 558 | DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]); |
539 | return -EREMOTEIO; | 559 | return -EREMOTEIO; |
540 | } | 560 | } |
541 | } | 561 | } |
562 | |||
563 | DRM_ERROR("too many retries, giving up\n"); | ||
564 | return -EREMOTEIO; | ||
542 | } | 565 | } |
543 | 566 | ||
544 | static int | 567 | static int |
@@ -584,17 +607,6 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
584 | mode->clock = dev_priv->panel_fixed_mode->clock; | 607 | mode->clock = dev_priv->panel_fixed_mode->clock; |
585 | } | 608 | } |
586 | 609 | ||
587 | /* Just use VBT values for eDP */ | ||
588 | if (is_edp(intel_dp)) { | ||
589 | intel_dp->lane_count = dev_priv->edp.lanes; | ||
590 | intel_dp->link_bw = dev_priv->edp.rate; | ||
591 | adjusted_mode->clock = intel_dp_link_clock(intel_dp->link_bw); | ||
592 | DRM_DEBUG_KMS("eDP link bw %02x lane count %d clock %d\n", | ||
593 | intel_dp->link_bw, intel_dp->lane_count, | ||
594 | adjusted_mode->clock); | ||
595 | return true; | ||
596 | } | ||
597 | |||
598 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { | 610 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { |
599 | for (clock = 0; clock <= max_clock; clock++) { | 611 | for (clock = 0; clock <= max_clock; clock++) { |
600 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 612 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
@@ -613,6 +625,19 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
613 | } | 625 | } |
614 | } | 626 | } |
615 | 627 | ||
628 | if (is_edp(intel_dp)) { | ||
629 | /* okay we failed just pick the highest */ | ||
630 | intel_dp->lane_count = max_lane_count; | ||
631 | intel_dp->link_bw = bws[max_clock]; | ||
632 | adjusted_mode->clock = intel_dp_link_clock(intel_dp->link_bw); | ||
633 | DRM_DEBUG_KMS("Force picking display port link bw %02x lane " | ||
634 | "count %d clock %d\n", | ||
635 | intel_dp->link_bw, intel_dp->lane_count, | ||
636 | adjusted_mode->clock); | ||
637 | |||
638 | return true; | ||
639 | } | ||
640 | |||
616 | return false; | 641 | return false; |
617 | } | 642 | } |
618 | 643 | ||
@@ -1087,21 +1112,11 @@ intel_get_adjust_train(struct intel_dp *intel_dp) | |||
1087 | } | 1112 | } |
1088 | 1113 | ||
1089 | static uint32_t | 1114 | static uint32_t |
1090 | intel_dp_signal_levels(struct intel_dp *intel_dp) | 1115 | intel_dp_signal_levels(uint8_t train_set, int lane_count) |
1091 | { | 1116 | { |
1092 | struct drm_device *dev = intel_dp->base.base.dev; | 1117 | uint32_t signal_levels = 0; |
1093 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1094 | uint32_t signal_levels = 0; | ||
1095 | u8 train_set = intel_dp->train_set[0]; | ||
1096 | u32 vswing = train_set & DP_TRAIN_VOLTAGE_SWING_MASK; | ||
1097 | u32 preemphasis = train_set & DP_TRAIN_PRE_EMPHASIS_MASK; | ||
1098 | 1118 | ||
1099 | if (is_edp(intel_dp)) { | 1119 | switch (train_set & DP_TRAIN_VOLTAGE_SWING_MASK) { |
1100 | vswing = dev_priv->edp.vswing; | ||
1101 | preemphasis = dev_priv->edp.preemphasis; | ||
1102 | } | ||
1103 | |||
1104 | switch (vswing) { | ||
1105 | case DP_TRAIN_VOLTAGE_SWING_400: | 1120 | case DP_TRAIN_VOLTAGE_SWING_400: |
1106 | default: | 1121 | default: |
1107 | signal_levels |= DP_VOLTAGE_0_4; | 1122 | signal_levels |= DP_VOLTAGE_0_4; |
@@ -1116,7 +1131,7 @@ intel_dp_signal_levels(struct intel_dp *intel_dp) | |||
1116 | signal_levels |= DP_VOLTAGE_1_2; | 1131 | signal_levels |= DP_VOLTAGE_1_2; |
1117 | break; | 1132 | break; |
1118 | } | 1133 | } |
1119 | switch (preemphasis) { | 1134 | switch (train_set & DP_TRAIN_PRE_EMPHASIS_MASK) { |
1120 | case DP_TRAIN_PRE_EMPHASIS_0: | 1135 | case DP_TRAIN_PRE_EMPHASIS_0: |
1121 | default: | 1136 | default: |
1122 | signal_levels |= DP_PRE_EMPHASIS_0; | 1137 | signal_levels |= DP_PRE_EMPHASIS_0; |
@@ -1203,18 +1218,6 @@ intel_channel_eq_ok(struct intel_dp *intel_dp) | |||
1203 | } | 1218 | } |
1204 | 1219 | ||
1205 | static bool | 1220 | static bool |
1206 | intel_dp_aux_handshake_required(struct intel_dp *intel_dp) | ||
1207 | { | ||
1208 | struct drm_device *dev = intel_dp->base.base.dev; | ||
1209 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1210 | |||
1211 | if (is_edp(intel_dp) && dev_priv->no_aux_handshake) | ||
1212 | return false; | ||
1213 | |||
1214 | return true; | ||
1215 | } | ||
1216 | |||
1217 | static bool | ||
1218 | intel_dp_set_link_train(struct intel_dp *intel_dp, | 1221 | intel_dp_set_link_train(struct intel_dp *intel_dp, |
1219 | uint32_t dp_reg_value, | 1222 | uint32_t dp_reg_value, |
1220 | uint8_t dp_train_pat) | 1223 | uint8_t dp_train_pat) |
@@ -1226,9 +1229,6 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
1226 | I915_WRITE(intel_dp->output_reg, dp_reg_value); | 1229 | I915_WRITE(intel_dp->output_reg, dp_reg_value); |
1227 | POSTING_READ(intel_dp->output_reg); | 1230 | POSTING_READ(intel_dp->output_reg); |
1228 | 1231 | ||
1229 | if (!intel_dp_aux_handshake_required(intel_dp)) | ||
1230 | return true; | ||
1231 | |||
1232 | intel_dp_aux_native_write_1(intel_dp, | 1232 | intel_dp_aux_native_write_1(intel_dp, |
1233 | DP_TRAINING_PATTERN_SET, | 1233 | DP_TRAINING_PATTERN_SET, |
1234 | dp_train_pat); | 1234 | dp_train_pat); |
@@ -1261,11 +1261,10 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1261 | POSTING_READ(intel_dp->output_reg); | 1261 | POSTING_READ(intel_dp->output_reg); |
1262 | intel_wait_for_vblank(dev, intel_crtc->pipe); | 1262 | intel_wait_for_vblank(dev, intel_crtc->pipe); |
1263 | 1263 | ||
1264 | if (intel_dp_aux_handshake_required(intel_dp)) | 1264 | /* Write the link configuration data */ |
1265 | /* Write the link configuration data */ | 1265 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, |
1266 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, | 1266 | intel_dp->link_configuration, |
1267 | intel_dp->link_configuration, | 1267 | DP_LINK_CONFIGURATION_SIZE); |
1268 | DP_LINK_CONFIGURATION_SIZE); | ||
1269 | 1268 | ||
1270 | DP |= DP_PORT_EN; | 1269 | DP |= DP_PORT_EN; |
1271 | if (HAS_PCH_CPT(dev) && !is_edp(intel_dp)) | 1270 | if (HAS_PCH_CPT(dev) && !is_edp(intel_dp)) |
@@ -1283,7 +1282,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1283 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1282 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1284 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1283 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1285 | } else { | 1284 | } else { |
1286 | signal_levels = intel_dp_signal_levels(intel_dp); | 1285 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0], intel_dp->lane_count); |
1287 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1286 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1288 | } | 1287 | } |
1289 | 1288 | ||
@@ -1297,37 +1296,33 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1297 | break; | 1296 | break; |
1298 | /* Set training pattern 1 */ | 1297 | /* Set training pattern 1 */ |
1299 | 1298 | ||
1300 | udelay(500); | 1299 | udelay(100); |
1301 | if (intel_dp_aux_handshake_required(intel_dp)) { | 1300 | if (!intel_dp_get_link_status(intel_dp)) |
1302 | break; | 1301 | break; |
1303 | } else { | ||
1304 | if (!intel_dp_get_link_status(intel_dp)) | ||
1305 | break; | ||
1306 | 1302 | ||
1307 | if (intel_clock_recovery_ok(intel_dp->link_status, intel_dp->lane_count)) { | 1303 | if (intel_clock_recovery_ok(intel_dp->link_status, intel_dp->lane_count)) { |
1308 | clock_recovery = true; | 1304 | clock_recovery = true; |
1309 | break; | 1305 | break; |
1310 | } | 1306 | } |
1311 | 1307 | ||
1312 | /* Check to see if we've tried the max voltage */ | 1308 | /* Check to see if we've tried the max voltage */ |
1313 | for (i = 0; i < intel_dp->lane_count; i++) | 1309 | for (i = 0; i < intel_dp->lane_count; i++) |
1314 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1310 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1315 | break; | ||
1316 | if (i == intel_dp->lane_count) | ||
1317 | break; | 1311 | break; |
1312 | if (i == intel_dp->lane_count) | ||
1313 | break; | ||
1318 | 1314 | ||
1319 | /* Check to see if we've tried the same voltage 5 times */ | 1315 | /* Check to see if we've tried the same voltage 5 times */ |
1320 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) { | 1316 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) { |
1321 | ++tries; | 1317 | ++tries; |
1322 | if (tries == 5) | 1318 | if (tries == 5) |
1323 | break; | 1319 | break; |
1324 | } else | 1320 | } else |
1325 | tries = 0; | 1321 | tries = 0; |
1326 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; | 1322 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; |
1327 | 1323 | ||
1328 | /* Compute new intel_dp->train_set as requested by target */ | 1324 | /* Compute new intel_dp->train_set as requested by target */ |
1329 | intel_get_adjust_train(intel_dp); | 1325 | intel_get_adjust_train(intel_dp); |
1330 | } | ||
1331 | } | 1326 | } |
1332 | 1327 | ||
1333 | intel_dp->DP = DP; | 1328 | intel_dp->DP = DP; |
@@ -1354,7 +1349,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1354 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1349 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
1355 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1350 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
1356 | } else { | 1351 | } else { |
1357 | signal_levels = intel_dp_signal_levels(intel_dp); | 1352 | signal_levels = intel_dp_signal_levels(intel_dp->train_set[0], intel_dp->lane_count); |
1358 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1353 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
1359 | } | 1354 | } |
1360 | 1355 | ||
@@ -1368,28 +1363,24 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1368 | DP_TRAINING_PATTERN_2)) | 1363 | DP_TRAINING_PATTERN_2)) |
1369 | break; | 1364 | break; |
1370 | 1365 | ||
1371 | udelay(500); | 1366 | udelay(400); |
1372 | 1367 | if (!intel_dp_get_link_status(intel_dp)) | |
1373 | if (!intel_dp_aux_handshake_required(intel_dp)) { | ||
1374 | break; | 1368 | break; |
1375 | } else { | ||
1376 | if (!intel_dp_get_link_status(intel_dp)) | ||
1377 | break; | ||
1378 | 1369 | ||
1379 | if (intel_channel_eq_ok(intel_dp)) { | 1370 | if (intel_channel_eq_ok(intel_dp)) { |
1380 | channel_eq = true; | 1371 | channel_eq = true; |
1381 | break; | 1372 | break; |
1382 | } | 1373 | } |
1383 | 1374 | ||
1384 | /* Try 5 times */ | 1375 | /* Try 5 times */ |
1385 | if (tries > 5) | 1376 | if (tries > 5) |
1386 | break; | 1377 | break; |
1387 | 1378 | ||
1388 | /* Compute new intel_dp->train_set as requested by target */ | 1379 | /* Compute new intel_dp->train_set as requested by target */ |
1389 | intel_get_adjust_train(intel_dp); | 1380 | intel_get_adjust_train(intel_dp); |
1390 | ++tries; | 1381 | ++tries; |
1391 | } | ||
1392 | } | 1382 | } |
1383 | |||
1393 | if (HAS_PCH_CPT(dev) && !is_edp(intel_dp)) | 1384 | if (HAS_PCH_CPT(dev) && !is_edp(intel_dp)) |
1394 | reg = DP | DP_LINK_TRAIN_OFF_CPT; | 1385 | reg = DP | DP_LINK_TRAIN_OFF_CPT; |
1395 | else | 1386 | else |
@@ -1408,6 +1399,9 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1408 | struct drm_i915_private *dev_priv = dev->dev_private; | 1399 | struct drm_i915_private *dev_priv = dev->dev_private; |
1409 | uint32_t DP = intel_dp->DP; | 1400 | uint32_t DP = intel_dp->DP; |
1410 | 1401 | ||
1402 | if ((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0) | ||
1403 | return; | ||
1404 | |||
1411 | DRM_DEBUG_KMS("\n"); | 1405 | DRM_DEBUG_KMS("\n"); |
1412 | 1406 | ||
1413 | if (is_edp(intel_dp)) { | 1407 | if (is_edp(intel_dp)) { |
@@ -1430,6 +1424,28 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1430 | 1424 | ||
1431 | if (is_edp(intel_dp)) | 1425 | if (is_edp(intel_dp)) |
1432 | DP |= DP_LINK_TRAIN_OFF; | 1426 | DP |= DP_LINK_TRAIN_OFF; |
1427 | |||
1428 | if (!HAS_PCH_CPT(dev) && | ||
1429 | I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { | ||
1430 | struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc); | ||
1431 | /* Hardware workaround: leaving our transcoder select | ||
1432 | * set to transcoder B while it's off will prevent the | ||
1433 | * corresponding HDMI output on transcoder A. | ||
1434 | * | ||
1435 | * Combine this with another hardware workaround: | ||
1436 | * transcoder select bit can only be cleared while the | ||
1437 | * port is enabled. | ||
1438 | */ | ||
1439 | DP &= ~DP_PIPEB_SELECT; | ||
1440 | I915_WRITE(intel_dp->output_reg, DP); | ||
1441 | |||
1442 | /* Changes to enable or select take place the vblank | ||
1443 | * after being written. | ||
1444 | */ | ||
1445 | intel_wait_for_vblank(intel_dp->base.base.dev, | ||
1446 | intel_crtc->pipe); | ||
1447 | } | ||
1448 | |||
1433 | I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); | 1449 | I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); |
1434 | POSTING_READ(intel_dp->output_reg); | 1450 | POSTING_READ(intel_dp->output_reg); |
1435 | } | 1451 | } |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 21551fe74541..e52c6125bb1f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -237,7 +237,7 @@ extern bool intel_sdvo_init(struct drm_device *dev, int output_device); | |||
237 | extern void intel_dvo_init(struct drm_device *dev); | 237 | extern void intel_dvo_init(struct drm_device *dev); |
238 | extern void intel_tv_init(struct drm_device *dev); | 238 | extern void intel_tv_init(struct drm_device *dev); |
239 | extern void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj); | 239 | extern void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj); |
240 | extern void intel_lvds_init(struct drm_device *dev); | 240 | extern bool intel_lvds_init(struct drm_device *dev); |
241 | extern void intel_dp_init(struct drm_device *dev, int dp_reg); | 241 | extern void intel_dp_init(struct drm_device *dev, int dp_reg); |
242 | void | 242 | void |
243 | intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | 243 | intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 4324a326f98e..25bcedf386fd 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -68,7 +68,7 @@ static struct intel_lvds *intel_attached_lvds(struct drm_connector *connector) | |||
68 | /** | 68 | /** |
69 | * Sets the power state for the panel. | 69 | * Sets the power state for the panel. |
70 | */ | 70 | */ |
71 | static void intel_lvds_set_power(struct intel_lvds *intel_lvds, bool on) | 71 | static void intel_lvds_enable(struct intel_lvds *intel_lvds) |
72 | { | 72 | { |
73 | struct drm_device *dev = intel_lvds->base.base.dev; | 73 | struct drm_device *dev = intel_lvds->base.base.dev; |
74 | struct drm_i915_private *dev_priv = dev->dev_private; | 74 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -82,26 +82,61 @@ static void intel_lvds_set_power(struct intel_lvds *intel_lvds, bool on) | |||
82 | lvds_reg = LVDS; | 82 | lvds_reg = LVDS; |
83 | } | 83 | } |
84 | 84 | ||
85 | if (on) { | 85 | I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN); |
86 | I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN); | ||
87 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON); | ||
88 | intel_panel_set_backlight(dev, dev_priv->backlight_level); | ||
89 | } else { | ||
90 | dev_priv->backlight_level = intel_panel_get_backlight(dev); | ||
91 | |||
92 | intel_panel_set_backlight(dev, 0); | ||
93 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); | ||
94 | 86 | ||
95 | if (intel_lvds->pfit_control) { | 87 | if (intel_lvds->pfit_dirty) { |
96 | if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) | 88 | /* |
97 | DRM_ERROR("timed out waiting for panel to power off\n"); | 89 | * Enable automatic panel scaling so that non-native modes |
98 | I915_WRITE(PFIT_CONTROL, 0); | 90 | * fill the screen. The panel fitter should only be |
99 | intel_lvds->pfit_control = 0; | 91 | * adjusted whilst the pipe is disabled, according to |
92 | * register description and PRM. | ||
93 | */ | ||
94 | DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n", | ||
95 | intel_lvds->pfit_control, | ||
96 | intel_lvds->pfit_pgm_ratios); | ||
97 | if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) { | ||
98 | DRM_ERROR("timed out waiting for panel to power off\n"); | ||
99 | } else { | ||
100 | I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios); | ||
101 | I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control); | ||
100 | intel_lvds->pfit_dirty = false; | 102 | intel_lvds->pfit_dirty = false; |
101 | } | 103 | } |
104 | } | ||
105 | |||
106 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON); | ||
107 | POSTING_READ(lvds_reg); | ||
108 | |||
109 | intel_panel_set_backlight(dev, dev_priv->backlight_level); | ||
110 | } | ||
111 | |||
112 | static void intel_lvds_disable(struct intel_lvds *intel_lvds) | ||
113 | { | ||
114 | struct drm_device *dev = intel_lvds->base.base.dev; | ||
115 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
116 | u32 ctl_reg, lvds_reg; | ||
117 | |||
118 | if (HAS_PCH_SPLIT(dev)) { | ||
119 | ctl_reg = PCH_PP_CONTROL; | ||
120 | lvds_reg = PCH_LVDS; | ||
121 | } else { | ||
122 | ctl_reg = PP_CONTROL; | ||
123 | lvds_reg = LVDS; | ||
124 | } | ||
125 | |||
126 | dev_priv->backlight_level = intel_panel_get_backlight(dev); | ||
127 | intel_panel_set_backlight(dev, 0); | ||
128 | |||
129 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); | ||
130 | |||
131 | if (intel_lvds->pfit_control) { | ||
132 | if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) | ||
133 | DRM_ERROR("timed out waiting for panel to power off\n"); | ||
102 | 134 | ||
103 | I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); | 135 | I915_WRITE(PFIT_CONTROL, 0); |
136 | intel_lvds->pfit_dirty = true; | ||
104 | } | 137 | } |
138 | |||
139 | I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); | ||
105 | POSTING_READ(lvds_reg); | 140 | POSTING_READ(lvds_reg); |
106 | } | 141 | } |
107 | 142 | ||
@@ -110,9 +145,9 @@ static void intel_lvds_dpms(struct drm_encoder *encoder, int mode) | |||
110 | struct intel_lvds *intel_lvds = to_intel_lvds(encoder); | 145 | struct intel_lvds *intel_lvds = to_intel_lvds(encoder); |
111 | 146 | ||
112 | if (mode == DRM_MODE_DPMS_ON) | 147 | if (mode == DRM_MODE_DPMS_ON) |
113 | intel_lvds_set_power(intel_lvds, true); | 148 | intel_lvds_enable(intel_lvds); |
114 | else | 149 | else |
115 | intel_lvds_set_power(intel_lvds, false); | 150 | intel_lvds_disable(intel_lvds); |
116 | 151 | ||
117 | /* XXX: We never power down the LVDS pairs. */ | 152 | /* XXX: We never power down the LVDS pairs. */ |
118 | } | 153 | } |
@@ -411,43 +446,18 @@ static void intel_lvds_commit(struct drm_encoder *encoder) | |||
411 | /* Always do a full power on as we do not know what state | 446 | /* Always do a full power on as we do not know what state |
412 | * we were left in. | 447 | * we were left in. |
413 | */ | 448 | */ |
414 | intel_lvds_set_power(intel_lvds, true); | 449 | intel_lvds_enable(intel_lvds); |
415 | } | 450 | } |
416 | 451 | ||
417 | static void intel_lvds_mode_set(struct drm_encoder *encoder, | 452 | static void intel_lvds_mode_set(struct drm_encoder *encoder, |
418 | struct drm_display_mode *mode, | 453 | struct drm_display_mode *mode, |
419 | struct drm_display_mode *adjusted_mode) | 454 | struct drm_display_mode *adjusted_mode) |
420 | { | 455 | { |
421 | struct drm_device *dev = encoder->dev; | ||
422 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
423 | struct intel_lvds *intel_lvds = to_intel_lvds(encoder); | ||
424 | |||
425 | /* | 456 | /* |
426 | * The LVDS pin pair will already have been turned on in the | 457 | * The LVDS pin pair will already have been turned on in the |
427 | * intel_crtc_mode_set since it has a large impact on the DPLL | 458 | * intel_crtc_mode_set since it has a large impact on the DPLL |
428 | * settings. | 459 | * settings. |
429 | */ | 460 | */ |
430 | |||
431 | if (HAS_PCH_SPLIT(dev)) | ||
432 | return; | ||
433 | |||
434 | if (!intel_lvds->pfit_dirty) | ||
435 | return; | ||
436 | |||
437 | /* | ||
438 | * Enable automatic panel scaling so that non-native modes fill the | ||
439 | * screen. Should be enabled before the pipe is enabled, according to | ||
440 | * register description and PRM. | ||
441 | */ | ||
442 | DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n", | ||
443 | intel_lvds->pfit_control, | ||
444 | intel_lvds->pfit_pgm_ratios); | ||
445 | if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) | ||
446 | DRM_ERROR("timed out waiting for panel to power off\n"); | ||
447 | |||
448 | I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios); | ||
449 | I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control); | ||
450 | intel_lvds->pfit_dirty = false; | ||
451 | } | 461 | } |
452 | 462 | ||
453 | /** | 463 | /** |
@@ -837,7 +847,7 @@ static bool intel_lvds_ddc_probe(struct drm_device *dev, u8 pin) | |||
837 | * Create the connector, register the LVDS DDC bus, and try to figure out what | 847 | * Create the connector, register the LVDS DDC bus, and try to figure out what |
838 | * modes we can display on the LVDS panel (if present). | 848 | * modes we can display on the LVDS panel (if present). |
839 | */ | 849 | */ |
840 | void intel_lvds_init(struct drm_device *dev) | 850 | bool intel_lvds_init(struct drm_device *dev) |
841 | { | 851 | { |
842 | struct drm_i915_private *dev_priv = dev->dev_private; | 852 | struct drm_i915_private *dev_priv = dev->dev_private; |
843 | struct intel_lvds *intel_lvds; | 853 | struct intel_lvds *intel_lvds; |
@@ -853,37 +863,37 @@ void intel_lvds_init(struct drm_device *dev) | |||
853 | 863 | ||
854 | /* Skip init on machines we know falsely report LVDS */ | 864 | /* Skip init on machines we know falsely report LVDS */ |
855 | if (dmi_check_system(intel_no_lvds)) | 865 | if (dmi_check_system(intel_no_lvds)) |
856 | return; | 866 | return false; |
857 | 867 | ||
858 | pin = GMBUS_PORT_PANEL; | 868 | pin = GMBUS_PORT_PANEL; |
859 | if (!lvds_is_present_in_vbt(dev, &pin)) { | 869 | if (!lvds_is_present_in_vbt(dev, &pin)) { |
860 | DRM_DEBUG_KMS("LVDS is not present in VBT\n"); | 870 | DRM_DEBUG_KMS("LVDS is not present in VBT\n"); |
861 | return; | 871 | return false; |
862 | } | 872 | } |
863 | 873 | ||
864 | if (HAS_PCH_SPLIT(dev)) { | 874 | if (HAS_PCH_SPLIT(dev)) { |
865 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) | 875 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) |
866 | return; | 876 | return false; |
867 | if (dev_priv->edp.support) { | 877 | if (dev_priv->edp.support) { |
868 | DRM_DEBUG_KMS("disable LVDS for eDP support\n"); | 878 | DRM_DEBUG_KMS("disable LVDS for eDP support\n"); |
869 | return; | 879 | return false; |
870 | } | 880 | } |
871 | } | 881 | } |
872 | 882 | ||
873 | if (!intel_lvds_ddc_probe(dev, pin)) { | 883 | if (!intel_lvds_ddc_probe(dev, pin)) { |
874 | DRM_DEBUG_KMS("LVDS did not respond to DDC probe\n"); | 884 | DRM_DEBUG_KMS("LVDS did not respond to DDC probe\n"); |
875 | return; | 885 | return false; |
876 | } | 886 | } |
877 | 887 | ||
878 | intel_lvds = kzalloc(sizeof(struct intel_lvds), GFP_KERNEL); | 888 | intel_lvds = kzalloc(sizeof(struct intel_lvds), GFP_KERNEL); |
879 | if (!intel_lvds) { | 889 | if (!intel_lvds) { |
880 | return; | 890 | return false; |
881 | } | 891 | } |
882 | 892 | ||
883 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); | 893 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); |
884 | if (!intel_connector) { | 894 | if (!intel_connector) { |
885 | kfree(intel_lvds); | 895 | kfree(intel_lvds); |
886 | return; | 896 | return false; |
887 | } | 897 | } |
888 | 898 | ||
889 | if (!HAS_PCH_SPLIT(dev)) { | 899 | if (!HAS_PCH_SPLIT(dev)) { |
@@ -1026,7 +1036,7 @@ out: | |||
1026 | /* keep the LVDS connector */ | 1036 | /* keep the LVDS connector */ |
1027 | dev_priv->int_lvds_connector = connector; | 1037 | dev_priv->int_lvds_connector = connector; |
1028 | drm_sysfs_connector_add(connector); | 1038 | drm_sysfs_connector_add(connector); |
1029 | return; | 1039 | return true; |
1030 | 1040 | ||
1031 | failed: | 1041 | failed: |
1032 | DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); | 1042 | DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); |
@@ -1034,4 +1044,5 @@ failed: | |||
1034 | drm_encoder_cleanup(encoder); | 1044 | drm_encoder_cleanup(encoder); |
1035 | kfree(intel_lvds); | 1045 | kfree(intel_lvds); |
1036 | kfree(intel_connector); | 1046 | kfree(intel_connector); |
1047 | return false; | ||
1037 | } | 1048 | } |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index b83306f9244b..31cd7e33e820 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -156,23 +156,25 @@ static int init_ring_common(struct drm_device *dev, | |||
156 | 156 | ||
157 | /* G45 ring initialization fails to reset head to zero */ | 157 | /* G45 ring initialization fails to reset head to zero */ |
158 | if (head != 0) { | 158 | if (head != 0) { |
159 | DRM_ERROR("%s head not reset to zero " | 159 | DRM_DEBUG_KMS("%s head not reset to zero " |
160 | "ctl %08x head %08x tail %08x start %08x\n", | 160 | "ctl %08x head %08x tail %08x start %08x\n", |
161 | ring->name, | 161 | ring->name, |
162 | I915_READ_CTL(ring), | 162 | I915_READ_CTL(ring), |
163 | I915_READ_HEAD(ring), | 163 | I915_READ_HEAD(ring), |
164 | I915_READ_TAIL(ring), | 164 | I915_READ_TAIL(ring), |
165 | I915_READ_START(ring)); | 165 | I915_READ_START(ring)); |
166 | 166 | ||
167 | I915_WRITE_HEAD(ring, 0); | 167 | I915_WRITE_HEAD(ring, 0); |
168 | 168 | ||
169 | DRM_ERROR("%s head forced to zero " | 169 | if (I915_READ_HEAD(ring) & HEAD_ADDR) { |
170 | "ctl %08x head %08x tail %08x start %08x\n", | 170 | DRM_ERROR("failed to set %s head to zero " |
171 | ring->name, | 171 | "ctl %08x head %08x tail %08x start %08x\n", |
172 | I915_READ_CTL(ring), | 172 | ring->name, |
173 | I915_READ_HEAD(ring), | 173 | I915_READ_CTL(ring), |
174 | I915_READ_TAIL(ring), | 174 | I915_READ_HEAD(ring), |
175 | I915_READ_START(ring)); | 175 | I915_READ_TAIL(ring), |
176 | I915_READ_START(ring)); | ||
177 | } | ||
176 | } | 178 | } |
177 | 179 | ||
178 | I915_WRITE_CTL(ring, | 180 | I915_WRITE_CTL(ring, |
@@ -694,20 +696,17 @@ int intel_wait_ring_buffer(struct drm_device *dev, | |||
694 | drm_i915_private_t *dev_priv = dev->dev_private; | 696 | drm_i915_private_t *dev_priv = dev->dev_private; |
695 | u32 head; | 697 | u32 head; |
696 | 698 | ||
697 | head = intel_read_status_page(ring, 4); | ||
698 | if (head) { | ||
699 | ring->head = head & HEAD_ADDR; | ||
700 | ring->space = ring->head - (ring->tail + 8); | ||
701 | if (ring->space < 0) | ||
702 | ring->space += ring->size; | ||
703 | if (ring->space >= n) | ||
704 | return 0; | ||
705 | } | ||
706 | |||
707 | trace_i915_ring_wait_begin (dev); | 699 | trace_i915_ring_wait_begin (dev); |
708 | end = jiffies + 3 * HZ; | 700 | end = jiffies + 3 * HZ; |
709 | do { | 701 | do { |
710 | ring->head = I915_READ_HEAD(ring) & HEAD_ADDR; | 702 | /* If the reported head position has wrapped or hasn't advanced, |
703 | * fallback to the slow and accurate path. | ||
704 | */ | ||
705 | head = intel_read_status_page(ring, 4); | ||
706 | if (head < ring->actual_head) | ||
707 | head = I915_READ_HEAD(ring); | ||
708 | ring->actual_head = head; | ||
709 | ring->head = head & HEAD_ADDR; | ||
711 | ring->space = ring->head - (ring->tail + 8); | 710 | ring->space = ring->head - (ring->tail + 8); |
712 | if (ring->space < 0) | 711 | if (ring->space < 0) |
713 | ring->space += ring->size; | 712 | ring->space += ring->size; |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 3126c2681983..d2cd0f1efeed 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -30,8 +30,9 @@ struct intel_ring_buffer { | |||
30 | struct drm_device *dev; | 30 | struct drm_device *dev; |
31 | struct drm_gem_object *gem_object; | 31 | struct drm_gem_object *gem_object; |
32 | 32 | ||
33 | unsigned int head; | 33 | u32 actual_head; |
34 | unsigned int tail; | 34 | u32 head; |
35 | u32 tail; | ||
35 | int space; | 36 | int space; |
36 | struct intel_hw_status_page status_page; | 37 | struct intel_hw_status_page status_page; |
37 | 38 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index de158b76bcd5..27e63abf2a73 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -107,7 +107,8 @@ struct intel_sdvo { | |||
107 | * This is set if we treat the device as HDMI, instead of DVI. | 107 | * This is set if we treat the device as HDMI, instead of DVI. |
108 | */ | 108 | */ |
109 | bool is_hdmi; | 109 | bool is_hdmi; |
110 | bool has_audio; | 110 | bool has_hdmi_monitor; |
111 | bool has_hdmi_audio; | ||
111 | 112 | ||
112 | /** | 113 | /** |
113 | * This is set if we detect output of sdvo device as LVDS and | 114 | * This is set if we detect output of sdvo device as LVDS and |
@@ -1023,7 +1024,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1023 | if (!intel_sdvo_set_target_input(intel_sdvo)) | 1024 | if (!intel_sdvo_set_target_input(intel_sdvo)) |
1024 | return; | 1025 | return; |
1025 | 1026 | ||
1026 | if (intel_sdvo->is_hdmi && | 1027 | if (intel_sdvo->has_hdmi_monitor && |
1027 | !intel_sdvo_set_avi_infoframe(intel_sdvo)) | 1028 | !intel_sdvo_set_avi_infoframe(intel_sdvo)) |
1028 | return; | 1029 | return; |
1029 | 1030 | ||
@@ -1063,7 +1064,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1063 | } | 1064 | } |
1064 | if (intel_crtc->pipe == 1) | 1065 | if (intel_crtc->pipe == 1) |
1065 | sdvox |= SDVO_PIPE_B_SELECT; | 1066 | sdvox |= SDVO_PIPE_B_SELECT; |
1066 | if (intel_sdvo->has_audio) | 1067 | if (intel_sdvo->has_hdmi_audio) |
1067 | sdvox |= SDVO_AUDIO_ENABLE; | 1068 | sdvox |= SDVO_AUDIO_ENABLE; |
1068 | 1069 | ||
1069 | if (INTEL_INFO(dev)->gen >= 4) { | 1070 | if (INTEL_INFO(dev)->gen >= 4) { |
@@ -1295,55 +1296,14 @@ intel_sdvo_get_edid(struct drm_connector *connector) | |||
1295 | return drm_get_edid(connector, &sdvo->ddc); | 1296 | return drm_get_edid(connector, &sdvo->ddc); |
1296 | } | 1297 | } |
1297 | 1298 | ||
1298 | static struct drm_connector * | ||
1299 | intel_find_analog_connector(struct drm_device *dev) | ||
1300 | { | ||
1301 | struct drm_connector *connector; | ||
1302 | struct intel_sdvo *encoder; | ||
1303 | |||
1304 | list_for_each_entry(encoder, | ||
1305 | &dev->mode_config.encoder_list, | ||
1306 | base.base.head) { | ||
1307 | if (encoder->base.type == INTEL_OUTPUT_ANALOG) { | ||
1308 | list_for_each_entry(connector, | ||
1309 | &dev->mode_config.connector_list, | ||
1310 | head) { | ||
1311 | if (&encoder->base == | ||
1312 | intel_attached_encoder(connector)) | ||
1313 | return connector; | ||
1314 | } | ||
1315 | } | ||
1316 | } | ||
1317 | |||
1318 | return NULL; | ||
1319 | } | ||
1320 | |||
1321 | static int | ||
1322 | intel_analog_is_connected(struct drm_device *dev) | ||
1323 | { | ||
1324 | struct drm_connector *analog_connector; | ||
1325 | |||
1326 | analog_connector = intel_find_analog_connector(dev); | ||
1327 | if (!analog_connector) | ||
1328 | return false; | ||
1329 | |||
1330 | if (analog_connector->funcs->detect(analog_connector, false) == | ||
1331 | connector_status_disconnected) | ||
1332 | return false; | ||
1333 | |||
1334 | return true; | ||
1335 | } | ||
1336 | |||
1337 | /* Mac mini hack -- use the same DDC as the analog connector */ | 1299 | /* Mac mini hack -- use the same DDC as the analog connector */ |
1338 | static struct edid * | 1300 | static struct edid * |
1339 | intel_sdvo_get_analog_edid(struct drm_connector *connector) | 1301 | intel_sdvo_get_analog_edid(struct drm_connector *connector) |
1340 | { | 1302 | { |
1341 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 1303 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
1342 | 1304 | ||
1343 | if (!intel_analog_is_connected(connector->dev)) | 1305 | return drm_get_edid(connector, |
1344 | return NULL; | 1306 | &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter); |
1345 | |||
1346 | return drm_get_edid(connector, &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter); | ||
1347 | } | 1307 | } |
1348 | 1308 | ||
1349 | enum drm_connector_status | 1309 | enum drm_connector_status |
@@ -1388,8 +1348,10 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector) | |||
1388 | /* DDC bus is shared, match EDID to connector type */ | 1348 | /* DDC bus is shared, match EDID to connector type */ |
1389 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { | 1349 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { |
1390 | status = connector_status_connected; | 1350 | status = connector_status_connected; |
1391 | intel_sdvo->is_hdmi = drm_detect_hdmi_monitor(edid); | 1351 | if (intel_sdvo->is_hdmi) { |
1392 | intel_sdvo->has_audio = drm_detect_monitor_audio(edid); | 1352 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); |
1353 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); | ||
1354 | } | ||
1393 | } | 1355 | } |
1394 | connector->display_info.raw_edid = NULL; | 1356 | connector->display_info.raw_edid = NULL; |
1395 | kfree(edid); | 1357 | kfree(edid); |
@@ -1398,7 +1360,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector) | |||
1398 | if (status == connector_status_connected) { | 1360 | if (status == connector_status_connected) { |
1399 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); | 1361 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); |
1400 | if (intel_sdvo_connector->force_audio) | 1362 | if (intel_sdvo_connector->force_audio) |
1401 | intel_sdvo->has_audio = intel_sdvo_connector->force_audio > 0; | 1363 | intel_sdvo->has_hdmi_audio = intel_sdvo_connector->force_audio > 0; |
1402 | } | 1364 | } |
1403 | 1365 | ||
1404 | return status; | 1366 | return status; |
@@ -1415,10 +1377,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) | |||
1415 | if (!intel_sdvo_write_cmd(intel_sdvo, | 1377 | if (!intel_sdvo_write_cmd(intel_sdvo, |
1416 | SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) | 1378 | SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) |
1417 | return connector_status_unknown; | 1379 | return connector_status_unknown; |
1418 | if (intel_sdvo->is_tv) { | 1380 | |
1419 | /* add 30ms delay when the output type is SDVO-TV */ | 1381 | /* add 30ms delay when the output type might be TV */ |
1382 | if (intel_sdvo->caps.output_flags & | ||
1383 | (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_CVBS0)) | ||
1420 | mdelay(30); | 1384 | mdelay(30); |
1421 | } | 1385 | |
1422 | if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) | 1386 | if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) |
1423 | return connector_status_unknown; | 1387 | return connector_status_unknown; |
1424 | 1388 | ||
@@ -1472,8 +1436,10 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) | |||
1472 | edid = intel_sdvo_get_analog_edid(connector); | 1436 | edid = intel_sdvo_get_analog_edid(connector); |
1473 | 1437 | ||
1474 | if (edid != NULL) { | 1438 | if (edid != NULL) { |
1475 | drm_mode_connector_update_edid_property(connector, edid); | 1439 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { |
1476 | drm_add_edid_modes(connector, edid); | 1440 | drm_mode_connector_update_edid_property(connector, edid); |
1441 | drm_add_edid_modes(connector, edid); | ||
1442 | } | ||
1477 | connector->display_info.raw_edid = NULL; | 1443 | connector->display_info.raw_edid = NULL; |
1478 | kfree(edid); | 1444 | kfree(edid); |
1479 | } | 1445 | } |
@@ -1713,12 +1679,12 @@ intel_sdvo_set_property(struct drm_connector *connector, | |||
1713 | 1679 | ||
1714 | intel_sdvo_connector->force_audio = val; | 1680 | intel_sdvo_connector->force_audio = val; |
1715 | 1681 | ||
1716 | if (val > 0 && intel_sdvo->has_audio) | 1682 | if (val > 0 && intel_sdvo->has_hdmi_audio) |
1717 | return 0; | 1683 | return 0; |
1718 | if (val < 0 && !intel_sdvo->has_audio) | 1684 | if (val < 0 && !intel_sdvo->has_hdmi_audio) |
1719 | return 0; | 1685 | return 0; |
1720 | 1686 | ||
1721 | intel_sdvo->has_audio = val > 0; | 1687 | intel_sdvo->has_hdmi_audio = val > 0; |
1722 | goto done; | 1688 | goto done; |
1723 | } | 1689 | } |
1724 | 1690 | ||
@@ -1942,9 +1908,12 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv, | |||
1942 | speed = mapping->i2c_speed; | 1908 | speed = mapping->i2c_speed; |
1943 | } | 1909 | } |
1944 | 1910 | ||
1945 | sdvo->i2c = &dev_priv->gmbus[pin].adapter; | 1911 | if (pin < GMBUS_NUM_PORTS) { |
1946 | intel_gmbus_set_speed(sdvo->i2c, speed); | 1912 | sdvo->i2c = &dev_priv->gmbus[pin].adapter; |
1947 | intel_gmbus_force_bit(sdvo->i2c, true); | 1913 | intel_gmbus_set_speed(sdvo->i2c, speed); |
1914 | intel_gmbus_force_bit(sdvo->i2c, true); | ||
1915 | } else | ||
1916 | sdvo->i2c = &dev_priv->gmbus[GMBUS_PORT_DPB].adapter; | ||
1948 | } | 1917 | } |
1949 | 1918 | ||
1950 | static bool | 1919 | static bool |
@@ -2070,6 +2039,8 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) | |||
2070 | intel_sdvo_set_colorimetry(intel_sdvo, | 2039 | intel_sdvo_set_colorimetry(intel_sdvo, |
2071 | SDVO_COLORIMETRY_RGB256); | 2040 | SDVO_COLORIMETRY_RGB256); |
2072 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; | 2041 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; |
2042 | |||
2043 | intel_sdvo_add_hdmi_properties(intel_sdvo_connector); | ||
2073 | intel_sdvo->is_hdmi = true; | 2044 | intel_sdvo->is_hdmi = true; |
2074 | } | 2045 | } |
2075 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | 2046 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | |
@@ -2077,8 +2048,6 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) | |||
2077 | 2048 | ||
2078 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); | 2049 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); |
2079 | 2050 | ||
2080 | intel_sdvo_add_hdmi_properties(intel_sdvo_connector); | ||
2081 | |||
2082 | return true; | 2051 | return true; |
2083 | } | 2052 | } |
2084 | 2053 | ||
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 8e421f644a54..05efb5b9f13e 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
112 | base += 3; | 112 | base += 3; |
113 | break; | 113 | break; |
114 | case ATOM_IIO_WRITE: | 114 | case ATOM_IIO_WRITE: |
115 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | ||
115 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); | 116 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); |
116 | base += 3; | 117 | base += 3; |
117 | break; | 118 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index df2b6f2b35f8..9fbabaa6ee44 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -253,7 +253,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
253 | case DRM_MODE_DPMS_SUSPEND: | 253 | case DRM_MODE_DPMS_SUSPEND: |
254 | case DRM_MODE_DPMS_OFF: | 254 | case DRM_MODE_DPMS_OFF: |
255 | drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); | 255 | drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); |
256 | atombios_blank_crtc(crtc, ATOM_ENABLE); | 256 | if (radeon_crtc->enabled) |
257 | atombios_blank_crtc(crtc, ATOM_ENABLE); | ||
257 | if (ASIC_IS_DCE3(rdev)) | 258 | if (ASIC_IS_DCE3(rdev)) |
258 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); | 259 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); |
259 | atombios_enable_crtc(crtc, ATOM_DISABLE); | 260 | atombios_enable_crtc(crtc, ATOM_DISABLE); |
@@ -530,7 +531,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
530 | dp_clock = dig_connector->dp_clock; | 531 | dp_clock = dig_connector->dp_clock; |
531 | } | 532 | } |
532 | } | 533 | } |
533 | 534 | #if 0 /* doesn't work properly on some laptops */ | |
534 | /* use recommended ref_div for ss */ | 535 | /* use recommended ref_div for ss */ |
535 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 536 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
536 | if (ss_enabled) { | 537 | if (ss_enabled) { |
@@ -540,7 +541,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
540 | } | 541 | } |
541 | } | 542 | } |
542 | } | 543 | } |
543 | 544 | #endif | |
544 | if (ASIC_IS_AVIVO(rdev)) { | 545 | if (ASIC_IS_AVIVO(rdev)) { |
545 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ | 546 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ |
546 | if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) | 547 | if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 4dc5b4714c5a..7b337c361a12 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -748,6 +748,8 @@ void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
748 | unsigned i; | 748 | unsigned i; |
749 | u32 tmp; | 749 | u32 tmp; |
750 | 750 | ||
751 | WREG32(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1); | ||
752 | |||
751 | WREG32(VM_CONTEXT0_REQUEST_RESPONSE, REQUEST_TYPE(1)); | 753 | WREG32(VM_CONTEXT0_REQUEST_RESPONSE, REQUEST_TYPE(1)); |
752 | for (i = 0; i < rdev->usec_timeout; i++) { | 754 | for (i = 0; i < rdev->usec_timeout; i++) { |
753 | /* read MC_STATUS */ | 755 | /* read MC_STATUS */ |
@@ -1922,7 +1924,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev) | |||
1922 | static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | 1924 | static int evergreen_gpu_soft_reset(struct radeon_device *rdev) |
1923 | { | 1925 | { |
1924 | struct evergreen_mc_save save; | 1926 | struct evergreen_mc_save save; |
1925 | u32 srbm_reset = 0; | ||
1926 | u32 grbm_reset = 0; | 1927 | u32 grbm_reset = 0; |
1927 | 1928 | ||
1928 | dev_info(rdev->dev, "GPU softreset \n"); | 1929 | dev_info(rdev->dev, "GPU softreset \n"); |
@@ -1961,16 +1962,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | |||
1961 | udelay(50); | 1962 | udelay(50); |
1962 | WREG32(GRBM_SOFT_RESET, 0); | 1963 | WREG32(GRBM_SOFT_RESET, 0); |
1963 | (void)RREG32(GRBM_SOFT_RESET); | 1964 | (void)RREG32(GRBM_SOFT_RESET); |
1964 | |||
1965 | /* reset all the system blocks */ | ||
1966 | srbm_reset = SRBM_SOFT_RESET_ALL_MASK; | ||
1967 | |||
1968 | dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset); | ||
1969 | WREG32(SRBM_SOFT_RESET, srbm_reset); | ||
1970 | (void)RREG32(SRBM_SOFT_RESET); | ||
1971 | udelay(50); | ||
1972 | WREG32(SRBM_SOFT_RESET, 0); | ||
1973 | (void)RREG32(SRBM_SOFT_RESET); | ||
1974 | /* Wait a little for things to settle down */ | 1965 | /* Wait a little for things to settle down */ |
1975 | udelay(50); | 1966 | udelay(50); |
1976 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", | 1967 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", |
@@ -1981,10 +1972,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | |||
1981 | RREG32(GRBM_STATUS_SE1)); | 1972 | RREG32(GRBM_STATUS_SE1)); |
1982 | dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", | 1973 | dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", |
1983 | RREG32(SRBM_STATUS)); | 1974 | RREG32(SRBM_STATUS)); |
1984 | /* After reset we need to reinit the asic as GPU often endup in an | ||
1985 | * incoherent state. | ||
1986 | */ | ||
1987 | atom_asic_init(rdev->mode_info.atom_context); | ||
1988 | evergreen_mc_resume(rdev, &save); | 1975 | evergreen_mc_resume(rdev, &save); |
1989 | return 0; | 1976 | return 0; |
1990 | } | 1977 | } |
@@ -2596,6 +2583,11 @@ int evergreen_resume(struct radeon_device *rdev) | |||
2596 | { | 2583 | { |
2597 | int r; | 2584 | int r; |
2598 | 2585 | ||
2586 | /* reset the asic, the gfx blocks are often in a bad state | ||
2587 | * after the driver is unloaded or after a resume | ||
2588 | */ | ||
2589 | if (radeon_asic_reset(rdev)) | ||
2590 | dev_warn(rdev->dev, "GPU reset failed !\n"); | ||
2599 | /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, | 2591 | /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, |
2600 | * posting will perform necessary task to bring back GPU into good | 2592 | * posting will perform necessary task to bring back GPU into good |
2601 | * shape. | 2593 | * shape. |
@@ -2712,6 +2704,11 @@ int evergreen_init(struct radeon_device *rdev) | |||
2712 | r = radeon_atombios_init(rdev); | 2704 | r = radeon_atombios_init(rdev); |
2713 | if (r) | 2705 | if (r) |
2714 | return r; | 2706 | return r; |
2707 | /* reset the asic, the gfx blocks are often in a bad state | ||
2708 | * after the driver is unloaded or after a resume | ||
2709 | */ | ||
2710 | if (radeon_asic_reset(rdev)) | ||
2711 | dev_warn(rdev->dev, "GPU reset failed !\n"); | ||
2715 | /* Post card if necessary */ | 2712 | /* Post card if necessary */ |
2716 | if (!evergreen_card_posted(rdev)) { | 2713 | if (!evergreen_card_posted(rdev)) { |
2717 | if (!rdev->bios) { | 2714 | if (!rdev->bios) { |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index 113c70cc8b39..a73b53c44359 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -174,6 +174,7 @@ | |||
174 | #define HDP_NONSURFACE_BASE 0x2C04 | 174 | #define HDP_NONSURFACE_BASE 0x2C04 |
175 | #define HDP_NONSURFACE_INFO 0x2C08 | 175 | #define HDP_NONSURFACE_INFO 0x2C08 |
176 | #define HDP_NONSURFACE_SIZE 0x2C0C | 176 | #define HDP_NONSURFACE_SIZE 0x2C0C |
177 | #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480 | ||
177 | #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 | 178 | #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 |
178 | #define HDP_TILING_CONFIG 0x2F3C | 179 | #define HDP_TILING_CONFIG 0x2F3C |
179 | 180 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index a3552594ccc4..9c92db7c896b 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -878,12 +878,15 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
878 | u32 tmp; | 878 | u32 tmp; |
879 | 879 | ||
880 | /* flush hdp cache so updates hit vram */ | 880 | /* flush hdp cache so updates hit vram */ |
881 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { | 881 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
882 | !(rdev->flags & RADEON_IS_AGP)) { | ||
882 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; | 883 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; |
883 | u32 tmp; | 884 | u32 tmp; |
884 | 885 | ||
885 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 886 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
886 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 887 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL |
888 | * This seems to cause problems on some AGP cards. Just use the old | ||
889 | * method for them. | ||
887 | */ | 890 | */ |
888 | WREG32(HDP_DEBUG1, 0); | 891 | WREG32(HDP_DEBUG1, 0); |
889 | tmp = readl((void __iomem *)ptr); | 892 | tmp = readl((void __iomem *)ptr); |
@@ -1195,8 +1198,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
1195 | mc->vram_end, mc->real_vram_size >> 20); | 1198 | mc->vram_end, mc->real_vram_size >> 20); |
1196 | } else { | 1199 | } else { |
1197 | u64 base = 0; | 1200 | u64 base = 0; |
1198 | if (rdev->flags & RADEON_IS_IGP) | 1201 | if (rdev->flags & RADEON_IS_IGP) { |
1199 | base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; | 1202 | base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF; |
1203 | base <<= 24; | ||
1204 | } | ||
1200 | radeon_vram_location(rdev, &rdev->mc, base); | 1205 | radeon_vram_location(rdev, &rdev->mc, base); |
1201 | rdev->mc.gtt_base_align = 0; | 1206 | rdev->mc.gtt_base_align = 0; |
1202 | radeon_gtt_location(rdev, mc); | 1207 | radeon_gtt_location(rdev, mc); |
@@ -1337,13 +1342,19 @@ bool r600_gpu_is_lockup(struct radeon_device *rdev) | |||
1337 | u32 srbm_status; | 1342 | u32 srbm_status; |
1338 | u32 grbm_status; | 1343 | u32 grbm_status; |
1339 | u32 grbm_status2; | 1344 | u32 grbm_status2; |
1345 | struct r100_gpu_lockup *lockup; | ||
1340 | int r; | 1346 | int r; |
1341 | 1347 | ||
1348 | if (rdev->family >= CHIP_RV770) | ||
1349 | lockup = &rdev->config.rv770.lockup; | ||
1350 | else | ||
1351 | lockup = &rdev->config.r600.lockup; | ||
1352 | |||
1342 | srbm_status = RREG32(R_000E50_SRBM_STATUS); | 1353 | srbm_status = RREG32(R_000E50_SRBM_STATUS); |
1343 | grbm_status = RREG32(R_008010_GRBM_STATUS); | 1354 | grbm_status = RREG32(R_008010_GRBM_STATUS); |
1344 | grbm_status2 = RREG32(R_008014_GRBM_STATUS2); | 1355 | grbm_status2 = RREG32(R_008014_GRBM_STATUS2); |
1345 | if (!G_008010_GUI_ACTIVE(grbm_status)) { | 1356 | if (!G_008010_GUI_ACTIVE(grbm_status)) { |
1346 | r100_gpu_lockup_update(&rdev->config.r300.lockup, &rdev->cp); | 1357 | r100_gpu_lockup_update(lockup, &rdev->cp); |
1347 | return false; | 1358 | return false; |
1348 | } | 1359 | } |
1349 | /* force CP activities */ | 1360 | /* force CP activities */ |
@@ -1355,7 +1366,7 @@ bool r600_gpu_is_lockup(struct radeon_device *rdev) | |||
1355 | radeon_ring_unlock_commit(rdev); | 1366 | radeon_ring_unlock_commit(rdev); |
1356 | } | 1367 | } |
1357 | rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); | 1368 | rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); |
1358 | return r100_gpu_cp_is_lockup(rdev, &rdev->config.r300.lockup, &rdev->cp); | 1369 | return r100_gpu_cp_is_lockup(rdev, lockup, &rdev->cp); |
1359 | } | 1370 | } |
1360 | 1371 | ||
1361 | int r600_asic_reset(struct radeon_device *rdev) | 1372 | int r600_asic_reset(struct radeon_device *rdev) |
@@ -3483,10 +3494,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev) | |||
3483 | void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) | 3494 | void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) |
3484 | { | 3495 | { |
3485 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 3496 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
3486 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 3497 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL. |
3498 | * This seems to cause problems on some AGP cards. Just use the old | ||
3499 | * method for them. | ||
3487 | */ | 3500 | */ |
3488 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && | 3501 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
3489 | rdev->vram_scratch.ptr) { | 3502 | rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) { |
3490 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | 3503 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; |
3491 | u32 tmp; | 3504 | u32 tmp; |
3492 | 3505 | ||
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 9bebac1ec006..7831e0890210 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -315,11 +315,10 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
315 | if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { | 315 | if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { |
316 | /* the initial DDX does bad things with the CB size occasionally */ | 316 | /* the initial DDX does bad things with the CB size occasionally */ |
317 | /* it rounds up height too far for slice tile max but the BO is smaller */ | 317 | /* it rounds up height too far for slice tile max but the BO is smaller */ |
318 | tmp = (height - 7) * pitch * bpe; | 318 | /* r600c,g also seem to flush at bad times in some apps resulting in |
319 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { | 319 | * bogus values here. So for linear just allow anything to avoid breaking |
320 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); | 320 | * broken userspace. |
321 | return -EINVAL; | 321 | */ |
322 | } | ||
323 | } else { | 322 | } else { |
324 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); | 323 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); |
325 | return -EINVAL; | 324 | return -EINVAL; |
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h index d84612ae47e0..33cda016b083 100644 --- a/drivers/gpu/drm/radeon/r600_reg.h +++ b/drivers/gpu/drm/radeon/r600_reg.h | |||
@@ -86,6 +86,7 @@ | |||
86 | #define R600_HDP_NONSURFACE_BASE 0x2c04 | 86 | #define R600_HDP_NONSURFACE_BASE 0x2c04 |
87 | 87 | ||
88 | #define R600_BUS_CNTL 0x5420 | 88 | #define R600_BUS_CNTL 0x5420 |
89 | # define R600_BIOS_ROM_DIS (1 << 1) | ||
89 | #define R600_CONFIG_CNTL 0x5424 | 90 | #define R600_CONFIG_CNTL 0x5424 |
90 | #define R600_CONFIG_MEMSIZE 0x5428 | 91 | #define R600_CONFIG_MEMSIZE 0x5428 |
91 | #define R600_CONFIG_F0_BASE 0x542C | 92 | #define R600_CONFIG_F0_BASE 0x542C |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 87ead090c7d5..bc5a2c3382d9 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | /* some DCE3 boards have bad data for this entry */ | ||
102 | if (ASIC_IS_DCE3(rdev)) { | ||
103 | if ((i == 4) && | ||
104 | (gpio->usClkMaskRegisterIndex == 0x1fda) && | ||
105 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
106 | gpio->sucI2cId.ucAccess = 0x14; | ||
107 | } | ||
108 | |||
101 | if (gpio->sucI2cId.ucAccess == id) { | 109 | if (gpio->sucI2cId.ucAccess == id) { |
102 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 110 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
103 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | 111 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
@@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
174 | } | 182 | } |
175 | } | 183 | } |
176 | 184 | ||
185 | /* some DCE3 boards have bad data for this entry */ | ||
186 | if (ASIC_IS_DCE3(rdev)) { | ||
187 | if ((i == 4) && | ||
188 | (gpio->usClkMaskRegisterIndex == 0x1fda) && | ||
189 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
190 | gpio->sucI2cId.ucAccess = 0x14; | ||
191 | } | ||
192 | |||
177 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 193 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
178 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | 194 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
179 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | 195 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index 654787ec43f4..8f2c7b50dcf5 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) | |||
130 | } | 130 | } |
131 | return true; | 131 | return true; |
132 | } | 132 | } |
133 | |||
133 | static bool r700_read_disabled_bios(struct radeon_device *rdev) | 134 | static bool r700_read_disabled_bios(struct radeon_device *rdev) |
134 | { | 135 | { |
135 | uint32_t viph_control; | 136 | uint32_t viph_control; |
@@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) | |||
143 | bool r; | 144 | bool r; |
144 | 145 | ||
145 | viph_control = RREG32(RADEON_VIPH_CONTROL); | 146 | viph_control = RREG32(RADEON_VIPH_CONTROL); |
146 | bus_cntl = RREG32(RADEON_BUS_CNTL); | 147 | bus_cntl = RREG32(R600_BUS_CNTL); |
147 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); | 148 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); |
148 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); | 149 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); |
149 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); | 150 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); |
@@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) | |||
152 | /* disable VIP */ | 153 | /* disable VIP */ |
153 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); | 154 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); |
154 | /* enable the rom */ | 155 | /* enable the rom */ |
155 | WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); | 156 | WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
156 | /* Disable VGA mode */ | 157 | /* Disable VGA mode */ |
157 | WREG32(AVIVO_D1VGA_CONTROL, | 158 | WREG32(AVIVO_D1VGA_CONTROL, |
158 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | | 159 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
@@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) | |||
191 | cg_spll_status = RREG32(R600_CG_SPLL_STATUS); | 192 | cg_spll_status = RREG32(R600_CG_SPLL_STATUS); |
192 | } | 193 | } |
193 | WREG32(RADEON_VIPH_CONTROL, viph_control); | 194 | WREG32(RADEON_VIPH_CONTROL, viph_control); |
194 | WREG32(RADEON_BUS_CNTL, bus_cntl); | 195 | WREG32(R600_BUS_CNTL, bus_cntl); |
195 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); | 196 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
196 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); | 197 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
197 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); | 198 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); |
@@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) | |||
216 | bool r; | 217 | bool r; |
217 | 218 | ||
218 | viph_control = RREG32(RADEON_VIPH_CONTROL); | 219 | viph_control = RREG32(RADEON_VIPH_CONTROL); |
219 | bus_cntl = RREG32(RADEON_BUS_CNTL); | 220 | bus_cntl = RREG32(R600_BUS_CNTL); |
220 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); | 221 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); |
221 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); | 222 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); |
222 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); | 223 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); |
@@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) | |||
231 | /* disable VIP */ | 232 | /* disable VIP */ |
232 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); | 233 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); |
233 | /* enable the rom */ | 234 | /* enable the rom */ |
234 | WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); | 235 | WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
235 | /* Disable VGA mode */ | 236 | /* Disable VGA mode */ |
236 | WREG32(AVIVO_D1VGA_CONTROL, | 237 | WREG32(AVIVO_D1VGA_CONTROL, |
237 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | | 238 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
@@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) | |||
262 | 263 | ||
263 | /* restore regs */ | 264 | /* restore regs */ |
264 | WREG32(RADEON_VIPH_CONTROL, viph_control); | 265 | WREG32(RADEON_VIPH_CONTROL, viph_control); |
265 | WREG32(RADEON_BUS_CNTL, bus_cntl); | 266 | WREG32(R600_BUS_CNTL, bus_cntl); |
266 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); | 267 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
267 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); | 268 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
268 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); | 269 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 3bddea5b5295..137b8075f6e7 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -729,7 +729,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev) | |||
729 | clk = RBIOS8(offset + 3 + (i * 5) + 3); | 729 | clk = RBIOS8(offset + 3 + (i * 5) + 3); |
730 | data = RBIOS8(offset + 3 + (i * 5) + 4); | 730 | data = RBIOS8(offset + 3 + (i * 5) + 4); |
731 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, | 731 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, |
732 | clk, data); | 732 | (1 << clk), (1 << data)); |
733 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); | 733 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); |
734 | break; | 734 | break; |
735 | } | 735 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 3bef9f6d66fd..8afaf7a7459e 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1175,6 +1175,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1175 | /* no HPD on analog connectors */ | 1175 | /* no HPD on analog connectors */ |
1176 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1176 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1177 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | 1177 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1178 | connector->interlace_allowed = true; | ||
1179 | connector->doublescan_allowed = true; | ||
1178 | break; | 1180 | break; |
1179 | case DRM_MODE_CONNECTOR_DVIA: | 1181 | case DRM_MODE_CONNECTOR_DVIA: |
1180 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1182 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
@@ -1190,6 +1192,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1190 | 1); | 1192 | 1); |
1191 | /* no HPD on analog connectors */ | 1193 | /* no HPD on analog connectors */ |
1192 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1194 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1195 | connector->interlace_allowed = true; | ||
1196 | connector->doublescan_allowed = true; | ||
1193 | break; | 1197 | break; |
1194 | case DRM_MODE_CONNECTOR_DVII: | 1198 | case DRM_MODE_CONNECTOR_DVII: |
1195 | case DRM_MODE_CONNECTOR_DVID: | 1199 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1226,6 +1230,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1226 | rdev->mode_info.load_detect_property, | 1230 | rdev->mode_info.load_detect_property, |
1227 | 1); | 1231 | 1); |
1228 | } | 1232 | } |
1233 | connector->interlace_allowed = true; | ||
1234 | if (connector_type == DRM_MODE_CONNECTOR_DVII) | ||
1235 | connector->doublescan_allowed = true; | ||
1236 | else | ||
1237 | connector->doublescan_allowed = false; | ||
1229 | break; | 1238 | break; |
1230 | case DRM_MODE_CONNECTOR_HDMIA: | 1239 | case DRM_MODE_CONNECTOR_HDMIA: |
1231 | case DRM_MODE_CONNECTOR_HDMIB: | 1240 | case DRM_MODE_CONNECTOR_HDMIB: |
@@ -1256,6 +1265,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1256 | 0); | 1265 | 0); |
1257 | } | 1266 | } |
1258 | subpixel_order = SubPixelHorizontalRGB; | 1267 | subpixel_order = SubPixelHorizontalRGB; |
1268 | connector->interlace_allowed = true; | ||
1269 | if (connector_type == DRM_MODE_CONNECTOR_HDMIB) | ||
1270 | connector->doublescan_allowed = true; | ||
1271 | else | ||
1272 | connector->doublescan_allowed = false; | ||
1259 | break; | 1273 | break; |
1260 | case DRM_MODE_CONNECTOR_DisplayPort: | 1274 | case DRM_MODE_CONNECTOR_DisplayPort: |
1261 | case DRM_MODE_CONNECTOR_eDP: | 1275 | case DRM_MODE_CONNECTOR_eDP: |
@@ -1293,6 +1307,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1293 | rdev->mode_info.underscan_vborder_property, | 1307 | rdev->mode_info.underscan_vborder_property, |
1294 | 0); | 1308 | 0); |
1295 | } | 1309 | } |
1310 | connector->interlace_allowed = true; | ||
1311 | /* in theory with a DP to VGA converter... */ | ||
1312 | connector->doublescan_allowed = false; | ||
1296 | break; | 1313 | break; |
1297 | case DRM_MODE_CONNECTOR_SVIDEO: | 1314 | case DRM_MODE_CONNECTOR_SVIDEO: |
1298 | case DRM_MODE_CONNECTOR_Composite: | 1315 | case DRM_MODE_CONNECTOR_Composite: |
@@ -1308,6 +1325,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1308 | radeon_atombios_get_tv_info(rdev)); | 1325 | radeon_atombios_get_tv_info(rdev)); |
1309 | /* no HPD on analog connectors */ | 1326 | /* no HPD on analog connectors */ |
1310 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1327 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1328 | connector->interlace_allowed = false; | ||
1329 | connector->doublescan_allowed = false; | ||
1311 | break; | 1330 | break; |
1312 | case DRM_MODE_CONNECTOR_LVDS: | 1331 | case DRM_MODE_CONNECTOR_LVDS: |
1313 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); | 1332 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
@@ -1326,6 +1345,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1326 | dev->mode_config.scaling_mode_property, | 1345 | dev->mode_config.scaling_mode_property, |
1327 | DRM_MODE_SCALE_FULLSCREEN); | 1346 | DRM_MODE_SCALE_FULLSCREEN); |
1328 | subpixel_order = SubPixelHorizontalRGB; | 1347 | subpixel_order = SubPixelHorizontalRGB; |
1348 | connector->interlace_allowed = false; | ||
1349 | connector->doublescan_allowed = false; | ||
1329 | break; | 1350 | break; |
1330 | } | 1351 | } |
1331 | 1352 | ||
@@ -1403,6 +1424,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1403 | /* no HPD on analog connectors */ | 1424 | /* no HPD on analog connectors */ |
1404 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1425 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1405 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | 1426 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1427 | connector->interlace_allowed = true; | ||
1428 | connector->doublescan_allowed = true; | ||
1406 | break; | 1429 | break; |
1407 | case DRM_MODE_CONNECTOR_DVIA: | 1430 | case DRM_MODE_CONNECTOR_DVIA: |
1408 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1431 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
@@ -1418,6 +1441,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1418 | 1); | 1441 | 1); |
1419 | /* no HPD on analog connectors */ | 1442 | /* no HPD on analog connectors */ |
1420 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1443 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1444 | connector->interlace_allowed = true; | ||
1445 | connector->doublescan_allowed = true; | ||
1421 | break; | 1446 | break; |
1422 | case DRM_MODE_CONNECTOR_DVII: | 1447 | case DRM_MODE_CONNECTOR_DVII: |
1423 | case DRM_MODE_CONNECTOR_DVID: | 1448 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1435,6 +1460,11 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1435 | 1); | 1460 | 1); |
1436 | } | 1461 | } |
1437 | subpixel_order = SubPixelHorizontalRGB; | 1462 | subpixel_order = SubPixelHorizontalRGB; |
1463 | connector->interlace_allowed = true; | ||
1464 | if (connector_type == DRM_MODE_CONNECTOR_DVII) | ||
1465 | connector->doublescan_allowed = true; | ||
1466 | else | ||
1467 | connector->doublescan_allowed = false; | ||
1438 | break; | 1468 | break; |
1439 | case DRM_MODE_CONNECTOR_SVIDEO: | 1469 | case DRM_MODE_CONNECTOR_SVIDEO: |
1440 | case DRM_MODE_CONNECTOR_Composite: | 1470 | case DRM_MODE_CONNECTOR_Composite: |
@@ -1457,6 +1487,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1457 | radeon_combios_get_tv_info(rdev)); | 1487 | radeon_combios_get_tv_info(rdev)); |
1458 | /* no HPD on analog connectors */ | 1488 | /* no HPD on analog connectors */ |
1459 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1489 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1490 | connector->interlace_allowed = false; | ||
1491 | connector->doublescan_allowed = false; | ||
1460 | break; | 1492 | break; |
1461 | case DRM_MODE_CONNECTOR_LVDS: | 1493 | case DRM_MODE_CONNECTOR_LVDS: |
1462 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); | 1494 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
@@ -1470,6 +1502,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1470 | dev->mode_config.scaling_mode_property, | 1502 | dev->mode_config.scaling_mode_property, |
1471 | DRM_MODE_SCALE_FULLSCREEN); | 1503 | DRM_MODE_SCALE_FULLSCREEN); |
1472 | subpixel_order = SubPixelHorizontalRGB; | 1504 | subpixel_order = SubPixelHorizontalRGB; |
1505 | connector->interlace_allowed = false; | ||
1506 | connector->doublescan_allowed = false; | ||
1473 | break; | 1507 | break; |
1474 | } | 1508 | } |
1475 | 1509 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index d8ac1849180d..501966a13f48 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -286,7 +286,7 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 | |||
286 | mc->mc_vram_size = mc->aper_size; | 286 | mc->mc_vram_size = mc->aper_size; |
287 | } | 287 | } |
288 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 288 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
289 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 289 | dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", |
290 | mc->mc_vram_size >> 20, mc->vram_start, | 290 | mc->mc_vram_size >> 20, mc->vram_start, |
291 | mc->vram_end, mc->real_vram_size >> 20); | 291 | mc->vram_end, mc->real_vram_size >> 20); |
292 | } | 292 | } |
@@ -323,7 +323,7 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
323 | mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align; | 323 | mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align; |
324 | } | 324 | } |
325 | mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; | 325 | mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; |
326 | dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n", | 326 | dev_info(rdev->dev, "GTT: %lluM 0x%016llX - 0x%016llX\n", |
327 | mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end); | 327 | mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end); |
328 | } | 328 | } |
329 | 329 | ||
@@ -910,11 +910,6 @@ int radeon_resume_kms(struct drm_device *dev) | |||
910 | radeon_pm_resume(rdev); | 910 | radeon_pm_resume(rdev); |
911 | radeon_restore_bios_scratch_regs(rdev); | 911 | radeon_restore_bios_scratch_regs(rdev); |
912 | 912 | ||
913 | /* turn on display hw */ | ||
914 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
915 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); | ||
916 | } | ||
917 | |||
918 | radeon_fbdev_set_suspend(rdev, 0); | 913 | radeon_fbdev_set_suspend(rdev, 0); |
919 | release_console_sem(); | 914 | release_console_sem(); |
920 | 915 | ||
@@ -922,6 +917,10 @@ int radeon_resume_kms(struct drm_device *dev) | |||
922 | radeon_hpd_init(rdev); | 917 | radeon_hpd_init(rdev); |
923 | /* blat the mode back in */ | 918 | /* blat the mode back in */ |
924 | drm_helper_resume_force_mode(dev); | 919 | drm_helper_resume_force_mode(dev); |
920 | /* turn on display hw */ | ||
921 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
922 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); | ||
923 | } | ||
925 | return 0; | 924 | return 0; |
926 | } | 925 | } |
927 | 926 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 88e4ea925900..60e689f2d048 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -232,9 +232,28 @@ static struct drm_driver driver_old = { | |||
232 | 232 | ||
233 | static struct drm_driver kms_driver; | 233 | static struct drm_driver kms_driver; |
234 | 234 | ||
235 | static void radeon_kick_out_firmware_fb(struct pci_dev *pdev) | ||
236 | { | ||
237 | struct apertures_struct *ap; | ||
238 | bool primary = false; | ||
239 | |||
240 | ap = alloc_apertures(1); | ||
241 | ap->ranges[0].base = pci_resource_start(pdev, 0); | ||
242 | ap->ranges[0].size = pci_resource_len(pdev, 0); | ||
243 | |||
244 | #ifdef CONFIG_X86 | ||
245 | primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | ||
246 | #endif | ||
247 | remove_conflicting_framebuffers(ap, "radeondrmfb", primary); | ||
248 | kfree(ap); | ||
249 | } | ||
250 | |||
235 | static int __devinit | 251 | static int __devinit |
236 | radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 252 | radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
237 | { | 253 | { |
254 | /* Get rid of things like offb */ | ||
255 | radeon_kick_out_firmware_fb(pdev); | ||
256 | |||
238 | return drm_get_pci_dev(pdev, ent, &kms_driver); | 257 | return drm_get_pci_dev(pdev, ent, &kms_driver); |
239 | } | 258 | } |
240 | 259 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index efa211898fe6..6abea32be5e8 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -245,7 +245,7 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev, | |||
245 | goto out_unref; | 245 | goto out_unref; |
246 | } | 246 | } |
247 | info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base; | 247 | info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base; |
248 | info->apertures->ranges[0].size = rdev->mc.real_vram_size; | 248 | info->apertures->ranges[0].size = rdev->mc.aper_size; |
249 | 249 | ||
250 | info->fix.mmio_start = 0; | 250 | info->fix.mmio_start = 0; |
251 | info->fix.mmio_len = 0; | 251 | info->fix.mmio_len = 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 1d067743fee0..a598d0049aa5 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) | |||
69 | u32 c = 0; | 69 | u32 c = 0; |
70 | 70 | ||
71 | rbo->placement.fpfn = 0; | 71 | rbo->placement.fpfn = 0; |
72 | rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT; | 72 | rbo->placement.lpfn = 0; |
73 | rbo->placement.placement = rbo->placements; | 73 | rbo->placement.placement = rbo->placements; |
74 | rbo->placement.busy_placement = rbo->placements; | 74 | rbo->placement.busy_placement = rbo->placements; |
75 | if (domain & RADEON_GEM_DOMAIN_VRAM) | 75 | if (domain & RADEON_GEM_DOMAIN_VRAM) |
@@ -91,7 +91,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, | |||
91 | { | 91 | { |
92 | struct radeon_bo *bo; | 92 | struct radeon_bo *bo; |
93 | enum ttm_bo_type type; | 93 | enum ttm_bo_type type; |
94 | int page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; | 94 | unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; |
95 | unsigned long max_size = 0; | ||
95 | int r; | 96 | int r; |
96 | 97 | ||
97 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { | 98 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { |
@@ -104,6 +105,14 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, | |||
104 | } | 105 | } |
105 | *bo_ptr = NULL; | 106 | *bo_ptr = NULL; |
106 | 107 | ||
108 | /* maximun bo size is the minimun btw visible vram and gtt size */ | ||
109 | max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); | ||
110 | if ((page_align << PAGE_SHIFT) >= max_size) { | ||
111 | printk(KERN_WARNING "%s:%d alloc size %ldM bigger than %ldMb limit\n", | ||
112 | __func__, __LINE__, page_align >> (20 - PAGE_SHIFT), max_size >> 20); | ||
113 | return -ENOMEM; | ||
114 | } | ||
115 | |||
107 | retry: | 116 | retry: |
108 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); | 117 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); |
109 | if (bo == NULL) | 118 | if (bo == NULL) |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 515345b11ac9..88cb04e7962b 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1386,6 +1386,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1386 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, | 1386 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, |
1387 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, | 1387 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, |
1388 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, | 1388 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, |
1389 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, | ||
1389 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, | 1390 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
1390 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, | 1391 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
1391 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, | 1392 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c index 54b017ad258d..5a1b52e0eb85 100644 --- a/drivers/hid/hid-egalax.c +++ b/drivers/hid/hid-egalax.c | |||
@@ -221,7 +221,7 @@ static int egalax_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
221 | struct egalax_data *td; | 221 | struct egalax_data *td; |
222 | struct hid_report *report; | 222 | struct hid_report *report; |
223 | 223 | ||
224 | td = kmalloc(sizeof(struct egalax_data), GFP_KERNEL); | 224 | td = kzalloc(sizeof(struct egalax_data), GFP_KERNEL); |
225 | if (!td) { | 225 | if (!td) { |
226 | dev_err(&hdev->dev, "cannot allocate eGalax data\n"); | 226 | dev_err(&hdev->dev, "cannot allocate eGalax data\n"); |
227 | return -ENOMEM; | 227 | return -ENOMEM; |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index bb0b3659437b..d8d372bae3cc 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -174,7 +174,7 @@ static int hidinput_setkeycode(struct input_dev *dev, | |||
174 | 174 | ||
175 | clear_bit(*old_keycode, dev->keybit); | 175 | clear_bit(*old_keycode, dev->keybit); |
176 | set_bit(usage->code, dev->keybit); | 176 | set_bit(usage->code, dev->keybit); |
177 | dbg_hid(KERN_DEBUG "Assigned keycode %d to HID usage code %x\n", | 177 | dbg_hid("Assigned keycode %d to HID usage code %x\n", |
178 | usage->code, usage->hid); | 178 | usage->code, usage->hid); |
179 | 179 | ||
180 | /* | 180 | /* |
@@ -203,8 +203,8 @@ static int hidinput_setkeycode(struct input_dev *dev, | |||
203 | * | 203 | * |
204 | * as seen in the HID specification v1.11 6.2.2.7 Global Items. | 204 | * as seen in the HID specification v1.11 6.2.2.7 Global Items. |
205 | * | 205 | * |
206 | * Only exponent 1 length units are processed. Centimeters are converted to | 206 | * Only exponent 1 length units are processed. Centimeters and inches are |
207 | * inches. Degrees are converted to radians. | 207 | * converted to millimeters. Degrees are converted to radians. |
208 | */ | 208 | */ |
209 | static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | 209 | static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) |
210 | { | 210 | { |
@@ -225,13 +225,16 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) | |||
225 | */ | 225 | */ |
226 | if (code == ABS_X || code == ABS_Y || code == ABS_Z) { | 226 | if (code == ABS_X || code == ABS_Y || code == ABS_Z) { |
227 | if (field->unit == 0x11) { /* If centimeters */ | 227 | if (field->unit == 0x11) { /* If centimeters */ |
228 | /* Convert to inches */ | 228 | /* Convert to millimeters */ |
229 | prev = logical_extents; | 229 | unit_exponent += 1; |
230 | logical_extents *= 254; | 230 | } else if (field->unit == 0x13) { /* If inches */ |
231 | if (logical_extents < prev) | 231 | /* Convert to millimeters */ |
232 | prev = physical_extents; | ||
233 | physical_extents *= 254; | ||
234 | if (physical_extents < prev) | ||
232 | return 0; | 235 | return 0; |
233 | unit_exponent += 2; | 236 | unit_exponent -= 1; |
234 | } else if (field->unit != 0x13) { /* If not inches */ | 237 | } else { |
235 | return 0; | 238 | return 0; |
236 | } | 239 | } |
237 | } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { | 240 | } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { |
diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c index 15434c814793..25be4e1461bd 100644 --- a/drivers/hid/hid-tmff.c +++ b/drivers/hid/hid-tmff.c | |||
@@ -256,6 +256,8 @@ static const struct hid_device_id tm_devices[] = { | |||
256 | .driver_data = (unsigned long)ff_joystick }, | 256 | .driver_data = (unsigned long)ff_joystick }, |
257 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654), /* FGT Force Feedback Wheel */ | 257 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654), /* FGT Force Feedback Wheel */ |
258 | .driver_data = (unsigned long)ff_joystick }, | 258 | .driver_data = (unsigned long)ff_joystick }, |
259 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a), /* F430 Force Feedback Wheel */ | ||
260 | .driver_data = (unsigned long)ff_joystick }, | ||
259 | { } | 261 | { } |
260 | }; | 262 | }; |
261 | MODULE_DEVICE_TABLE(hid, tm_devices); | 263 | MODULE_DEVICE_TABLE(hid, tm_devices); |
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 4bf969c0a32b..be0fdd58aa29 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
@@ -916,27 +916,27 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
916 | int nr = sensor_attr->index; | 916 | int nr = sensor_attr->index; |
917 | struct i2c_client *client = to_i2c_client(dev); | 917 | struct i2c_client *client = to_i2c_client(dev); |
918 | struct adm1026_data *data = i2c_get_clientdata(client); | 918 | struct adm1026_data *data = i2c_get_clientdata(client); |
919 | int val, orig_div, new_div, shift; | 919 | int val, orig_div, new_div; |
920 | 920 | ||
921 | val = simple_strtol(buf, NULL, 10); | 921 | val = simple_strtol(buf, NULL, 10); |
922 | new_div = DIV_TO_REG(val); | 922 | new_div = DIV_TO_REG(val); |
923 | if (new_div == 0) { | 923 | |
924 | return -EINVAL; | ||
925 | } | ||
926 | mutex_lock(&data->update_lock); | 924 | mutex_lock(&data->update_lock); |
927 | orig_div = data->fan_div[nr]; | 925 | orig_div = data->fan_div[nr]; |
928 | data->fan_div[nr] = DIV_FROM_REG(new_div); | 926 | data->fan_div[nr] = DIV_FROM_REG(new_div); |
929 | 927 | ||
930 | if (nr < 4) { /* 0 <= nr < 4 */ | 928 | if (nr < 4) { /* 0 <= nr < 4 */ |
931 | shift = 2 * nr; | ||
932 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, | 929 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, |
933 | ((DIV_TO_REG(orig_div) & (~(0x03 << shift))) | | 930 | (DIV_TO_REG(data->fan_div[0]) << 0) | |
934 | (new_div << shift))); | 931 | (DIV_TO_REG(data->fan_div[1]) << 2) | |
932 | (DIV_TO_REG(data->fan_div[2]) << 4) | | ||
933 | (DIV_TO_REG(data->fan_div[3]) << 6)); | ||
935 | } else { /* 3 < nr < 8 */ | 934 | } else { /* 3 < nr < 8 */ |
936 | shift = 2 * (nr - 4); | ||
937 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, | 935 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, |
938 | ((DIV_TO_REG(orig_div) & (~(0x03 << (2 * shift)))) | | 936 | (DIV_TO_REG(data->fan_div[4]) << 0) | |
939 | (new_div << shift))); | 937 | (DIV_TO_REG(data->fan_div[5]) << 2) | |
938 | (DIV_TO_REG(data->fan_div[6]) << 4) | | ||
939 | (DIV_TO_REG(data->fan_div[7]) << 6)); | ||
940 | } | 940 | } |
941 | 941 | ||
942 | if (data->fan_div[nr] != orig_div) { | 942 | if (data->fan_div[nr] != orig_div) { |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 14a5d981be7d..a428a9264195 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -187,6 +187,7 @@ static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; | |||
187 | #define IT87_REG_FAN_MAIN_CTRL 0x13 | 187 | #define IT87_REG_FAN_MAIN_CTRL 0x13 |
188 | #define IT87_REG_FAN_CTL 0x14 | 188 | #define IT87_REG_FAN_CTL 0x14 |
189 | #define IT87_REG_PWM(nr) (0x15 + (nr)) | 189 | #define IT87_REG_PWM(nr) (0x15 + (nr)) |
190 | #define IT87_REG_PWM_DUTY(nr) (0x63 + (nr) * 8) | ||
190 | 191 | ||
191 | #define IT87_REG_VIN(nr) (0x20 + (nr)) | 192 | #define IT87_REG_VIN(nr) (0x20 + (nr)) |
192 | #define IT87_REG_TEMP(nr) (0x29 + (nr)) | 193 | #define IT87_REG_TEMP(nr) (0x29 + (nr)) |
@@ -251,12 +252,16 @@ struct it87_data { | |||
251 | u8 fan_main_ctrl; /* Register value */ | 252 | u8 fan_main_ctrl; /* Register value */ |
252 | u8 fan_ctl; /* Register value */ | 253 | u8 fan_ctl; /* Register value */ |
253 | 254 | ||
254 | /* The following 3 arrays correspond to the same registers. The | 255 | /* The following 3 arrays correspond to the same registers up to |
255 | * meaning of bits 6-0 depends on the value of bit 7, and we want | 256 | * the IT8720F. The meaning of bits 6-0 depends on the value of bit |
256 | * to preserve settings on mode changes, so we have to track all | 257 | * 7, and we want to preserve settings on mode changes, so we have |
257 | * values separately. */ | 258 | * to track all values separately. |
259 | * Starting with the IT8721F, the manual PWM duty cycles are stored | ||
260 | * in separate registers (8-bit values), so the separate tracking | ||
261 | * is no longer needed, but it is still done to keep the driver | ||
262 | * simple. */ | ||
258 | u8 pwm_ctrl[3]; /* Register value */ | 263 | u8 pwm_ctrl[3]; /* Register value */ |
259 | u8 pwm_duty[3]; /* Manual PWM value set by user (bit 6-0) */ | 264 | u8 pwm_duty[3]; /* Manual PWM value set by user */ |
260 | u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */ | 265 | u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */ |
261 | 266 | ||
262 | /* Automatic fan speed control registers */ | 267 | /* Automatic fan speed control registers */ |
@@ -832,7 +837,9 @@ static ssize_t set_pwm_enable(struct device *dev, | |||
832 | data->fan_main_ctrl); | 837 | data->fan_main_ctrl); |
833 | } else { | 838 | } else { |
834 | if (val == 1) /* Manual mode */ | 839 | if (val == 1) /* Manual mode */ |
835 | data->pwm_ctrl[nr] = data->pwm_duty[nr]; | 840 | data->pwm_ctrl[nr] = data->type == it8721 ? |
841 | data->pwm_temp_map[nr] : | ||
842 | data->pwm_duty[nr]; | ||
836 | else /* Automatic mode */ | 843 | else /* Automatic mode */ |
837 | data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; | 844 | data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; |
838 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); | 845 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); |
@@ -858,12 +865,25 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | |||
858 | return -EINVAL; | 865 | return -EINVAL; |
859 | 866 | ||
860 | mutex_lock(&data->update_lock); | 867 | mutex_lock(&data->update_lock); |
861 | data->pwm_duty[nr] = pwm_to_reg(data, val); | 868 | if (data->type == it8721) { |
862 | /* If we are in manual mode, write the duty cycle immediately; | 869 | /* If we are in automatic mode, the PWM duty cycle register |
863 | * otherwise, just store it for later use. */ | 870 | * is read-only so we can't write the value */ |
864 | if (!(data->pwm_ctrl[nr] & 0x80)) { | 871 | if (data->pwm_ctrl[nr] & 0x80) { |
865 | data->pwm_ctrl[nr] = data->pwm_duty[nr]; | 872 | mutex_unlock(&data->update_lock); |
866 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); | 873 | return -EBUSY; |
874 | } | ||
875 | data->pwm_duty[nr] = pwm_to_reg(data, val); | ||
876 | it87_write_value(data, IT87_REG_PWM_DUTY(nr), | ||
877 | data->pwm_duty[nr]); | ||
878 | } else { | ||
879 | data->pwm_duty[nr] = pwm_to_reg(data, val); | ||
880 | /* If we are in manual mode, write the duty cycle immediately; | ||
881 | * otherwise, just store it for later use. */ | ||
882 | if (!(data->pwm_ctrl[nr] & 0x80)) { | ||
883 | data->pwm_ctrl[nr] = data->pwm_duty[nr]; | ||
884 | it87_write_value(data, IT87_REG_PWM(nr), | ||
885 | data->pwm_ctrl[nr]); | ||
886 | } | ||
867 | } | 887 | } |
868 | mutex_unlock(&data->update_lock); | 888 | mutex_unlock(&data->update_lock); |
869 | return count; | 889 | return count; |
@@ -1958,7 +1978,10 @@ static void __devinit it87_init_device(struct platform_device *pdev) | |||
1958 | * channels to use when later setting to automatic mode later. | 1978 | * channels to use when later setting to automatic mode later. |
1959 | * Use a 1:1 mapping by default (we are clueless.) | 1979 | * Use a 1:1 mapping by default (we are clueless.) |
1960 | * In both cases, the value can (and should) be changed by the user | 1980 | * In both cases, the value can (and should) be changed by the user |
1961 | * prior to switching to a different mode. */ | 1981 | * prior to switching to a different mode. |
1982 | * Note that this is no longer needed for the IT8721F and later, as | ||
1983 | * these have separate registers for the temperature mapping and the | ||
1984 | * manual duty cycle. */ | ||
1962 | for (i = 0; i < 3; i++) { | 1985 | for (i = 0; i < 3; i++) { |
1963 | data->pwm_temp_map[i] = i; | 1986 | data->pwm_temp_map[i] = i; |
1964 | data->pwm_duty[i] = 0x7f; /* Full speed */ | 1987 | data->pwm_duty[i] = 0x7f; /* Full speed */ |
@@ -2034,10 +2057,16 @@ static void __devinit it87_init_device(struct platform_device *pdev) | |||
2034 | static void it87_update_pwm_ctrl(struct it87_data *data, int nr) | 2057 | static void it87_update_pwm_ctrl(struct it87_data *data, int nr) |
2035 | { | 2058 | { |
2036 | data->pwm_ctrl[nr] = it87_read_value(data, IT87_REG_PWM(nr)); | 2059 | data->pwm_ctrl[nr] = it87_read_value(data, IT87_REG_PWM(nr)); |
2037 | if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ | 2060 | if (data->type == it8721) { |
2038 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; | 2061 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; |
2039 | else /* Manual mode */ | 2062 | data->pwm_duty[nr] = it87_read_value(data, |
2040 | data->pwm_duty[nr] = data->pwm_ctrl[nr] & 0x7f; | 2063 | IT87_REG_PWM_DUTY(nr)); |
2064 | } else { | ||
2065 | if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ | ||
2066 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; | ||
2067 | else /* Manual mode */ | ||
2068 | data->pwm_duty[nr] = data->pwm_ctrl[nr] & 0x7f; | ||
2069 | } | ||
2041 | 2070 | ||
2042 | if (has_old_autopwm(data)) { | 2071 | if (has_old_autopwm(data)) { |
2043 | int i; | 2072 | int i; |
diff --git a/drivers/hwmon/ltc4215.c b/drivers/hwmon/ltc4215.c index 00d975eb5b83..c7e6d8e81656 100644 --- a/drivers/hwmon/ltc4215.c +++ b/drivers/hwmon/ltc4215.c | |||
@@ -205,7 +205,6 @@ LTC4215_ALARM(curr1_max_alarm, (1 << 2), LTC4215_STATUS); | |||
205 | 205 | ||
206 | /* Power (virtual) */ | 206 | /* Power (virtual) */ |
207 | LTC4215_POWER(power1_input); | 207 | LTC4215_POWER(power1_input); |
208 | LTC4215_ALARM(power1_alarm, (1 << 3), LTC4215_STATUS); | ||
209 | 208 | ||
210 | /* Input Voltage */ | 209 | /* Input Voltage */ |
211 | LTC4215_VOLTAGE(in1_input, LTC4215_ADIN); | 210 | LTC4215_VOLTAGE(in1_input, LTC4215_ADIN); |
@@ -214,6 +213,7 @@ LTC4215_ALARM(in1_min_alarm, (1 << 1), LTC4215_STATUS); | |||
214 | 213 | ||
215 | /* Output Voltage */ | 214 | /* Output Voltage */ |
216 | LTC4215_VOLTAGE(in2_input, LTC4215_SOURCE); | 215 | LTC4215_VOLTAGE(in2_input, LTC4215_SOURCE); |
216 | LTC4215_ALARM(in2_min_alarm, (1 << 3), LTC4215_STATUS); | ||
217 | 217 | ||
218 | /* Finally, construct an array of pointers to members of the above objects, | 218 | /* Finally, construct an array of pointers to members of the above objects, |
219 | * as required for sysfs_create_group() | 219 | * as required for sysfs_create_group() |
@@ -223,13 +223,13 @@ static struct attribute *ltc4215_attributes[] = { | |||
223 | &sensor_dev_attr_curr1_max_alarm.dev_attr.attr, | 223 | &sensor_dev_attr_curr1_max_alarm.dev_attr.attr, |
224 | 224 | ||
225 | &sensor_dev_attr_power1_input.dev_attr.attr, | 225 | &sensor_dev_attr_power1_input.dev_attr.attr, |
226 | &sensor_dev_attr_power1_alarm.dev_attr.attr, | ||
227 | 226 | ||
228 | &sensor_dev_attr_in1_input.dev_attr.attr, | 227 | &sensor_dev_attr_in1_input.dev_attr.attr, |
229 | &sensor_dev_attr_in1_max_alarm.dev_attr.attr, | 228 | &sensor_dev_attr_in1_max_alarm.dev_attr.attr, |
230 | &sensor_dev_attr_in1_min_alarm.dev_attr.attr, | 229 | &sensor_dev_attr_in1_min_alarm.dev_attr.attr, |
231 | 230 | ||
232 | &sensor_dev_attr_in2_input.dev_attr.attr, | 231 | &sensor_dev_attr_in2_input.dev_attr.attr, |
232 | &sensor_dev_attr_in2_min_alarm.dev_attr.attr, | ||
233 | 233 | ||
234 | NULL, | 234 | NULL, |
235 | }; | 235 | }; |
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index b923074b2cbe..30f06e956bfb 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig | |||
@@ -75,8 +75,7 @@ config I2C_HELPER_AUTO | |||
75 | In doubt, say Y. | 75 | In doubt, say Y. |
76 | 76 | ||
77 | config I2C_SMBUS | 77 | config I2C_SMBUS |
78 | tristate | 78 | tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO |
79 | prompt "SMBus-specific protocols" if !I2C_HELPER_AUTO | ||
80 | help | 79 | help |
81 | Say Y here if you want support for SMBus extensions to the I2C | 80 | Say Y here if you want support for SMBus extensions to the I2C |
82 | specification. At the moment, the only supported extension is | 81 | specification. At the moment, the only supported extension is |
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig index 3998dd620a03..f1cfe7e5508b 100644 --- a/drivers/i2c/algos/Kconfig +++ b/drivers/i2c/algos/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menu "I2C Algorithms" | 5 | menu "I2C Algorithms" |
6 | depends on !I2C_HELPER_AUTO | 6 | visible if !I2C_HELPER_AUTO |
7 | 7 | ||
8 | config I2C_ALGOBIT | 8 | config I2C_ALGOBIT |
9 | tristate "I2C bit-banging interfaces" | 9 | tristate "I2C bit-banging interfaces" |
@@ -15,15 +15,3 @@ config I2C_ALGOPCA | |||
15 | tristate "I2C PCA 9564 interfaces" | 15 | tristate "I2C PCA 9564 interfaces" |
16 | 16 | ||
17 | endmenu | 17 | endmenu |
18 | |||
19 | # In automatic configuration mode, we still have to define the | ||
20 | # symbols to avoid unmet dependencies. | ||
21 | |||
22 | if I2C_HELPER_AUTO | ||
23 | config I2C_ALGOBIT | ||
24 | tristate | ||
25 | config I2C_ALGOPCF | ||
26 | tristate | ||
27 | config I2C_ALGOPCA | ||
28 | tristate | ||
29 | endif | ||
diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c index 80f70d3a744d..c71492782bbd 100644 --- a/drivers/i2c/busses/i2c-intel-mid.c +++ b/drivers/i2c/busses/i2c-intel-mid.c | |||
@@ -999,7 +999,7 @@ static int __devinit intel_mid_i2c_probe(struct pci_dev *dev, | |||
999 | 999 | ||
1000 | /* Initialize struct members */ | 1000 | /* Initialize struct members */ |
1001 | snprintf(mrst->adap.name, sizeof(mrst->adap.name), | 1001 | snprintf(mrst->adap.name, sizeof(mrst->adap.name), |
1002 | "MRST/Medfield I2C at %lx", start); | 1002 | "Intel MID I2C at %lx", start); |
1003 | mrst->adap.owner = THIS_MODULE; | 1003 | mrst->adap.owner = THIS_MODULE; |
1004 | mrst->adap.algo = &intel_mid_i2c_algorithm; | 1004 | mrst->adap.algo = &intel_mid_i2c_algorithm; |
1005 | mrst->adap.dev.parent = &dev->dev; | 1005 | mrst->adap.dev.parent = &dev->dev; |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 41665d2f9f93..c131d58bcb50 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -273,8 +273,6 @@ static int intel_idle_probe(void) | |||
273 | 273 | ||
274 | pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates); | 274 | pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates); |
275 | 275 | ||
276 | if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ | ||
277 | lapic_timer_reliable_states = 0xFFFFFFFF; | ||
278 | 276 | ||
279 | if (boot_cpu_data.x86 != 6) /* family 6 */ | 277 | if (boot_cpu_data.x86 != 6) /* family 6 */ |
280 | return -ENODEV; | 278 | return -ENODEV; |
@@ -286,8 +284,6 @@ static int intel_idle_probe(void) | |||
286 | case 0x1F: /* Core i7 and i5 Processor - Nehalem */ | 284 | case 0x1F: /* Core i7 and i5 Processor - Nehalem */ |
287 | case 0x2E: /* Nehalem-EX Xeon */ | 285 | case 0x2E: /* Nehalem-EX Xeon */ |
288 | case 0x2F: /* Westmere-EX Xeon */ | 286 | case 0x2F: /* Westmere-EX Xeon */ |
289 | lapic_timer_reliable_states = (1 << 1); /* C1 */ | ||
290 | |||
291 | case 0x25: /* Westmere */ | 287 | case 0x25: /* Westmere */ |
292 | case 0x2C: /* Westmere */ | 288 | case 0x2C: /* Westmere */ |
293 | cpuidle_state_table = nehalem_cstates; | 289 | cpuidle_state_table = nehalem_cstates; |
@@ -295,7 +291,6 @@ static int intel_idle_probe(void) | |||
295 | 291 | ||
296 | case 0x1C: /* 28 - Atom Processor */ | 292 | case 0x1C: /* 28 - Atom Processor */ |
297 | case 0x26: /* 38 - Lincroft Atom Processor */ | 293 | case 0x26: /* 38 - Lincroft Atom Processor */ |
298 | lapic_timer_reliable_states = (1 << 1); /* C1 */ | ||
299 | cpuidle_state_table = atom_cstates; | 294 | cpuidle_state_table = atom_cstates; |
300 | break; | 295 | break; |
301 | 296 | ||
@@ -303,10 +298,6 @@ static int intel_idle_probe(void) | |||
303 | case 0x2D: /* SNB Xeon */ | 298 | case 0x2D: /* SNB Xeon */ |
304 | cpuidle_state_table = snb_cstates; | 299 | cpuidle_state_table = snb_cstates; |
305 | break; | 300 | break; |
306 | #ifdef FUTURE_USE | ||
307 | case 0x17: /* 23 - Core 2 Duo */ | ||
308 | lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */ | ||
309 | #endif | ||
310 | 301 | ||
311 | default: | 302 | default: |
312 | pr_debug(PREFIX "does not run on family %d model %d\n", | 303 | pr_debug(PREFIX "does not run on family %d model %d\n", |
@@ -314,6 +305,9 @@ static int intel_idle_probe(void) | |||
314 | return -ENODEV; | 305 | return -ENODEV; |
315 | } | 306 | } |
316 | 307 | ||
308 | if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ | ||
309 | lapic_timer_reliable_states = 0xFFFFFFFF; | ||
310 | |||
317 | pr_debug(PREFIX "v" INTEL_IDLE_VERSION | 311 | pr_debug(PREFIX "v" INTEL_IDLE_VERSION |
318 | " model 0x%X\n", boot_cpu_data.x86_model); | 312 | " model 0x%X\n", boot_cpu_data.x86_model); |
319 | 313 | ||
diff --git a/drivers/infiniband/core/ud_header.c b/drivers/infiniband/core/ud_header.c index bb7e19280821..9b737ff133e2 100644 --- a/drivers/infiniband/core/ud_header.c +++ b/drivers/infiniband/core/ud_header.c | |||
@@ -278,36 +278,6 @@ void ib_ud_header_init(int payload_bytes, | |||
278 | EXPORT_SYMBOL(ib_ud_header_init); | 278 | EXPORT_SYMBOL(ib_ud_header_init); |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * ib_lrh_header_pack - Pack LRH header struct into wire format | ||
282 | * @lrh:unpacked LRH header struct | ||
283 | * @buf:Buffer to pack into | ||
284 | * | ||
285 | * ib_lrh_header_pack() packs the LRH header structure @lrh into | ||
286 | * wire format in the buffer @buf. | ||
287 | */ | ||
288 | int ib_lrh_header_pack(struct ib_unpacked_lrh *lrh, void *buf) | ||
289 | { | ||
290 | ib_pack(lrh_table, ARRAY_SIZE(lrh_table), lrh, buf); | ||
291 | return 0; | ||
292 | } | ||
293 | EXPORT_SYMBOL(ib_lrh_header_pack); | ||
294 | |||
295 | /** | ||
296 | * ib_lrh_header_unpack - Unpack LRH structure from wire format | ||
297 | * @lrh:unpacked LRH header struct | ||
298 | * @buf:Buffer to pack into | ||
299 | * | ||
300 | * ib_lrh_header_unpack() unpacks the LRH header structure from | ||
301 | * wire format (in buf) into @lrh. | ||
302 | */ | ||
303 | int ib_lrh_header_unpack(void *buf, struct ib_unpacked_lrh *lrh) | ||
304 | { | ||
305 | ib_unpack(lrh_table, ARRAY_SIZE(lrh_table), buf, lrh); | ||
306 | return 0; | ||
307 | } | ||
308 | EXPORT_SYMBOL(ib_lrh_header_unpack); | ||
309 | |||
310 | /** | ||
311 | * ib_ud_header_pack - Pack UD header struct into wire format | 281 | * ib_ud_header_pack - Pack UD header struct into wire format |
312 | * @header:UD header struct | 282 | * @header:UD header struct |
313 | * @buf:Buffer to pack into | 283 | * @buf:Buffer to pack into |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index b342248aec05..c42699285f8e 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -893,68 +893,81 @@ out: | |||
893 | return ret ? ret : in_len; | 893 | return ret ? ret : in_len; |
894 | } | 894 | } |
895 | 895 | ||
896 | static int copy_wc_to_user(void __user *dest, struct ib_wc *wc) | ||
897 | { | ||
898 | struct ib_uverbs_wc tmp; | ||
899 | |||
900 | tmp.wr_id = wc->wr_id; | ||
901 | tmp.status = wc->status; | ||
902 | tmp.opcode = wc->opcode; | ||
903 | tmp.vendor_err = wc->vendor_err; | ||
904 | tmp.byte_len = wc->byte_len; | ||
905 | tmp.ex.imm_data = (__u32 __force) wc->ex.imm_data; | ||
906 | tmp.qp_num = wc->qp->qp_num; | ||
907 | tmp.src_qp = wc->src_qp; | ||
908 | tmp.wc_flags = wc->wc_flags; | ||
909 | tmp.pkey_index = wc->pkey_index; | ||
910 | tmp.slid = wc->slid; | ||
911 | tmp.sl = wc->sl; | ||
912 | tmp.dlid_path_bits = wc->dlid_path_bits; | ||
913 | tmp.port_num = wc->port_num; | ||
914 | tmp.reserved = 0; | ||
915 | |||
916 | if (copy_to_user(dest, &tmp, sizeof tmp)) | ||
917 | return -EFAULT; | ||
918 | |||
919 | return 0; | ||
920 | } | ||
921 | |||
896 | ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, | 922 | ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, |
897 | const char __user *buf, int in_len, | 923 | const char __user *buf, int in_len, |
898 | int out_len) | 924 | int out_len) |
899 | { | 925 | { |
900 | struct ib_uverbs_poll_cq cmd; | 926 | struct ib_uverbs_poll_cq cmd; |
901 | struct ib_uverbs_poll_cq_resp *resp; | 927 | struct ib_uverbs_poll_cq_resp resp; |
928 | u8 __user *header_ptr; | ||
929 | u8 __user *data_ptr; | ||
902 | struct ib_cq *cq; | 930 | struct ib_cq *cq; |
903 | struct ib_wc *wc; | 931 | struct ib_wc wc; |
904 | int ret = 0; | 932 | int ret; |
905 | int i; | ||
906 | int rsize; | ||
907 | 933 | ||
908 | if (copy_from_user(&cmd, buf, sizeof cmd)) | 934 | if (copy_from_user(&cmd, buf, sizeof cmd)) |
909 | return -EFAULT; | 935 | return -EFAULT; |
910 | 936 | ||
911 | wc = kmalloc(cmd.ne * sizeof *wc, GFP_KERNEL); | ||
912 | if (!wc) | ||
913 | return -ENOMEM; | ||
914 | |||
915 | rsize = sizeof *resp + cmd.ne * sizeof(struct ib_uverbs_wc); | ||
916 | resp = kmalloc(rsize, GFP_KERNEL); | ||
917 | if (!resp) { | ||
918 | ret = -ENOMEM; | ||
919 | goto out_wc; | ||
920 | } | ||
921 | |||
922 | cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); | 937 | cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); |
923 | if (!cq) { | 938 | if (!cq) |
924 | ret = -EINVAL; | 939 | return -EINVAL; |
925 | goto out; | ||
926 | } | ||
927 | 940 | ||
928 | resp->count = ib_poll_cq(cq, cmd.ne, wc); | 941 | /* we copy a struct ib_uverbs_poll_cq_resp to user space */ |
942 | header_ptr = (void __user *)(unsigned long) cmd.response; | ||
943 | data_ptr = header_ptr + sizeof resp; | ||
929 | 944 | ||
930 | put_cq_read(cq); | 945 | memset(&resp, 0, sizeof resp); |
946 | while (resp.count < cmd.ne) { | ||
947 | ret = ib_poll_cq(cq, 1, &wc); | ||
948 | if (ret < 0) | ||
949 | goto out_put; | ||
950 | if (!ret) | ||
951 | break; | ||
952 | |||
953 | ret = copy_wc_to_user(data_ptr, &wc); | ||
954 | if (ret) | ||
955 | goto out_put; | ||
931 | 956 | ||
932 | for (i = 0; i < resp->count; i++) { | 957 | data_ptr += sizeof(struct ib_uverbs_wc); |
933 | resp->wc[i].wr_id = wc[i].wr_id; | 958 | ++resp.count; |
934 | resp->wc[i].status = wc[i].status; | ||
935 | resp->wc[i].opcode = wc[i].opcode; | ||
936 | resp->wc[i].vendor_err = wc[i].vendor_err; | ||
937 | resp->wc[i].byte_len = wc[i].byte_len; | ||
938 | resp->wc[i].ex.imm_data = (__u32 __force) wc[i].ex.imm_data; | ||
939 | resp->wc[i].qp_num = wc[i].qp->qp_num; | ||
940 | resp->wc[i].src_qp = wc[i].src_qp; | ||
941 | resp->wc[i].wc_flags = wc[i].wc_flags; | ||
942 | resp->wc[i].pkey_index = wc[i].pkey_index; | ||
943 | resp->wc[i].slid = wc[i].slid; | ||
944 | resp->wc[i].sl = wc[i].sl; | ||
945 | resp->wc[i].dlid_path_bits = wc[i].dlid_path_bits; | ||
946 | resp->wc[i].port_num = wc[i].port_num; | ||
947 | } | 959 | } |
948 | 960 | ||
949 | if (copy_to_user((void __user *) (unsigned long) cmd.response, resp, rsize)) | 961 | if (copy_to_user(header_ptr, &resp, sizeof resp)) { |
950 | ret = -EFAULT; | 962 | ret = -EFAULT; |
963 | goto out_put; | ||
964 | } | ||
951 | 965 | ||
952 | out: | 966 | ret = in_len; |
953 | kfree(resp); | ||
954 | 967 | ||
955 | out_wc: | 968 | out_put: |
956 | kfree(wc); | 969 | put_cq_read(cq); |
957 | return ret ? ret : in_len; | 970 | return ret; |
958 | } | 971 | } |
959 | 972 | ||
960 | ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, | 973 | ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, |
diff --git a/drivers/infiniband/core/uverbs_marshall.c b/drivers/infiniband/core/uverbs_marshall.c index 5440da0e59b4..1b1146f87124 100644 --- a/drivers/infiniband/core/uverbs_marshall.c +++ b/drivers/infiniband/core/uverbs_marshall.c | |||
@@ -40,18 +40,21 @@ void ib_copy_ah_attr_to_user(struct ib_uverbs_ah_attr *dst, | |||
40 | dst->grh.sgid_index = src->grh.sgid_index; | 40 | dst->grh.sgid_index = src->grh.sgid_index; |
41 | dst->grh.hop_limit = src->grh.hop_limit; | 41 | dst->grh.hop_limit = src->grh.hop_limit; |
42 | dst->grh.traffic_class = src->grh.traffic_class; | 42 | dst->grh.traffic_class = src->grh.traffic_class; |
43 | memset(&dst->grh.reserved, 0, sizeof(dst->grh.reserved)); | ||
43 | dst->dlid = src->dlid; | 44 | dst->dlid = src->dlid; |
44 | dst->sl = src->sl; | 45 | dst->sl = src->sl; |
45 | dst->src_path_bits = src->src_path_bits; | 46 | dst->src_path_bits = src->src_path_bits; |
46 | dst->static_rate = src->static_rate; | 47 | dst->static_rate = src->static_rate; |
47 | dst->is_global = src->ah_flags & IB_AH_GRH ? 1 : 0; | 48 | dst->is_global = src->ah_flags & IB_AH_GRH ? 1 : 0; |
48 | dst->port_num = src->port_num; | 49 | dst->port_num = src->port_num; |
50 | dst->reserved = 0; | ||
49 | } | 51 | } |
50 | EXPORT_SYMBOL(ib_copy_ah_attr_to_user); | 52 | EXPORT_SYMBOL(ib_copy_ah_attr_to_user); |
51 | 53 | ||
52 | void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst, | 54 | void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst, |
53 | struct ib_qp_attr *src) | 55 | struct ib_qp_attr *src) |
54 | { | 56 | { |
57 | dst->qp_state = src->qp_state; | ||
55 | dst->cur_qp_state = src->cur_qp_state; | 58 | dst->cur_qp_state = src->cur_qp_state; |
56 | dst->path_mtu = src->path_mtu; | 59 | dst->path_mtu = src->path_mtu; |
57 | dst->path_mig_state = src->path_mig_state; | 60 | dst->path_mig_state = src->path_mig_state; |
@@ -83,6 +86,7 @@ void ib_copy_qp_attr_to_user(struct ib_uverbs_qp_attr *dst, | |||
83 | dst->rnr_retry = src->rnr_retry; | 86 | dst->rnr_retry = src->rnr_retry; |
84 | dst->alt_port_num = src->alt_port_num; | 87 | dst->alt_port_num = src->alt_port_num; |
85 | dst->alt_timeout = src->alt_timeout; | 88 | dst->alt_timeout = src->alt_timeout; |
89 | memset(dst->reserved, 0, sizeof(dst->reserved)); | ||
86 | } | 90 | } |
87 | EXPORT_SYMBOL(ib_copy_qp_attr_to_user); | 91 | EXPORT_SYMBOL(ib_copy_qp_attr_to_user); |
88 | 92 | ||
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index bf3e20cd0298..30e09caf0da9 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -219,7 +219,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
219 | struct net_device *ndev; | 219 | struct net_device *ndev; |
220 | enum ib_mtu tmp; | 220 | enum ib_mtu tmp; |
221 | 221 | ||
222 | props->active_width = IB_WIDTH_4X; | 222 | props->active_width = IB_WIDTH_1X; |
223 | props->active_speed = 4; | 223 | props->active_speed = 4; |
224 | props->port_cap_flags = IB_PORT_CM_SUP; | 224 | props->port_cap_flags = IB_PORT_CM_SUP; |
225 | props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port]; | 225 | props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port]; |
@@ -242,7 +242,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
242 | tmp = iboe_get_mtu(ndev->mtu); | 242 | tmp = iboe_get_mtu(ndev->mtu); |
243 | props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256; | 243 | props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256; |
244 | 244 | ||
245 | props->state = netif_running(ndev) && netif_oper_up(ndev) ? | 245 | props->state = (netif_running(ndev) && netif_carrier_ok(ndev)) ? |
246 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 246 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
247 | props->phys_state = state_to_phys_state(props->state); | 247 | props->phys_state = state_to_phys_state(props->state); |
248 | 248 | ||
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 9a7794ac34c1..2001f20a4361 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1816,6 +1816,11 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1816 | ctrl->fence_size = (wr->send_flags & IB_SEND_FENCE ? | 1816 | ctrl->fence_size = (wr->send_flags & IB_SEND_FENCE ? |
1817 | MLX4_WQE_CTRL_FENCE : 0) | size; | 1817 | MLX4_WQE_CTRL_FENCE : 0) | size; |
1818 | 1818 | ||
1819 | if (be16_to_cpu(vlan) < 0x1000) { | ||
1820 | ctrl->ins_vlan = 1 << 6; | ||
1821 | ctrl->vlan_tag = vlan; | ||
1822 | } | ||
1823 | |||
1819 | /* | 1824 | /* |
1820 | * Make sure descriptor is fully written before | 1825 | * Make sure descriptor is fully written before |
1821 | * setting ownership bit (because HW can start | 1826 | * setting ownership bit (because HW can start |
@@ -1831,11 +1836,6 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1831 | ctrl->owner_opcode = mlx4_ib_opcode[wr->opcode] | | 1836 | ctrl->owner_opcode = mlx4_ib_opcode[wr->opcode] | |
1832 | (ind & qp->sq.wqe_cnt ? cpu_to_be32(1 << 31) : 0) | blh; | 1837 | (ind & qp->sq.wqe_cnt ? cpu_to_be32(1 << 31) : 0) | blh; |
1833 | 1838 | ||
1834 | if (be16_to_cpu(vlan) < 0x1000) { | ||
1835 | ctrl->ins_vlan = 1 << 6; | ||
1836 | ctrl->vlan_tag = vlan; | ||
1837 | } | ||
1838 | |||
1839 | stamp = ind + qp->sq_spare_wqes; | 1839 | stamp = ind + qp->sq_spare_wqes; |
1840 | ind += DIV_ROUND_UP(size * 16, 1U << qp->sq.wqe_shift); | 1840 | ind += DIV_ROUND_UP(size * 16, 1U << qp->sq.wqe_shift); |
1841 | 1841 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index e3f7fc6f9565..68f09a868434 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -534,76 +534,73 @@ static int handle_eviocgbit(struct input_dev *dev, | |||
534 | } | 534 | } |
535 | #undef OLD_KEY_MAX | 535 | #undef OLD_KEY_MAX |
536 | 536 | ||
537 | static int evdev_handle_get_keycode(struct input_dev *dev, | 537 | static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p) |
538 | void __user *p, size_t size) | ||
539 | { | 538 | { |
540 | struct input_keymap_entry ke; | 539 | struct input_keymap_entry ke = { |
540 | .len = sizeof(unsigned int), | ||
541 | .flags = 0, | ||
542 | }; | ||
543 | int __user *ip = (int __user *)p; | ||
541 | int error; | 544 | int error; |
542 | 545 | ||
543 | memset(&ke, 0, sizeof(ke)); | 546 | /* legacy case */ |
544 | 547 | if (copy_from_user(ke.scancode, p, sizeof(unsigned int))) | |
545 | if (size == sizeof(unsigned int[2])) { | 548 | return -EFAULT; |
546 | /* legacy case */ | ||
547 | int __user *ip = (int __user *)p; | ||
548 | 549 | ||
549 | if (copy_from_user(ke.scancode, p, sizeof(unsigned int))) | 550 | error = input_get_keycode(dev, &ke); |
550 | return -EFAULT; | 551 | if (error) |
552 | return error; | ||
551 | 553 | ||
552 | ke.len = sizeof(unsigned int); | 554 | if (put_user(ke.keycode, ip + 1)) |
553 | ke.flags = 0; | 555 | return -EFAULT; |
554 | 556 | ||
555 | error = input_get_keycode(dev, &ke); | 557 | return 0; |
556 | if (error) | 558 | } |
557 | return error; | ||
558 | 559 | ||
559 | if (put_user(ke.keycode, ip + 1)) | 560 | static int evdev_handle_get_keycode_v2(struct input_dev *dev, void __user *p) |
560 | return -EFAULT; | 561 | { |
562 | struct input_keymap_entry ke; | ||
563 | int error; | ||
561 | 564 | ||
562 | } else { | 565 | if (copy_from_user(&ke, p, sizeof(ke))) |
563 | size = min(size, sizeof(ke)); | 566 | return -EFAULT; |
564 | 567 | ||
565 | if (copy_from_user(&ke, p, size)) | 568 | error = input_get_keycode(dev, &ke); |
566 | return -EFAULT; | 569 | if (error) |
570 | return error; | ||
567 | 571 | ||
568 | error = input_get_keycode(dev, &ke); | 572 | if (copy_to_user(p, &ke, sizeof(ke))) |
569 | if (error) | 573 | return -EFAULT; |
570 | return error; | ||
571 | 574 | ||
572 | if (copy_to_user(p, &ke, size)) | ||
573 | return -EFAULT; | ||
574 | } | ||
575 | return 0; | 575 | return 0; |
576 | } | 576 | } |
577 | 577 | ||
578 | static int evdev_handle_set_keycode(struct input_dev *dev, | 578 | static int evdev_handle_set_keycode(struct input_dev *dev, void __user *p) |
579 | void __user *p, size_t size) | ||
580 | { | 579 | { |
581 | struct input_keymap_entry ke; | 580 | struct input_keymap_entry ke = { |
582 | 581 | .len = sizeof(unsigned int), | |
583 | memset(&ke, 0, sizeof(ke)); | 582 | .flags = 0, |
583 | }; | ||
584 | int __user *ip = (int __user *)p; | ||
584 | 585 | ||
585 | if (size == sizeof(unsigned int[2])) { | 586 | if (copy_from_user(ke.scancode, p, sizeof(unsigned int))) |
586 | /* legacy case */ | 587 | return -EFAULT; |
587 | int __user *ip = (int __user *)p; | ||
588 | 588 | ||
589 | if (copy_from_user(ke.scancode, p, sizeof(unsigned int))) | 589 | if (get_user(ke.keycode, ip + 1)) |
590 | return -EFAULT; | 590 | return -EFAULT; |
591 | 591 | ||
592 | if (get_user(ke.keycode, ip + 1)) | 592 | return input_set_keycode(dev, &ke); |
593 | return -EFAULT; | 593 | } |
594 | 594 | ||
595 | ke.len = sizeof(unsigned int); | 595 | static int evdev_handle_set_keycode_v2(struct input_dev *dev, void __user *p) |
596 | ke.flags = 0; | 596 | { |
597 | struct input_keymap_entry ke; | ||
597 | 598 | ||
598 | } else { | 599 | if (copy_from_user(&ke, p, sizeof(ke))) |
599 | size = min(size, sizeof(ke)); | 600 | return -EFAULT; |
600 | 601 | ||
601 | if (copy_from_user(&ke, p, size)) | 602 | if (ke.len > sizeof(ke.scancode)) |
602 | return -EFAULT; | 603 | return -EINVAL; |
603 | |||
604 | if (ke.len > sizeof(ke.scancode)) | ||
605 | return -EINVAL; | ||
606 | } | ||
607 | 604 | ||
608 | return input_set_keycode(dev, &ke); | 605 | return input_set_keycode(dev, &ke); |
609 | } | 606 | } |
@@ -669,6 +666,18 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
669 | return evdev_grab(evdev, client); | 666 | return evdev_grab(evdev, client); |
670 | else | 667 | else |
671 | return evdev_ungrab(evdev, client); | 668 | return evdev_ungrab(evdev, client); |
669 | |||
670 | case EVIOCGKEYCODE: | ||
671 | return evdev_handle_get_keycode(dev, p); | ||
672 | |||
673 | case EVIOCSKEYCODE: | ||
674 | return evdev_handle_set_keycode(dev, p); | ||
675 | |||
676 | case EVIOCGKEYCODE_V2: | ||
677 | return evdev_handle_get_keycode_v2(dev, p); | ||
678 | |||
679 | case EVIOCSKEYCODE_V2: | ||
680 | return evdev_handle_set_keycode_v2(dev, p); | ||
672 | } | 681 | } |
673 | 682 | ||
674 | size = _IOC_SIZE(cmd); | 683 | size = _IOC_SIZE(cmd); |
@@ -708,12 +717,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
708 | return -EFAULT; | 717 | return -EFAULT; |
709 | 718 | ||
710 | return error; | 719 | return error; |
711 | |||
712 | case EVIOC_MASK_SIZE(EVIOCGKEYCODE): | ||
713 | return evdev_handle_get_keycode(dev, p, size); | ||
714 | |||
715 | case EVIOC_MASK_SIZE(EVIOCSKEYCODE): | ||
716 | return evdev_handle_set_keycode(dev, p, size); | ||
717 | } | 720 | } |
718 | 721 | ||
719 | /* Multi-number variable-length handlers */ | 722 | /* Multi-number variable-length handlers */ |
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index d53b9e900234..27b6a3ce18ca 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c | |||
@@ -245,6 +245,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
245 | goto err_free_tgfx; | 245 | goto err_free_tgfx; |
246 | } | 246 | } |
247 | 247 | ||
248 | parport_put_port(pp); | ||
248 | return tgfx; | 249 | return tgfx; |
249 | 250 | ||
250 | err_free_dev: | 251 | err_free_dev: |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index b8c51b9781db..3a87f3ba5f75 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -179,6 +179,22 @@ config KEYBOARD_GPIO | |||
179 | To compile this driver as a module, choose M here: the | 179 | To compile this driver as a module, choose M here: the |
180 | module will be called gpio_keys. | 180 | module will be called gpio_keys. |
181 | 181 | ||
182 | config KEYBOARD_GPIO_POLLED | ||
183 | tristate "Polled GPIO buttons" | ||
184 | depends on GENERIC_GPIO | ||
185 | select INPUT_POLLDEV | ||
186 | help | ||
187 | This driver implements support for buttons connected | ||
188 | to GPIO pins that are not capable of generating interrupts. | ||
189 | |||
190 | Say Y here if your device has buttons connected | ||
191 | directly to such GPIO pins. Your board-specific | ||
192 | setup logic must also provide a platform device, | ||
193 | with configuration data saying which GPIOs are used. | ||
194 | |||
195 | To compile this driver as a module, choose M here: the | ||
196 | module will be called gpio_keys_polled. | ||
197 | |||
182 | config KEYBOARD_TCA6416 | 198 | config KEYBOARD_TCA6416 |
183 | tristate "TCA6416 Keypad Support" | 199 | tristate "TCA6416 Keypad Support" |
184 | depends on I2C | 200 | depends on I2C |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index a34452e8ebe2..622de73a445d 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o | |||
14 | obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o | 14 | obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o |
15 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o | 15 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o |
16 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | 16 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
17 | obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o | ||
17 | obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o | 18 | obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o |
18 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 19 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
19 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 20 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c new file mode 100644 index 000000000000..4c17aff20657 --- /dev/null +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* | ||
2 | * Driver for buttons on GPIO lines not capable of generating interrupts | ||
3 | * | ||
4 | * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org> | ||
5 | * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com> | ||
6 | * | ||
7 | * This file was based on: /drivers/input/misc/cobalt_btns.c | ||
8 | * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | ||
9 | * | ||
10 | * also was based on: /drivers/input/keyboard/gpio_keys.c | ||
11 | * Copyright 2005 Phil Blundell | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/input-polldev.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/gpio.h> | ||
27 | #include <linux/gpio_keys.h> | ||
28 | |||
29 | #define DRV_NAME "gpio-keys-polled" | ||
30 | |||
31 | struct gpio_keys_button_data { | ||
32 | int last_state; | ||
33 | int count; | ||
34 | int threshold; | ||
35 | int can_sleep; | ||
36 | }; | ||
37 | |||
38 | struct gpio_keys_polled_dev { | ||
39 | struct input_polled_dev *poll_dev; | ||
40 | struct device *dev; | ||
41 | struct gpio_keys_platform_data *pdata; | ||
42 | struct gpio_keys_button_data data[0]; | ||
43 | }; | ||
44 | |||
45 | static void gpio_keys_polled_check_state(struct input_dev *input, | ||
46 | struct gpio_keys_button *button, | ||
47 | struct gpio_keys_button_data *bdata) | ||
48 | { | ||
49 | int state; | ||
50 | |||
51 | if (bdata->can_sleep) | ||
52 | state = !!gpio_get_value_cansleep(button->gpio); | ||
53 | else | ||
54 | state = !!gpio_get_value(button->gpio); | ||
55 | |||
56 | if (state != bdata->last_state) { | ||
57 | unsigned int type = button->type ?: EV_KEY; | ||
58 | |||
59 | input_event(input, type, button->code, | ||
60 | !!(state ^ button->active_low)); | ||
61 | input_sync(input); | ||
62 | bdata->count = 0; | ||
63 | bdata->last_state = state; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | static void gpio_keys_polled_poll(struct input_polled_dev *dev) | ||
68 | { | ||
69 | struct gpio_keys_polled_dev *bdev = dev->private; | ||
70 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
71 | struct input_dev *input = dev->input; | ||
72 | int i; | ||
73 | |||
74 | for (i = 0; i < bdev->pdata->nbuttons; i++) { | ||
75 | struct gpio_keys_button_data *bdata = &bdev->data[i]; | ||
76 | |||
77 | if (bdata->count < bdata->threshold) | ||
78 | bdata->count++; | ||
79 | else | ||
80 | gpio_keys_polled_check_state(input, &pdata->buttons[i], | ||
81 | bdata); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | static void gpio_keys_polled_open(struct input_polled_dev *dev) | ||
86 | { | ||
87 | struct gpio_keys_polled_dev *bdev = dev->private; | ||
88 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
89 | |||
90 | if (pdata->enable) | ||
91 | pdata->enable(bdev->dev); | ||
92 | } | ||
93 | |||
94 | static void gpio_keys_polled_close(struct input_polled_dev *dev) | ||
95 | { | ||
96 | struct gpio_keys_polled_dev *bdev = dev->private; | ||
97 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
98 | |||
99 | if (pdata->disable) | ||
100 | pdata->disable(bdev->dev); | ||
101 | } | ||
102 | |||
103 | static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | ||
104 | { | ||
105 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; | ||
106 | struct device *dev = &pdev->dev; | ||
107 | struct gpio_keys_polled_dev *bdev; | ||
108 | struct input_polled_dev *poll_dev; | ||
109 | struct input_dev *input; | ||
110 | int error; | ||
111 | int i; | ||
112 | |||
113 | if (!pdata || !pdata->poll_interval) | ||
114 | return -EINVAL; | ||
115 | |||
116 | bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) + | ||
117 | pdata->nbuttons * sizeof(struct gpio_keys_button_data), | ||
118 | GFP_KERNEL); | ||
119 | if (!bdev) { | ||
120 | dev_err(dev, "no memory for private data\n"); | ||
121 | return -ENOMEM; | ||
122 | } | ||
123 | |||
124 | poll_dev = input_allocate_polled_device(); | ||
125 | if (!poll_dev) { | ||
126 | dev_err(dev, "no memory for polled device\n"); | ||
127 | error = -ENOMEM; | ||
128 | goto err_free_bdev; | ||
129 | } | ||
130 | |||
131 | poll_dev->private = bdev; | ||
132 | poll_dev->poll = gpio_keys_polled_poll; | ||
133 | poll_dev->poll_interval = pdata->poll_interval; | ||
134 | poll_dev->open = gpio_keys_polled_open; | ||
135 | poll_dev->close = gpio_keys_polled_close; | ||
136 | |||
137 | input = poll_dev->input; | ||
138 | |||
139 | input->evbit[0] = BIT(EV_KEY); | ||
140 | input->name = pdev->name; | ||
141 | input->phys = DRV_NAME"/input0"; | ||
142 | input->dev.parent = &pdev->dev; | ||
143 | |||
144 | input->id.bustype = BUS_HOST; | ||
145 | input->id.vendor = 0x0001; | ||
146 | input->id.product = 0x0001; | ||
147 | input->id.version = 0x0100; | ||
148 | |||
149 | for (i = 0; i < pdata->nbuttons; i++) { | ||
150 | struct gpio_keys_button *button = &pdata->buttons[i]; | ||
151 | struct gpio_keys_button_data *bdata = &bdev->data[i]; | ||
152 | unsigned int gpio = button->gpio; | ||
153 | unsigned int type = button->type ?: EV_KEY; | ||
154 | |||
155 | if (button->wakeup) { | ||
156 | dev_err(dev, DRV_NAME " does not support wakeup\n"); | ||
157 | error = -EINVAL; | ||
158 | goto err_free_gpio; | ||
159 | } | ||
160 | |||
161 | error = gpio_request(gpio, | ||
162 | button->desc ? button->desc : DRV_NAME); | ||
163 | if (error) { | ||
164 | dev_err(dev, "unable to claim gpio %u, err=%d\n", | ||
165 | gpio, error); | ||
166 | goto err_free_gpio; | ||
167 | } | ||
168 | |||
169 | error = gpio_direction_input(gpio); | ||
170 | if (error) { | ||
171 | dev_err(dev, | ||
172 | "unable to set direction on gpio %u, err=%d\n", | ||
173 | gpio, error); | ||
174 | goto err_free_gpio; | ||
175 | } | ||
176 | |||
177 | bdata->can_sleep = gpio_cansleep(gpio); | ||
178 | bdata->last_state = -1; | ||
179 | bdata->threshold = DIV_ROUND_UP(button->debounce_interval, | ||
180 | pdata->poll_interval); | ||
181 | |||
182 | input_set_capability(input, type, button->code); | ||
183 | } | ||
184 | |||
185 | bdev->poll_dev = poll_dev; | ||
186 | bdev->dev = dev; | ||
187 | bdev->pdata = pdata; | ||
188 | platform_set_drvdata(pdev, bdev); | ||
189 | |||
190 | error = input_register_polled_device(poll_dev); | ||
191 | if (error) { | ||
192 | dev_err(dev, "unable to register polled device, err=%d\n", | ||
193 | error); | ||
194 | goto err_free_gpio; | ||
195 | } | ||
196 | |||
197 | /* report initial state of the buttons */ | ||
198 | for (i = 0; i < pdata->nbuttons; i++) | ||
199 | gpio_keys_polled_check_state(input, &pdata->buttons[i], | ||
200 | &bdev->data[i]); | ||
201 | |||
202 | return 0; | ||
203 | |||
204 | err_free_gpio: | ||
205 | while (--i >= 0) | ||
206 | gpio_free(pdata->buttons[i].gpio); | ||
207 | |||
208 | input_free_polled_device(poll_dev); | ||
209 | |||
210 | err_free_bdev: | ||
211 | kfree(bdev); | ||
212 | |||
213 | platform_set_drvdata(pdev, NULL); | ||
214 | return error; | ||
215 | } | ||
216 | |||
217 | static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) | ||
218 | { | ||
219 | struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev); | ||
220 | struct gpio_keys_platform_data *pdata = bdev->pdata; | ||
221 | int i; | ||
222 | |||
223 | input_unregister_polled_device(bdev->poll_dev); | ||
224 | |||
225 | for (i = 0; i < pdata->nbuttons; i++) | ||
226 | gpio_free(pdata->buttons[i].gpio); | ||
227 | |||
228 | input_free_polled_device(bdev->poll_dev); | ||
229 | |||
230 | kfree(bdev); | ||
231 | platform_set_drvdata(pdev, NULL); | ||
232 | |||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | static struct platform_driver gpio_keys_polled_driver = { | ||
237 | .probe = gpio_keys_polled_probe, | ||
238 | .remove = __devexit_p(gpio_keys_polled_remove), | ||
239 | .driver = { | ||
240 | .name = DRV_NAME, | ||
241 | .owner = THIS_MODULE, | ||
242 | }, | ||
243 | }; | ||
244 | |||
245 | static int __init gpio_keys_polled_init(void) | ||
246 | { | ||
247 | return platform_driver_register(&gpio_keys_polled_driver); | ||
248 | } | ||
249 | |||
250 | static void __exit gpio_keys_polled_exit(void) | ||
251 | { | ||
252 | platform_driver_unregister(&gpio_keys_polled_driver); | ||
253 | } | ||
254 | |||
255 | module_init(gpio_keys_polled_init); | ||
256 | module_exit(gpio_keys_polled_exit); | ||
257 | |||
258 | MODULE_LICENSE("GPL v2"); | ||
259 | MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>"); | ||
260 | MODULE_DESCRIPTION("Polled GPIO Buttons driver"); | ||
261 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 613a3652f98f..0aefaa885871 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -51,7 +51,8 @@ | |||
51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) | 51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) |
52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) | 52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) | 53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) |
54 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100) | 54 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
55 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | ||
55 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) | 56 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) |
56 | 57 | ||
57 | /* synaptics modes query bits */ | 58 | /* synaptics modes query bits */ |
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index 3c287dd879d3..4225f5d6b15f 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c | |||
@@ -358,7 +358,7 @@ static int __devinit gscps2_probe(struct parisc_device *dev) | |||
358 | gscps2_reset(ps2port); | 358 | gscps2_reset(ps2port); |
359 | ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f; | 359 | ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f; |
360 | 360 | ||
361 | snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s", | 361 | snprintf(serio->name, sizeof(serio->name), "gsc-ps2-%s", |
362 | (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); | 362 | (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); |
363 | strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys)); | 363 | strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys)); |
364 | serio->id.type = SERIO_8042; | 364 | serio->id.type = SERIO_8042; |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index b3252ef1e279..435b0af401e4 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1436,6 +1436,14 @@ static struct wacom_features wacom_features_0xD2 = | |||
1436 | { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | 1436 | { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; |
1437 | static struct wacom_features wacom_features_0xD3 = | 1437 | static struct wacom_features wacom_features_0xD3 = |
1438 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1438 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1439 | static const struct wacom_features wacom_features_0xD4 = | ||
1440 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; | ||
1441 | static struct wacom_features wacom_features_0xD8 = | ||
1442 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | ||
1443 | static struct wacom_features wacom_features_0xDA = | ||
1444 | { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1445 | static struct wacom_features wacom_features_0xDB = | ||
1446 | { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | ||
1439 | 1447 | ||
1440 | #define USB_DEVICE_WACOM(prod) \ | 1448 | #define USB_DEVICE_WACOM(prod) \ |
1441 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | 1449 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ |
@@ -1504,6 +1512,10 @@ const struct usb_device_id wacom_ids[] = { | |||
1504 | { USB_DEVICE_WACOM(0xD1) }, | 1512 | { USB_DEVICE_WACOM(0xD1) }, |
1505 | { USB_DEVICE_WACOM(0xD2) }, | 1513 | { USB_DEVICE_WACOM(0xD2) }, |
1506 | { USB_DEVICE_WACOM(0xD3) }, | 1514 | { USB_DEVICE_WACOM(0xD3) }, |
1515 | { USB_DEVICE_WACOM(0xD4) }, | ||
1516 | { USB_DEVICE_WACOM(0xD8) }, | ||
1517 | { USB_DEVICE_WACOM(0xDA) }, | ||
1518 | { USB_DEVICE_WACOM(0xDB) }, | ||
1507 | { USB_DEVICE_WACOM(0xF0) }, | 1519 | { USB_DEVICE_WACOM(0xF0) }, |
1508 | { USB_DEVICE_WACOM(0xCC) }, | 1520 | { USB_DEVICE_WACOM(0xCC) }, |
1509 | { USB_DEVICE_WACOM(0x90) }, | 1521 | { USB_DEVICE_WACOM(0x90) }, |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index f45f80f6d336..73fd6642b681 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -178,6 +178,7 @@ static const struct usb_device_id usbtouch_devices[] = { | |||
178 | 178 | ||
179 | #ifdef CONFIG_TOUCHSCREEN_USB_ITM | 179 | #ifdef CONFIG_TOUCHSCREEN_USB_ITM |
180 | {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM}, | 180 | {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM}, |
181 | {USB_DEVICE(0x16e3, 0xf9e9), .driver_info = DEVTYPE_ITM}, | ||
181 | #endif | 182 | #endif |
182 | 183 | ||
183 | #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO | 184 | #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO |
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index 2e847a90bad0..f2b5bab5e6a1 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c | |||
@@ -1627,7 +1627,7 @@ __setup("icn=", icn_setup); | |||
1627 | static int __init icn_init(void) | 1627 | static int __init icn_init(void) |
1628 | { | 1628 | { |
1629 | char *p; | 1629 | char *p; |
1630 | char rev[10]; | 1630 | char rev[20]; |
1631 | 1631 | ||
1632 | memset(&dev, 0, sizeof(icn_dev)); | 1632 | memset(&dev, 0, sizeof(icn_dev)); |
1633 | dev.memaddr = (membase & 0x0ffc000); | 1633 | dev.memaddr = (membase & 0x0ffc000); |
@@ -1637,9 +1637,10 @@ static int __init icn_init(void) | |||
1637 | spin_lock_init(&dev.devlock); | 1637 | spin_lock_init(&dev.devlock); |
1638 | 1638 | ||
1639 | if ((p = strchr(revision, ':'))) { | 1639 | if ((p = strchr(revision, ':'))) { |
1640 | strcpy(rev, p + 1); | 1640 | strncpy(rev, p + 1, 20); |
1641 | p = strchr(rev, '$'); | 1641 | p = strchr(rev, '$'); |
1642 | *p = 0; | 1642 | if (p) |
1643 | *p = 0; | ||
1643 | } else | 1644 | } else |
1644 | strcpy(rev, " ??? "); | 1645 | strcpy(rev, " ??? "); |
1645 | printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev, | 1646 | printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev, |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 77b8fd20cd90..6f190f4cdbc0 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -7,20 +7,20 @@ menuconfig NEW_LEDS | |||
7 | This is not related to standard keyboard LEDs which are controlled | 7 | This is not related to standard keyboard LEDs which are controlled |
8 | via the input system. | 8 | via the input system. |
9 | 9 | ||
10 | if NEW_LEDS | ||
11 | |||
12 | config LEDS_CLASS | 10 | config LEDS_CLASS |
13 | bool "LED Class Support" | 11 | bool "LED Class Support" |
12 | depends on NEW_LEDS | ||
14 | help | 13 | help |
15 | This option enables the led sysfs class in /sys/class/leds. You'll | 14 | This option enables the led sysfs class in /sys/class/leds. You'll |
16 | need this to do anything useful with LEDs. If unsure, say N. | 15 | need this to do anything useful with LEDs. If unsure, say N. |
17 | 16 | ||
18 | if LEDS_CLASS | 17 | if NEW_LEDS |
19 | 18 | ||
20 | comment "LED drivers" | 19 | comment "LED drivers" |
21 | 20 | ||
22 | config LEDS_88PM860X | 21 | config LEDS_88PM860X |
23 | tristate "LED Support for Marvell 88PM860x PMIC" | 22 | tristate "LED Support for Marvell 88PM860x PMIC" |
23 | depends on LEDS_CLASS | ||
24 | depends on MFD_88PM860X | 24 | depends on MFD_88PM860X |
25 | help | 25 | help |
26 | This option enables support for on-chip LED drivers found on Marvell | 26 | This option enables support for on-chip LED drivers found on Marvell |
@@ -28,6 +28,7 @@ config LEDS_88PM860X | |||
28 | 28 | ||
29 | config LEDS_ATMEL_PWM | 29 | config LEDS_ATMEL_PWM |
30 | tristate "LED Support using Atmel PWM outputs" | 30 | tristate "LED Support using Atmel PWM outputs" |
31 | depends on LEDS_CLASS | ||
31 | depends on ATMEL_PWM | 32 | depends on ATMEL_PWM |
32 | help | 33 | help |
33 | This option enables support for LEDs driven using outputs | 34 | This option enables support for LEDs driven using outputs |
@@ -35,6 +36,7 @@ config LEDS_ATMEL_PWM | |||
35 | 36 | ||
36 | config LEDS_LOCOMO | 37 | config LEDS_LOCOMO |
37 | tristate "LED Support for Locomo device" | 38 | tristate "LED Support for Locomo device" |
39 | depends on LEDS_CLASS | ||
38 | depends on SHARP_LOCOMO | 40 | depends on SHARP_LOCOMO |
39 | help | 41 | help |
40 | This option enables support for the LEDs on Sharp Locomo. | 42 | This option enables support for the LEDs on Sharp Locomo. |
@@ -42,6 +44,7 @@ config LEDS_LOCOMO | |||
42 | 44 | ||
43 | config LEDS_MIKROTIK_RB532 | 45 | config LEDS_MIKROTIK_RB532 |
44 | tristate "LED Support for Mikrotik Routerboard 532" | 46 | tristate "LED Support for Mikrotik Routerboard 532" |
47 | depends on LEDS_CLASS | ||
45 | depends on MIKROTIK_RB532 | 48 | depends on MIKROTIK_RB532 |
46 | help | 49 | help |
47 | This option enables support for the so called "User LED" of | 50 | This option enables support for the so called "User LED" of |
@@ -49,6 +52,7 @@ config LEDS_MIKROTIK_RB532 | |||
49 | 52 | ||
50 | config LEDS_S3C24XX | 53 | config LEDS_S3C24XX |
51 | tristate "LED Support for Samsung S3C24XX GPIO LEDs" | 54 | tristate "LED Support for Samsung S3C24XX GPIO LEDs" |
55 | depends on LEDS_CLASS | ||
52 | depends on ARCH_S3C2410 | 56 | depends on ARCH_S3C2410 |
53 | help | 57 | help |
54 | This option enables support for LEDs connected to GPIO lines | 58 | This option enables support for LEDs connected to GPIO lines |
@@ -56,12 +60,14 @@ config LEDS_S3C24XX | |||
56 | 60 | ||
57 | config LEDS_AMS_DELTA | 61 | config LEDS_AMS_DELTA |
58 | tristate "LED Support for the Amstrad Delta (E3)" | 62 | tristate "LED Support for the Amstrad Delta (E3)" |
63 | depends on LEDS_CLASS | ||
59 | depends on MACH_AMS_DELTA | 64 | depends on MACH_AMS_DELTA |
60 | help | 65 | help |
61 | This option enables support for the LEDs on Amstrad Delta (E3). | 66 | This option enables support for the LEDs on Amstrad Delta (E3). |
62 | 67 | ||
63 | config LEDS_NET48XX | 68 | config LEDS_NET48XX |
64 | tristate "LED Support for Soekris net48xx series Error LED" | 69 | tristate "LED Support for Soekris net48xx series Error LED" |
70 | depends on LEDS_CLASS | ||
65 | depends on SCx200_GPIO | 71 | depends on SCx200_GPIO |
66 | help | 72 | help |
67 | This option enables support for the Soekris net4801 and net4826 error | 73 | This option enables support for the Soekris net4801 and net4826 error |
@@ -79,18 +85,21 @@ config LEDS_NET5501 | |||
79 | 85 | ||
80 | config LEDS_FSG | 86 | config LEDS_FSG |
81 | tristate "LED Support for the Freecom FSG-3" | 87 | tristate "LED Support for the Freecom FSG-3" |
88 | depends on LEDS_CLASS | ||
82 | depends on MACH_FSG | 89 | depends on MACH_FSG |
83 | help | 90 | help |
84 | This option enables support for the LEDs on the Freecom FSG-3. | 91 | This option enables support for the LEDs on the Freecom FSG-3. |
85 | 92 | ||
86 | config LEDS_WRAP | 93 | config LEDS_WRAP |
87 | tristate "LED Support for the WRAP series LEDs" | 94 | tristate "LED Support for the WRAP series LEDs" |
95 | depends on LEDS_CLASS | ||
88 | depends on SCx200_GPIO | 96 | depends on SCx200_GPIO |
89 | help | 97 | help |
90 | This option enables support for the PCEngines WRAP programmable LEDs. | 98 | This option enables support for the PCEngines WRAP programmable LEDs. |
91 | 99 | ||
92 | config LEDS_ALIX2 | 100 | config LEDS_ALIX2 |
93 | tristate "LED Support for ALIX.2 and ALIX.3 series" | 101 | tristate "LED Support for ALIX.2 and ALIX.3 series" |
102 | depends on LEDS_CLASS | ||
94 | depends on X86 && !GPIO_CS5535 && !CS5535_GPIO | 103 | depends on X86 && !GPIO_CS5535 && !CS5535_GPIO |
95 | help | 104 | help |
96 | This option enables support for the PCEngines ALIX.2 and ALIX.3 LEDs. | 105 | This option enables support for the PCEngines ALIX.2 and ALIX.3 LEDs. |
@@ -98,12 +107,14 @@ config LEDS_ALIX2 | |||
98 | 107 | ||
99 | config LEDS_H1940 | 108 | config LEDS_H1940 |
100 | tristate "LED Support for iPAQ H1940 device" | 109 | tristate "LED Support for iPAQ H1940 device" |
110 | depends on LEDS_CLASS | ||
101 | depends on ARCH_H1940 | 111 | depends on ARCH_H1940 |
102 | help | 112 | help |
103 | This option enables support for the LEDs on the h1940. | 113 | This option enables support for the LEDs on the h1940. |
104 | 114 | ||
105 | config LEDS_COBALT_QUBE | 115 | config LEDS_COBALT_QUBE |
106 | tristate "LED Support for the Cobalt Qube series front LED" | 116 | tristate "LED Support for the Cobalt Qube series front LED" |
117 | depends on LEDS_CLASS | ||
107 | depends on MIPS_COBALT | 118 | depends on MIPS_COBALT |
108 | help | 119 | help |
109 | This option enables support for the front LED on Cobalt Qube series | 120 | This option enables support for the front LED on Cobalt Qube series |
@@ -117,6 +128,7 @@ config LEDS_COBALT_RAQ | |||
117 | 128 | ||
118 | config LEDS_SUNFIRE | 129 | config LEDS_SUNFIRE |
119 | tristate "LED support for SunFire servers." | 130 | tristate "LED support for SunFire servers." |
131 | depends on LEDS_CLASS | ||
120 | depends on SPARC64 | 132 | depends on SPARC64 |
121 | select LEDS_TRIGGERS | 133 | select LEDS_TRIGGERS |
122 | help | 134 | help |
@@ -125,6 +137,7 @@ config LEDS_SUNFIRE | |||
125 | 137 | ||
126 | config LEDS_HP6XX | 138 | config LEDS_HP6XX |
127 | tristate "LED Support for the HP Jornada 6xx" | 139 | tristate "LED Support for the HP Jornada 6xx" |
140 | depends on LEDS_CLASS | ||
128 | depends on SH_HP6XX | 141 | depends on SH_HP6XX |
129 | help | 142 | help |
130 | This option enables LED support for the handheld | 143 | This option enables LED support for the handheld |
@@ -132,6 +145,7 @@ config LEDS_HP6XX | |||
132 | 145 | ||
133 | config LEDS_PCA9532 | 146 | config LEDS_PCA9532 |
134 | tristate "LED driver for PCA9532 dimmer" | 147 | tristate "LED driver for PCA9532 dimmer" |
148 | depends on LEDS_CLASS | ||
135 | depends on I2C && INPUT && EXPERIMENTAL | 149 | depends on I2C && INPUT && EXPERIMENTAL |
136 | help | 150 | help |
137 | This option enables support for NXP pca9532 | 151 | This option enables support for NXP pca9532 |
@@ -140,6 +154,7 @@ config LEDS_PCA9532 | |||
140 | 154 | ||
141 | config LEDS_GPIO | 155 | config LEDS_GPIO |
142 | tristate "LED Support for GPIO connected LEDs" | 156 | tristate "LED Support for GPIO connected LEDs" |
157 | depends on LEDS_CLASS | ||
143 | depends on GENERIC_GPIO | 158 | depends on GENERIC_GPIO |
144 | help | 159 | help |
145 | This option enables support for the LEDs connected to GPIO | 160 | This option enables support for the LEDs connected to GPIO |
@@ -167,6 +182,7 @@ config LEDS_GPIO_OF | |||
167 | 182 | ||
168 | config LEDS_LP3944 | 183 | config LEDS_LP3944 |
169 | tristate "LED Support for N.S. LP3944 (Fun Light) I2C chip" | 184 | tristate "LED Support for N.S. LP3944 (Fun Light) I2C chip" |
185 | depends on LEDS_CLASS | ||
170 | depends on I2C | 186 | depends on I2C |
171 | help | 187 | help |
172 | This option enables support for LEDs connected to the National | 188 | This option enables support for LEDs connected to the National |
@@ -196,6 +212,7 @@ config LEDS_LP5523 | |||
196 | 212 | ||
197 | config LEDS_CLEVO_MAIL | 213 | config LEDS_CLEVO_MAIL |
198 | tristate "Mail LED on Clevo notebook" | 214 | tristate "Mail LED on Clevo notebook" |
215 | depends on LEDS_CLASS | ||
199 | depends on X86 && SERIO_I8042 && DMI | 216 | depends on X86 && SERIO_I8042 && DMI |
200 | help | 217 | help |
201 | This driver makes the mail LED accessible from userspace | 218 | This driver makes the mail LED accessible from userspace |
@@ -226,6 +243,7 @@ config LEDS_CLEVO_MAIL | |||
226 | 243 | ||
227 | config LEDS_PCA955X | 244 | config LEDS_PCA955X |
228 | tristate "LED Support for PCA955x I2C chips" | 245 | tristate "LED Support for PCA955x I2C chips" |
246 | depends on LEDS_CLASS | ||
229 | depends on I2C | 247 | depends on I2C |
230 | help | 248 | help |
231 | This option enables support for LEDs connected to PCA955x | 249 | This option enables support for LEDs connected to PCA955x |
@@ -234,6 +252,7 @@ config LEDS_PCA955X | |||
234 | 252 | ||
235 | config LEDS_WM831X_STATUS | 253 | config LEDS_WM831X_STATUS |
236 | tristate "LED support for status LEDs on WM831x PMICs" | 254 | tristate "LED support for status LEDs on WM831x PMICs" |
255 | depends on LEDS_CLASS | ||
237 | depends on MFD_WM831X | 256 | depends on MFD_WM831X |
238 | help | 257 | help |
239 | This option enables support for the status LEDs of the WM831x | 258 | This option enables support for the status LEDs of the WM831x |
@@ -241,6 +260,7 @@ config LEDS_WM831X_STATUS | |||
241 | 260 | ||
242 | config LEDS_WM8350 | 261 | config LEDS_WM8350 |
243 | tristate "LED Support for WM8350 AudioPlus PMIC" | 262 | tristate "LED Support for WM8350 AudioPlus PMIC" |
263 | depends on LEDS_CLASS | ||
244 | depends on MFD_WM8350 | 264 | depends on MFD_WM8350 |
245 | help | 265 | help |
246 | This option enables support for LEDs driven by the Wolfson | 266 | This option enables support for LEDs driven by the Wolfson |
@@ -248,6 +268,7 @@ config LEDS_WM8350 | |||
248 | 268 | ||
249 | config LEDS_DA903X | 269 | config LEDS_DA903X |
250 | tristate "LED Support for DA9030/DA9034 PMIC" | 270 | tristate "LED Support for DA9030/DA9034 PMIC" |
271 | depends on LEDS_CLASS | ||
251 | depends on PMIC_DA903X | 272 | depends on PMIC_DA903X |
252 | help | 273 | help |
253 | This option enables support for on-chip LED drivers found | 274 | This option enables support for on-chip LED drivers found |
@@ -255,6 +276,7 @@ config LEDS_DA903X | |||
255 | 276 | ||
256 | config LEDS_DAC124S085 | 277 | config LEDS_DAC124S085 |
257 | tristate "LED Support for DAC124S085 SPI DAC" | 278 | tristate "LED Support for DAC124S085 SPI DAC" |
279 | depends on LEDS_CLASS | ||
258 | depends on SPI | 280 | depends on SPI |
259 | help | 281 | help |
260 | This option enables support for DAC124S085 SPI DAC from NatSemi, | 282 | This option enables support for DAC124S085 SPI DAC from NatSemi, |
@@ -262,18 +284,21 @@ config LEDS_DAC124S085 | |||
262 | 284 | ||
263 | config LEDS_PWM | 285 | config LEDS_PWM |
264 | tristate "PWM driven LED Support" | 286 | tristate "PWM driven LED Support" |
287 | depends on LEDS_CLASS | ||
265 | depends on HAVE_PWM | 288 | depends on HAVE_PWM |
266 | help | 289 | help |
267 | This option enables support for pwm driven LEDs | 290 | This option enables support for pwm driven LEDs |
268 | 291 | ||
269 | config LEDS_REGULATOR | 292 | config LEDS_REGULATOR |
270 | tristate "REGULATOR driven LED support" | 293 | tristate "REGULATOR driven LED support" |
294 | depends on LEDS_CLASS | ||
271 | depends on REGULATOR | 295 | depends on REGULATOR |
272 | help | 296 | help |
273 | This option enables support for regulator driven LEDs. | 297 | This option enables support for regulator driven LEDs. |
274 | 298 | ||
275 | config LEDS_BD2802 | 299 | config LEDS_BD2802 |
276 | tristate "LED driver for BD2802 RGB LED" | 300 | tristate "LED driver for BD2802 RGB LED" |
301 | depends on LEDS_CLASS | ||
277 | depends on I2C | 302 | depends on I2C |
278 | help | 303 | help |
279 | This option enables support for BD2802GU RGB LED driver chips | 304 | This option enables support for BD2802GU RGB LED driver chips |
@@ -281,6 +306,7 @@ config LEDS_BD2802 | |||
281 | 306 | ||
282 | config LEDS_INTEL_SS4200 | 307 | config LEDS_INTEL_SS4200 |
283 | tristate "LED driver for Intel NAS SS4200 series" | 308 | tristate "LED driver for Intel NAS SS4200 series" |
309 | depends on LEDS_CLASS | ||
284 | depends on PCI && DMI | 310 | depends on PCI && DMI |
285 | help | 311 | help |
286 | This option enables support for the Intel SS4200 series of | 312 | This option enables support for the Intel SS4200 series of |
@@ -290,6 +316,7 @@ config LEDS_INTEL_SS4200 | |||
290 | 316 | ||
291 | config LEDS_LT3593 | 317 | config LEDS_LT3593 |
292 | tristate "LED driver for LT3593 controllers" | 318 | tristate "LED driver for LT3593 controllers" |
319 | depends on LEDS_CLASS | ||
293 | depends on GENERIC_GPIO | 320 | depends on GENERIC_GPIO |
294 | help | 321 | help |
295 | This option enables support for LEDs driven by a Linear Technology | 322 | This option enables support for LEDs driven by a Linear Technology |
@@ -298,6 +325,7 @@ config LEDS_LT3593 | |||
298 | 325 | ||
299 | config LEDS_ADP5520 | 326 | config LEDS_ADP5520 |
300 | tristate "LED Support for ADP5520/ADP5501 PMIC" | 327 | tristate "LED Support for ADP5520/ADP5501 PMIC" |
328 | depends on LEDS_CLASS | ||
301 | depends on PMIC_ADP5520 | 329 | depends on PMIC_ADP5520 |
302 | help | 330 | help |
303 | This option enables support for on-chip LED drivers found | 331 | This option enables support for on-chip LED drivers found |
@@ -308,6 +336,7 @@ config LEDS_ADP5520 | |||
308 | 336 | ||
309 | config LEDS_DELL_NETBOOKS | 337 | config LEDS_DELL_NETBOOKS |
310 | tristate "External LED on Dell Business Netbooks" | 338 | tristate "External LED on Dell Business Netbooks" |
339 | depends on LEDS_CLASS | ||
311 | depends on X86 && ACPI_WMI | 340 | depends on X86 && ACPI_WMI |
312 | help | 341 | help |
313 | This adds support for the Latitude 2100 and similar | 342 | This adds support for the Latitude 2100 and similar |
@@ -315,6 +344,7 @@ config LEDS_DELL_NETBOOKS | |||
315 | 344 | ||
316 | config LEDS_MC13783 | 345 | config LEDS_MC13783 |
317 | tristate "LED Support for MC13783 PMIC" | 346 | tristate "LED Support for MC13783 PMIC" |
347 | depends on LEDS_CLASS | ||
318 | depends on MFD_MC13783 | 348 | depends on MFD_MC13783 |
319 | help | 349 | help |
320 | This option enable support for on-chip LED drivers found | 350 | This option enable support for on-chip LED drivers found |
@@ -322,6 +352,7 @@ config LEDS_MC13783 | |||
322 | 352 | ||
323 | config LEDS_NS2 | 353 | config LEDS_NS2 |
324 | tristate "LED support for Network Space v2 GPIO LEDs" | 354 | tristate "LED support for Network Space v2 GPIO LEDs" |
355 | depends on LEDS_CLASS | ||
325 | depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 || D2NET_V2 | 356 | depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 || D2NET_V2 |
326 | default y | 357 | default y |
327 | help | 358 | help |
@@ -340,17 +371,17 @@ config LEDS_NETXBIG | |||
340 | 371 | ||
341 | config LEDS_TRIGGERS | 372 | config LEDS_TRIGGERS |
342 | bool "LED Trigger support" | 373 | bool "LED Trigger support" |
374 | depends on LEDS_CLASS | ||
343 | help | 375 | help |
344 | This option enables trigger support for the leds class. | 376 | This option enables trigger support for the leds class. |
345 | These triggers allow kernel events to drive the LEDs and can | 377 | These triggers allow kernel events to drive the LEDs and can |
346 | be configured via sysfs. If unsure, say Y. | 378 | be configured via sysfs. If unsure, say Y. |
347 | 379 | ||
348 | if LEDS_TRIGGERS | ||
349 | |||
350 | comment "LED Triggers" | 380 | comment "LED Triggers" |
351 | 381 | ||
352 | config LEDS_TRIGGER_TIMER | 382 | config LEDS_TRIGGER_TIMER |
353 | tristate "LED Timer Trigger" | 383 | tristate "LED Timer Trigger" |
384 | depends on LEDS_TRIGGERS | ||
354 | help | 385 | help |
355 | This allows LEDs to be controlled by a programmable timer | 386 | This allows LEDs to be controlled by a programmable timer |
356 | via sysfs. Some LED hardware can be programmed to start | 387 | via sysfs. Some LED hardware can be programmed to start |
@@ -362,12 +393,14 @@ config LEDS_TRIGGER_TIMER | |||
362 | config LEDS_TRIGGER_IDE_DISK | 393 | config LEDS_TRIGGER_IDE_DISK |
363 | bool "LED IDE Disk Trigger" | 394 | bool "LED IDE Disk Trigger" |
364 | depends on IDE_GD_ATA | 395 | depends on IDE_GD_ATA |
396 | depends on LEDS_TRIGGERS | ||
365 | help | 397 | help |
366 | This allows LEDs to be controlled by IDE disk activity. | 398 | This allows LEDs to be controlled by IDE disk activity. |
367 | If unsure, say Y. | 399 | If unsure, say Y. |
368 | 400 | ||
369 | config LEDS_TRIGGER_HEARTBEAT | 401 | config LEDS_TRIGGER_HEARTBEAT |
370 | tristate "LED Heartbeat Trigger" | 402 | tristate "LED Heartbeat Trigger" |
403 | depends on LEDS_TRIGGERS | ||
371 | help | 404 | help |
372 | This allows LEDs to be controlled by a CPU load average. | 405 | This allows LEDs to be controlled by a CPU load average. |
373 | The flash frequency is a hyperbolic function of the 1-minute | 406 | The flash frequency is a hyperbolic function of the 1-minute |
@@ -376,6 +409,7 @@ config LEDS_TRIGGER_HEARTBEAT | |||
376 | 409 | ||
377 | config LEDS_TRIGGER_BACKLIGHT | 410 | config LEDS_TRIGGER_BACKLIGHT |
378 | tristate "LED backlight Trigger" | 411 | tristate "LED backlight Trigger" |
412 | depends on LEDS_TRIGGERS | ||
379 | help | 413 | help |
380 | This allows LEDs to be controlled as a backlight device: they | 414 | This allows LEDs to be controlled as a backlight device: they |
381 | turn off and on when the display is blanked and unblanked. | 415 | turn off and on when the display is blanked and unblanked. |
@@ -384,6 +418,7 @@ config LEDS_TRIGGER_BACKLIGHT | |||
384 | 418 | ||
385 | config LEDS_TRIGGER_GPIO | 419 | config LEDS_TRIGGER_GPIO |
386 | tristate "LED GPIO Trigger" | 420 | tristate "LED GPIO Trigger" |
421 | depends on LEDS_TRIGGERS | ||
387 | depends on GPIOLIB | 422 | depends on GPIOLIB |
388 | help | 423 | help |
389 | This allows LEDs to be controlled by gpio events. It's good | 424 | This allows LEDs to be controlled by gpio events. It's good |
@@ -396,6 +431,7 @@ config LEDS_TRIGGER_GPIO | |||
396 | 431 | ||
397 | config LEDS_TRIGGER_DEFAULT_ON | 432 | config LEDS_TRIGGER_DEFAULT_ON |
398 | tristate "LED Default ON Trigger" | 433 | tristate "LED Default ON Trigger" |
434 | depends on LEDS_TRIGGERS | ||
399 | help | 435 | help |
400 | This allows LEDs to be initialised in the ON state. | 436 | This allows LEDs to be initialised in the ON state. |
401 | If unsure, say Y. | 437 | If unsure, say Y. |
@@ -403,8 +439,4 @@ config LEDS_TRIGGER_DEFAULT_ON | |||
403 | comment "iptables trigger is under Netfilter config (LED target)" | 439 | comment "iptables trigger is under Netfilter config (LED target)" |
404 | depends on LEDS_TRIGGERS | 440 | depends on LEDS_TRIGGERS |
405 | 441 | ||
406 | endif # LEDS_TRIGGERS | ||
407 | |||
408 | endif # LEDS_CLASS | ||
409 | |||
410 | endif # NEW_LEDS | 442 | endif # NEW_LEDS |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 211e21f34bd5..d5a4ade88991 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -267,7 +267,7 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
267 | unsigned long *delay_off) | 267 | unsigned long *delay_off) |
268 | { | 268 | { |
269 | if (led_cdev->blink_set && | 269 | if (led_cdev->blink_set && |
270 | led_cdev->blink_set(led_cdev, delay_on, delay_off)) | 270 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) |
271 | return; | 271 | return; |
272 | 272 | ||
273 | /* blink with 1 Hz as default if nothing specified */ | 273 | /* blink with 1 Hz as default if nothing specified */ |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 3d7355ff7308..fa51af11c6f1 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -102,6 +102,7 @@ config ADB_PMU_LED | |||
102 | config ADB_PMU_LED_IDE | 102 | config ADB_PMU_LED_IDE |
103 | bool "Use front LED as IDE LED by default" | 103 | bool "Use front LED as IDE LED by default" |
104 | depends on ADB_PMU_LED | 104 | depends on ADB_PMU_LED |
105 | depends on LEDS_CLASS | ||
105 | select LEDS_TRIGGERS | 106 | select LEDS_TRIGGERS |
106 | select LEDS_TRIGGER_IDE_DISK | 107 | select LEDS_TRIGGER_IDE_DISK |
107 | help | 108 | help |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 90267f8d64ee..4d705cea0f8c 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -517,9 +517,8 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, | |||
517 | */ | 517 | */ |
518 | 518 | ||
519 | if (q->merge_bvec_fn && !ti->type->merge) | 519 | if (q->merge_bvec_fn && !ti->type->merge) |
520 | limits->max_sectors = | 520 | blk_limits_max_hw_sectors(limits, |
521 | min_not_zero(limits->max_sectors, | 521 | (unsigned int) (PAGE_SIZE >> 9)); |
522 | (unsigned int) (PAGE_SIZE >> 9)); | ||
523 | return 0; | 522 | return 0; |
524 | } | 523 | } |
525 | EXPORT_SYMBOL_GPL(dm_set_device_limits); | 524 | EXPORT_SYMBOL_GPL(dm_set_device_limits); |
@@ -1131,11 +1130,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
1131 | */ | 1130 | */ |
1132 | q->limits = *limits; | 1131 | q->limits = *limits; |
1133 | 1132 | ||
1134 | if (limits->no_cluster) | ||
1135 | queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q); | ||
1136 | else | ||
1137 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, q); | ||
1138 | |||
1139 | if (!dm_table_supports_discards(t)) | 1133 | if (!dm_table_supports_discards(t)) |
1140 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q); | 1134 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q); |
1141 | else | 1135 | else |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 84c46a161927..175c424f201f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -371,10 +371,15 @@ static void md_end_flush(struct bio *bio, int err) | |||
371 | bio_put(bio); | 371 | bio_put(bio); |
372 | } | 372 | } |
373 | 373 | ||
374 | static void submit_flushes(mddev_t *mddev) | 374 | static void md_submit_flush_data(struct work_struct *ws); |
375 | |||
376 | static void submit_flushes(struct work_struct *ws) | ||
375 | { | 377 | { |
378 | mddev_t *mddev = container_of(ws, mddev_t, flush_work); | ||
376 | mdk_rdev_t *rdev; | 379 | mdk_rdev_t *rdev; |
377 | 380 | ||
381 | INIT_WORK(&mddev->flush_work, md_submit_flush_data); | ||
382 | atomic_set(&mddev->flush_pending, 1); | ||
378 | rcu_read_lock(); | 383 | rcu_read_lock(); |
379 | list_for_each_entry_rcu(rdev, &mddev->disks, same_set) | 384 | list_for_each_entry_rcu(rdev, &mddev->disks, same_set) |
380 | if (rdev->raid_disk >= 0 && | 385 | if (rdev->raid_disk >= 0 && |
@@ -397,6 +402,8 @@ static void submit_flushes(mddev_t *mddev) | |||
397 | rdev_dec_pending(rdev, mddev); | 402 | rdev_dec_pending(rdev, mddev); |
398 | } | 403 | } |
399 | rcu_read_unlock(); | 404 | rcu_read_unlock(); |
405 | if (atomic_dec_and_test(&mddev->flush_pending)) | ||
406 | queue_work(md_wq, &mddev->flush_work); | ||
400 | } | 407 | } |
401 | 408 | ||
402 | static void md_submit_flush_data(struct work_struct *ws) | 409 | static void md_submit_flush_data(struct work_struct *ws) |
@@ -404,8 +411,6 @@ static void md_submit_flush_data(struct work_struct *ws) | |||
404 | mddev_t *mddev = container_of(ws, mddev_t, flush_work); | 411 | mddev_t *mddev = container_of(ws, mddev_t, flush_work); |
405 | struct bio *bio = mddev->flush_bio; | 412 | struct bio *bio = mddev->flush_bio; |
406 | 413 | ||
407 | atomic_set(&mddev->flush_pending, 1); | ||
408 | |||
409 | if (bio->bi_size == 0) | 414 | if (bio->bi_size == 0) |
410 | /* an empty barrier - all done */ | 415 | /* an empty barrier - all done */ |
411 | bio_endio(bio, 0); | 416 | bio_endio(bio, 0); |
@@ -414,10 +419,9 @@ static void md_submit_flush_data(struct work_struct *ws) | |||
414 | if (mddev->pers->make_request(mddev, bio)) | 419 | if (mddev->pers->make_request(mddev, bio)) |
415 | generic_make_request(bio); | 420 | generic_make_request(bio); |
416 | } | 421 | } |
417 | if (atomic_dec_and_test(&mddev->flush_pending)) { | 422 | |
418 | mddev->flush_bio = NULL; | 423 | mddev->flush_bio = NULL; |
419 | wake_up(&mddev->sb_wait); | 424 | wake_up(&mddev->sb_wait); |
420 | } | ||
421 | } | 425 | } |
422 | 426 | ||
423 | void md_flush_request(mddev_t *mddev, struct bio *bio) | 427 | void md_flush_request(mddev_t *mddev, struct bio *bio) |
@@ -429,13 +433,8 @@ void md_flush_request(mddev_t *mddev, struct bio *bio) | |||
429 | mddev->flush_bio = bio; | 433 | mddev->flush_bio = bio; |
430 | spin_unlock_irq(&mddev->write_lock); | 434 | spin_unlock_irq(&mddev->write_lock); |
431 | 435 | ||
432 | atomic_set(&mddev->flush_pending, 1); | 436 | INIT_WORK(&mddev->flush_work, submit_flushes); |
433 | INIT_WORK(&mddev->flush_work, md_submit_flush_data); | 437 | queue_work(md_wq, &mddev->flush_work); |
434 | |||
435 | submit_flushes(mddev); | ||
436 | |||
437 | if (atomic_dec_and_test(&mddev->flush_pending)) | ||
438 | queue_work(md_wq, &mddev->flush_work); | ||
439 | } | 438 | } |
440 | EXPORT_SYMBOL(md_flush_request); | 439 | EXPORT_SYMBOL(md_flush_request); |
441 | 440 | ||
@@ -4296,9 +4295,6 @@ static int md_alloc(dev_t dev, char *name) | |||
4296 | goto abort; | 4295 | goto abort; |
4297 | mddev->queue->queuedata = mddev; | 4296 | mddev->queue->queuedata = mddev; |
4298 | 4297 | ||
4299 | /* Can be unlocked because the queue is new: no concurrency */ | ||
4300 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, mddev->queue); | ||
4301 | |||
4302 | blk_queue_make_request(mddev->queue, md_make_request); | 4298 | blk_queue_make_request(mddev->queue, md_make_request); |
4303 | 4299 | ||
4304 | disk = alloc_disk(1 << shift); | 4300 | disk = alloc_disk(1 << shift); |
@@ -5160,7 +5156,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5160 | PTR_ERR(rdev)); | 5156 | PTR_ERR(rdev)); |
5161 | return PTR_ERR(rdev); | 5157 | return PTR_ERR(rdev); |
5162 | } | 5158 | } |
5163 | /* set save_raid_disk if appropriate */ | 5159 | /* set saved_raid_disk if appropriate */ |
5164 | if (!mddev->persistent) { | 5160 | if (!mddev->persistent) { |
5165 | if (info->state & (1<<MD_DISK_SYNC) && | 5161 | if (info->state & (1<<MD_DISK_SYNC) && |
5166 | info->raid_disk < mddev->raid_disks) | 5162 | info->raid_disk < mddev->raid_disks) |
@@ -5170,7 +5166,10 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5170 | } else | 5166 | } else |
5171 | super_types[mddev->major_version]. | 5167 | super_types[mddev->major_version]. |
5172 | validate_super(mddev, rdev); | 5168 | validate_super(mddev, rdev); |
5173 | rdev->saved_raid_disk = rdev->raid_disk; | 5169 | if (test_bit(In_sync, &rdev->flags)) |
5170 | rdev->saved_raid_disk = rdev->raid_disk; | ||
5171 | else | ||
5172 | rdev->saved_raid_disk = -1; | ||
5174 | 5173 | ||
5175 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ | 5174 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ |
5176 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) | 5175 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) |
@@ -6042,9 +6041,8 @@ static int md_thread(void * arg) | |||
6042 | || kthread_should_stop(), | 6041 | || kthread_should_stop(), |
6043 | thread->timeout); | 6042 | thread->timeout); |
6044 | 6043 | ||
6045 | clear_bit(THREAD_WAKEUP, &thread->flags); | 6044 | if (test_and_clear_bit(THREAD_WAKEUP, &thread->flags)) |
6046 | 6045 | thread->run(thread->mddev); | |
6047 | thread->run(thread->mddev); | ||
6048 | } | 6046 | } |
6049 | 6047 | ||
6050 | return 0; | 6048 | return 0; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index c67aa54694ae..0641674827f0 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2397,13 +2397,13 @@ static int run(mddev_t *mddev) | |||
2397 | return 0; | 2397 | return 0; |
2398 | 2398 | ||
2399 | out_free_conf: | 2399 | out_free_conf: |
2400 | md_unregister_thread(mddev->thread); | ||
2400 | if (conf->r10bio_pool) | 2401 | if (conf->r10bio_pool) |
2401 | mempool_destroy(conf->r10bio_pool); | 2402 | mempool_destroy(conf->r10bio_pool); |
2402 | safe_put_page(conf->tmppage); | 2403 | safe_put_page(conf->tmppage); |
2403 | kfree(conf->mirrors); | 2404 | kfree(conf->mirrors); |
2404 | kfree(conf); | 2405 | kfree(conf); |
2405 | mddev->private = NULL; | 2406 | mddev->private = NULL; |
2406 | md_unregister_thread(mddev->thread); | ||
2407 | out: | 2407 | out: |
2408 | return -EIO; | 2408 | return -EIO; |
2409 | } | 2409 | } |
diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c index 1b7adabbcee9..6da955dfef48 100644 --- a/drivers/media/IR/keymaps/rc-rc6-mce.c +++ b/drivers/media/IR/keymaps/rc-rc6-mce.c | |||
@@ -26,8 +26,8 @@ static struct ir_scancode rc6_mce[] = { | |||
26 | 26 | ||
27 | { 0x800f040a, KEY_DELETE }, | 27 | { 0x800f040a, KEY_DELETE }, |
28 | { 0x800f040b, KEY_ENTER }, | 28 | { 0x800f040b, KEY_ENTER }, |
29 | { 0x800f040c, KEY_POWER }, | 29 | { 0x800f040c, KEY_POWER }, /* PC Power */ |
30 | { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ | 30 | { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ |
31 | { 0x800f040e, KEY_MUTE }, | 31 | { 0x800f040e, KEY_MUTE }, |
32 | { 0x800f040f, KEY_INFO }, | 32 | { 0x800f040f, KEY_INFO }, |
33 | 33 | ||
@@ -56,31 +56,32 @@ static struct ir_scancode rc6_mce[] = { | |||
56 | { 0x800f0422, KEY_OK }, | 56 | { 0x800f0422, KEY_OK }, |
57 | { 0x800f0423, KEY_EXIT }, | 57 | { 0x800f0423, KEY_EXIT }, |
58 | { 0x800f0424, KEY_DVD }, | 58 | { 0x800f0424, KEY_DVD }, |
59 | { 0x800f0425, KEY_TUNER }, /* LiveTV */ | 59 | { 0x800f0425, KEY_TUNER }, /* LiveTV */ |
60 | { 0x800f0426, KEY_EPG }, /* Guide */ | 60 | { 0x800f0426, KEY_EPG }, /* Guide */ |
61 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ | 61 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ |
62 | 62 | ||
63 | { 0x800f043a, KEY_BRIGHTNESSUP }, | 63 | { 0x800f043a, KEY_BRIGHTNESSUP }, |
64 | 64 | ||
65 | { 0x800f0446, KEY_TV }, | 65 | { 0x800f0446, KEY_TV }, |
66 | { 0x800f0447, KEY_AUDIO }, /* My Music */ | 66 | { 0x800f0447, KEY_AUDIO }, /* My Music */ |
67 | { 0x800f0448, KEY_PVR }, /* RecordedTV */ | 67 | { 0x800f0448, KEY_PVR }, /* RecordedTV */ |
68 | { 0x800f0449, KEY_CAMERA }, | 68 | { 0x800f0449, KEY_CAMERA }, |
69 | { 0x800f044a, KEY_VIDEO }, | 69 | { 0x800f044a, KEY_VIDEO }, |
70 | { 0x800f044c, KEY_LANGUAGE }, | 70 | { 0x800f044c, KEY_LANGUAGE }, |
71 | { 0x800f044d, KEY_TITLE }, | 71 | { 0x800f044d, KEY_TITLE }, |
72 | { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ | 72 | { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ |
73 | 73 | ||
74 | { 0x800f0450, KEY_RADIO }, | 74 | { 0x800f0450, KEY_RADIO }, |
75 | 75 | ||
76 | { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ | 76 | { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ |
77 | { 0x800f045b, KEY_RED }, | 77 | { 0x800f045b, KEY_RED }, |
78 | { 0x800f045c, KEY_GREEN }, | 78 | { 0x800f045c, KEY_GREEN }, |
79 | { 0x800f045d, KEY_YELLOW }, | 79 | { 0x800f045d, KEY_YELLOW }, |
80 | { 0x800f045e, KEY_BLUE }, | 80 | { 0x800f045e, KEY_BLUE }, |
81 | 81 | ||
82 | { 0x800f0465, KEY_POWER2 }, /* TV Power */ | ||
82 | { 0x800f046e, KEY_PLAYPAUSE }, | 83 | { 0x800f046e, KEY_PLAYPAUSE }, |
83 | { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ | 84 | { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ |
84 | 85 | ||
85 | { 0x800f0480, KEY_BRIGHTNESSDOWN }, | 86 | { 0x800f0480, KEY_BRIGHTNESSDOWN }, |
86 | { 0x800f0481, KEY_PLAYPAUSE }, | 87 | { 0x800f0481, KEY_PLAYPAUSE }, |
diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c index 8418b14ee4d2..756656e17bdd 100644 --- a/drivers/media/IR/lirc_dev.c +++ b/drivers/media/IR/lirc_dev.c | |||
@@ -522,10 +522,8 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) | |||
522 | 522 | ||
523 | dev_dbg(ir->d.dev, LOGHEAD "poll called\n", ir->d.name, ir->d.minor); | 523 | dev_dbg(ir->d.dev, LOGHEAD "poll called\n", ir->d.name, ir->d.minor); |
524 | 524 | ||
525 | if (!ir->attached) { | 525 | if (!ir->attached) |
526 | mutex_unlock(&ir->irctl_lock); | ||
527 | return POLLERR; | 526 | return POLLERR; |
528 | } | ||
529 | 527 | ||
530 | poll_wait(file, &ir->buf->wait_poll, wait); | 528 | poll_wait(file, &ir->buf->wait_poll, wait); |
531 | 529 | ||
@@ -649,18 +647,18 @@ ssize_t lirc_dev_fop_read(struct file *file, | |||
649 | if (!buf) | 647 | if (!buf) |
650 | return -ENOMEM; | 648 | return -ENOMEM; |
651 | 649 | ||
652 | if (mutex_lock_interruptible(&ir->irctl_lock)) | 650 | if (mutex_lock_interruptible(&ir->irctl_lock)) { |
653 | return -ERESTARTSYS; | 651 | ret = -ERESTARTSYS; |
652 | goto out_unlocked; | ||
653 | } | ||
654 | if (!ir->attached) { | 654 | if (!ir->attached) { |
655 | mutex_unlock(&ir->irctl_lock); | 655 | ret = -ENODEV; |
656 | return -ENODEV; | 656 | goto out_locked; |
657 | } | 657 | } |
658 | 658 | ||
659 | if (length % ir->chunk_size) { | 659 | if (length % ir->chunk_size) { |
660 | dev_dbg(ir->d.dev, LOGHEAD "read result = -EINVAL\n", | 660 | ret = -EINVAL; |
661 | ir->d.name, ir->d.minor); | 661 | goto out_locked; |
662 | mutex_unlock(&ir->irctl_lock); | ||
663 | return -EINVAL; | ||
664 | } | 662 | } |
665 | 663 | ||
666 | /* | 664 | /* |
@@ -711,18 +709,23 @@ ssize_t lirc_dev_fop_read(struct file *file, | |||
711 | lirc_buffer_read(ir->buf, buf); | 709 | lirc_buffer_read(ir->buf, buf); |
712 | ret = copy_to_user((void *)buffer+written, buf, | 710 | ret = copy_to_user((void *)buffer+written, buf, |
713 | ir->buf->chunk_size); | 711 | ir->buf->chunk_size); |
714 | written += ir->buf->chunk_size; | 712 | if (!ret) |
713 | written += ir->buf->chunk_size; | ||
714 | else | ||
715 | ret = -EFAULT; | ||
715 | } | 716 | } |
716 | } | 717 | } |
717 | 718 | ||
718 | remove_wait_queue(&ir->buf->wait_poll, &wait); | 719 | remove_wait_queue(&ir->buf->wait_poll, &wait); |
719 | set_current_state(TASK_RUNNING); | 720 | set_current_state(TASK_RUNNING); |
721 | |||
722 | out_locked: | ||
720 | mutex_unlock(&ir->irctl_lock); | 723 | mutex_unlock(&ir->irctl_lock); |
721 | 724 | ||
722 | out_unlocked: | 725 | out_unlocked: |
723 | kfree(buf); | 726 | kfree(buf); |
724 | dev_dbg(ir->d.dev, LOGHEAD "read result = %s (%d)\n", | 727 | dev_dbg(ir->d.dev, LOGHEAD "read result = %s (%d)\n", |
725 | ir->d.name, ir->d.minor, ret ? "-EFAULT" : "OK", ret); | 728 | ir->d.name, ir->d.minor, ret ? "<fail>" : "<ok>", ret); |
726 | 729 | ||
727 | return ret ? ret : written; | 730 | return ret ? ret : written; |
728 | } | 731 | } |
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index 9dce684fd231..392ca24132da 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c | |||
@@ -35,10 +35,10 @@ | |||
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/usb.h> | ||
39 | #include <linux/input.h> | 38 | #include <linux/input.h> |
39 | #include <linux/usb.h> | ||
40 | #include <linux/usb/input.h> | ||
40 | #include <media/ir-core.h> | 41 | #include <media/ir-core.h> |
41 | #include <media/ir-common.h> | ||
42 | 42 | ||
43 | #define DRIVER_VERSION "1.91" | 43 | #define DRIVER_VERSION "1.91" |
44 | #define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" | 44 | #define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" |
@@ -49,6 +49,7 @@ | |||
49 | #define USB_BUFLEN 32 /* USB reception buffer length */ | 49 | #define USB_BUFLEN 32 /* USB reception buffer length */ |
50 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ | 50 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ |
51 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ | 51 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ |
52 | #define MS_TO_NS(msec) ((msec) * 1000) | ||
52 | 53 | ||
53 | /* MCE constants */ | 54 | /* MCE constants */ |
54 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ | 55 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ |
@@ -74,6 +75,7 @@ | |||
74 | #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ | 75 | #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ |
75 | 76 | ||
76 | /* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ | 77 | /* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ |
78 | #define MCE_CMD_SIG_END 0x01 /* End of signal */ | ||
77 | #define MCE_CMD_PING 0x03 /* Ping device */ | 79 | #define MCE_CMD_PING 0x03 /* Ping device */ |
78 | #define MCE_CMD_UNKNOWN 0x04 /* Unknown */ | 80 | #define MCE_CMD_UNKNOWN 0x04 /* Unknown */ |
79 | #define MCE_CMD_UNKNOWN2 0x05 /* Unknown */ | 81 | #define MCE_CMD_UNKNOWN2 0x05 /* Unknown */ |
@@ -91,6 +93,7 @@ | |||
91 | #define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */ | 93 | #define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */ |
92 | #define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */ | 94 | #define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */ |
93 | #define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */ | 95 | #define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */ |
96 | #define MCE_RSP_PULSE_COUNT 0x15 /* RX pulse count (only if learning) */ | ||
94 | #define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */ | 97 | #define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */ |
95 | #define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */ | 98 | #define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */ |
96 | #define MCE_CMD_UNKNOWN7 0x18 /* Unknown */ | 99 | #define MCE_CMD_UNKNOWN7 0x18 /* Unknown */ |
@@ -146,14 +149,16 @@ enum mceusb_model_type { | |||
146 | MCE_GEN3, | 149 | MCE_GEN3, |
147 | MCE_GEN2_TX_INV, | 150 | MCE_GEN2_TX_INV, |
148 | POLARIS_EVK, | 151 | POLARIS_EVK, |
152 | CX_HYBRID_TV, | ||
149 | }; | 153 | }; |
150 | 154 | ||
151 | struct mceusb_model { | 155 | struct mceusb_model { |
152 | u32 mce_gen1:1; | 156 | u32 mce_gen1:1; |
153 | u32 mce_gen2:1; | 157 | u32 mce_gen2:1; |
154 | u32 mce_gen3:1; | 158 | u32 mce_gen3:1; |
155 | u32 tx_mask_inverted:1; | 159 | u32 tx_mask_normal:1; |
156 | u32 is_polaris:1; | 160 | u32 is_polaris:1; |
161 | u32 no_tx:1; | ||
157 | 162 | ||
158 | const char *rc_map; /* Allow specify a per-board map */ | 163 | const char *rc_map; /* Allow specify a per-board map */ |
159 | const char *name; /* per-board name */ | 164 | const char *name; /* per-board name */ |
@@ -162,18 +167,18 @@ struct mceusb_model { | |||
162 | static const struct mceusb_model mceusb_model[] = { | 167 | static const struct mceusb_model mceusb_model[] = { |
163 | [MCE_GEN1] = { | 168 | [MCE_GEN1] = { |
164 | .mce_gen1 = 1, | 169 | .mce_gen1 = 1, |
165 | .tx_mask_inverted = 1, | 170 | .tx_mask_normal = 1, |
166 | }, | 171 | }, |
167 | [MCE_GEN2] = { | 172 | [MCE_GEN2] = { |
168 | .mce_gen2 = 1, | 173 | .mce_gen2 = 1, |
169 | }, | 174 | }, |
170 | [MCE_GEN2_TX_INV] = { | 175 | [MCE_GEN2_TX_INV] = { |
171 | .mce_gen2 = 1, | 176 | .mce_gen2 = 1, |
172 | .tx_mask_inverted = 1, | 177 | .tx_mask_normal = 1, |
173 | }, | 178 | }, |
174 | [MCE_GEN3] = { | 179 | [MCE_GEN3] = { |
175 | .mce_gen3 = 1, | 180 | .mce_gen3 = 1, |
176 | .tx_mask_inverted = 1, | 181 | .tx_mask_normal = 1, |
177 | }, | 182 | }, |
178 | [POLARIS_EVK] = { | 183 | [POLARIS_EVK] = { |
179 | .is_polaris = 1, | 184 | .is_polaris = 1, |
@@ -183,7 +188,12 @@ static const struct mceusb_model mceusb_model[] = { | |||
183 | * to allow testing it | 188 | * to allow testing it |
184 | */ | 189 | */ |
185 | .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, | 190 | .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, |
186 | .name = "cx231xx MCE IR", | 191 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", |
192 | }, | ||
193 | [CX_HYBRID_TV] = { | ||
194 | .is_polaris = 1, | ||
195 | .no_tx = 1, /* tx isn't wired up at all */ | ||
196 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", | ||
187 | }, | 197 | }, |
188 | }; | 198 | }; |
189 | 199 | ||
@@ -273,6 +283,8 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
273 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, | 283 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, |
274 | /* Formosa Industrial Computing */ | 284 | /* Formosa Industrial Computing */ |
275 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, | 285 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, |
286 | /* Fintek eHome Infrared Transceiver (HP branded) */ | ||
287 | { USB_DEVICE(VENDOR_FINTEK, 0x5168) }, | ||
276 | /* Fintek eHome Infrared Transceiver */ | 288 | /* Fintek eHome Infrared Transceiver */ |
277 | { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, | 289 | { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, |
278 | /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ | 290 | /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ |
@@ -292,9 +304,12 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
292 | { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, | 304 | { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, |
293 | /* TiVo PC IR Receiver */ | 305 | /* TiVo PC IR Receiver */ |
294 | { USB_DEVICE(VENDOR_TIVO, 0x2000) }, | 306 | { USB_DEVICE(VENDOR_TIVO, 0x2000) }, |
295 | /* Conexant SDK */ | 307 | /* Conexant Hybrid TV "Shelby" Polaris SDK */ |
296 | { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), | 308 | { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), |
297 | .driver_info = POLARIS_EVK }, | 309 | .driver_info = POLARIS_EVK }, |
310 | /* Conexant Hybrid TV RDU253S Polaris */ | ||
311 | { USB_DEVICE(VENDOR_CONEXANT, 0x58a5), | ||
312 | .driver_info = CX_HYBRID_TV }, | ||
298 | /* Terminating entry */ | 313 | /* Terminating entry */ |
299 | { } | 314 | { } |
300 | }; | 315 | }; |
@@ -303,7 +318,10 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
303 | struct mceusb_dev { | 318 | struct mceusb_dev { |
304 | /* ir-core bits */ | 319 | /* ir-core bits */ |
305 | struct ir_dev_props *props; | 320 | struct ir_dev_props *props; |
306 | struct ir_raw_event rawir; | 321 | |
322 | /* optional features we can enable */ | ||
323 | bool carrier_report_enabled; | ||
324 | bool learning_enabled; | ||
307 | 325 | ||
308 | /* core device bits */ | 326 | /* core device bits */ |
309 | struct device *dev; | 327 | struct device *dev; |
@@ -318,6 +336,8 @@ struct mceusb_dev { | |||
318 | /* buffers and dma */ | 336 | /* buffers and dma */ |
319 | unsigned char *buf_in; | 337 | unsigned char *buf_in; |
320 | unsigned int len_in; | 338 | unsigned int len_in; |
339 | dma_addr_t dma_in; | ||
340 | dma_addr_t dma_out; | ||
321 | 341 | ||
322 | enum { | 342 | enum { |
323 | CMD_HEADER = 0, | 343 | CMD_HEADER = 0, |
@@ -325,15 +345,14 @@ struct mceusb_dev { | |||
325 | CMD_DATA, | 345 | CMD_DATA, |
326 | PARSE_IRDATA, | 346 | PARSE_IRDATA, |
327 | } parser_state; | 347 | } parser_state; |
328 | u8 cmd, rem; /* Remaining IR data bytes in packet */ | ||
329 | 348 | ||
330 | dma_addr_t dma_in; | 349 | u8 cmd, rem; /* Remaining IR data bytes in packet */ |
331 | dma_addr_t dma_out; | ||
332 | 350 | ||
333 | struct { | 351 | struct { |
334 | u32 connected:1; | 352 | u32 connected:1; |
335 | u32 tx_mask_inverted:1; | 353 | u32 tx_mask_normal:1; |
336 | u32 microsoft_gen1:1; | 354 | u32 microsoft_gen1:1; |
355 | u32 no_tx:1; | ||
337 | } flags; | 356 | } flags; |
338 | 357 | ||
339 | /* transmit support */ | 358 | /* transmit support */ |
@@ -408,9 +427,10 @@ static int mceusb_cmdsize(u8 cmd, u8 subcmd) | |||
408 | case MCE_CMD_UNKNOWN: | 427 | case MCE_CMD_UNKNOWN: |
409 | case MCE_CMD_S_CARRIER: | 428 | case MCE_CMD_S_CARRIER: |
410 | case MCE_CMD_S_TIMEOUT: | 429 | case MCE_CMD_S_TIMEOUT: |
411 | case MCE_CMD_G_RXSENSOR: | 430 | case MCE_RSP_PULSE_COUNT: |
412 | datasize = 2; | 431 | datasize = 2; |
413 | break; | 432 | break; |
433 | case MCE_CMD_SIG_END: | ||
414 | case MCE_CMD_S_TXMASK: | 434 | case MCE_CMD_S_TXMASK: |
415 | case MCE_CMD_S_RXSENSOR: | 435 | case MCE_CMD_S_RXSENSOR: |
416 | datasize = 1; | 436 | datasize = 1; |
@@ -433,7 +453,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
433 | return; | 453 | return; |
434 | 454 | ||
435 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ | 455 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ |
436 | if (ir->flags.microsoft_gen1 && !out) | 456 | if (ir->flags.microsoft_gen1 && !out && !offset) |
437 | skip = 2; | 457 | skip = 2; |
438 | 458 | ||
439 | if (len <= skip) | 459 | if (len <= skip) |
@@ -491,6 +511,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
491 | break; | 511 | break; |
492 | case MCE_COMMAND_HEADER: | 512 | case MCE_COMMAND_HEADER: |
493 | switch (subcmd) { | 513 | switch (subcmd) { |
514 | case MCE_CMD_SIG_END: | ||
515 | dev_info(dev, "End of signal\n"); | ||
516 | break; | ||
494 | case MCE_CMD_PING: | 517 | case MCE_CMD_PING: |
495 | dev_info(dev, "Ping\n"); | 518 | dev_info(dev, "Ping\n"); |
496 | break; | 519 | break; |
@@ -525,10 +548,11 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
525 | inout, data1 == 0x02 ? "short" : "long"); | 548 | inout, data1 == 0x02 ? "short" : "long"); |
526 | break; | 549 | break; |
527 | case MCE_CMD_G_RXSENSOR: | 550 | case MCE_CMD_G_RXSENSOR: |
528 | if (len == 2) | 551 | /* aka MCE_RSP_PULSE_COUNT */ |
552 | if (out) | ||
529 | dev_info(dev, "Get receive sensor\n"); | 553 | dev_info(dev, "Get receive sensor\n"); |
530 | else | 554 | else if (ir->learning_enabled) |
531 | dev_info(dev, "Received pulse count is %d\n", | 555 | dev_info(dev, "RX pulse count: %d\n", |
532 | ((data1 << 8) | data2)); | 556 | ((data1 << 8) | data2)); |
533 | break; | 557 | break; |
534 | case MCE_RSP_CMD_INVALID: | 558 | case MCE_RSP_CMD_INVALID: |
@@ -724,16 +748,16 @@ out: | |||
724 | return ret ? ret : n; | 748 | return ret ? ret : n; |
725 | } | 749 | } |
726 | 750 | ||
727 | /* Sets active IR outputs -- mce devices typically (all?) have two */ | 751 | /* Sets active IR outputs -- mce devices typically have two */ |
728 | static int mceusb_set_tx_mask(void *priv, u32 mask) | 752 | static int mceusb_set_tx_mask(void *priv, u32 mask) |
729 | { | 753 | { |
730 | struct mceusb_dev *ir = priv; | 754 | struct mceusb_dev *ir = priv; |
731 | 755 | ||
732 | if (ir->flags.tx_mask_inverted) | 756 | if (ir->flags.tx_mask_normal) |
757 | ir->tx_mask = mask; | ||
758 | else | ||
733 | ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? | 759 | ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? |
734 | mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; | 760 | mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; |
735 | else | ||
736 | ir->tx_mask = mask; | ||
737 | 761 | ||
738 | return 0; | 762 | return 0; |
739 | } | 763 | } |
@@ -752,7 +776,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier) | |||
752 | 776 | ||
753 | if (carrier == 0) { | 777 | if (carrier == 0) { |
754 | ir->carrier = carrier; | 778 | ir->carrier = carrier; |
755 | cmdbuf[2] = 0x01; | 779 | cmdbuf[2] = MCE_CMD_SIG_END; |
756 | cmdbuf[3] = MCE_IRDATA_TRAILER; | 780 | cmdbuf[3] = MCE_IRDATA_TRAILER; |
757 | dev_dbg(ir->dev, "%s: disabling carrier " | 781 | dev_dbg(ir->dev, "%s: disabling carrier " |
758 | "modulation\n", __func__); | 782 | "modulation\n", __func__); |
@@ -782,6 +806,34 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier) | |||
782 | return carrier; | 806 | return carrier; |
783 | } | 807 | } |
784 | 808 | ||
809 | /* | ||
810 | * We don't do anything but print debug spew for many of the command bits | ||
811 | * we receive from the hardware, but some of them are useful information | ||
812 | * we want to store so that we can use them. | ||
813 | */ | ||
814 | static void mceusb_handle_command(struct mceusb_dev *ir, int index) | ||
815 | { | ||
816 | u8 hi = ir->buf_in[index + 1] & 0xff; | ||
817 | u8 lo = ir->buf_in[index + 2] & 0xff; | ||
818 | |||
819 | switch (ir->buf_in[index]) { | ||
820 | /* 2-byte return value commands */ | ||
821 | case MCE_CMD_S_TIMEOUT: | ||
822 | ir->props->timeout = MS_TO_NS((hi << 8 | lo) / 2); | ||
823 | break; | ||
824 | |||
825 | /* 1-byte return value commands */ | ||
826 | case MCE_CMD_S_TXMASK: | ||
827 | ir->tx_mask = hi; | ||
828 | break; | ||
829 | case MCE_CMD_S_RXSENSOR: | ||
830 | ir->learning_enabled = (hi == 0x02); | ||
831 | break; | ||
832 | default: | ||
833 | break; | ||
834 | } | ||
835 | } | ||
836 | |||
785 | static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | 837 | static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) |
786 | { | 838 | { |
787 | DEFINE_IR_RAW_EVENT(rawir); | 839 | DEFINE_IR_RAW_EVENT(rawir); |
@@ -791,39 +843,30 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
791 | if (ir->flags.microsoft_gen1) | 843 | if (ir->flags.microsoft_gen1) |
792 | i = 2; | 844 | i = 2; |
793 | 845 | ||
846 | /* if there's no data, just return now */ | ||
847 | if (buf_len <= i) | ||
848 | return; | ||
849 | |||
794 | for (; i < buf_len; i++) { | 850 | for (; i < buf_len; i++) { |
795 | switch (ir->parser_state) { | 851 | switch (ir->parser_state) { |
796 | case SUBCMD: | 852 | case SUBCMD: |
797 | ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]); | 853 | ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]); |
798 | mceusb_dev_printdata(ir, ir->buf_in, i - 1, | 854 | mceusb_dev_printdata(ir, ir->buf_in, i - 1, |
799 | ir->rem + 2, false); | 855 | ir->rem + 2, false); |
856 | mceusb_handle_command(ir, i); | ||
800 | ir->parser_state = CMD_DATA; | 857 | ir->parser_state = CMD_DATA; |
801 | break; | 858 | break; |
802 | case PARSE_IRDATA: | 859 | case PARSE_IRDATA: |
803 | ir->rem--; | 860 | ir->rem--; |
804 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); | 861 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); |
805 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) | 862 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) |
806 | * MCE_TIME_UNIT * 1000; | 863 | * MS_TO_NS(MCE_TIME_UNIT); |
807 | |||
808 | if ((ir->buf_in[i] & MCE_PULSE_MASK) == 0x7f) { | ||
809 | if (ir->rawir.pulse == rawir.pulse) { | ||
810 | ir->rawir.duration += rawir.duration; | ||
811 | } else { | ||
812 | ir->rawir.duration = rawir.duration; | ||
813 | ir->rawir.pulse = rawir.pulse; | ||
814 | } | ||
815 | if (ir->rem) | ||
816 | break; | ||
817 | } | ||
818 | rawir.duration += ir->rawir.duration; | ||
819 | ir->rawir.duration = 0; | ||
820 | ir->rawir.pulse = rawir.pulse; | ||
821 | 864 | ||
822 | dev_dbg(ir->dev, "Storing %s with duration %d\n", | 865 | dev_dbg(ir->dev, "Storing %s with duration %d\n", |
823 | rawir.pulse ? "pulse" : "space", | 866 | rawir.pulse ? "pulse" : "space", |
824 | rawir.duration); | 867 | rawir.duration); |
825 | 868 | ||
826 | ir_raw_event_store(ir->idev, &rawir); | 869 | ir_raw_event_store_with_filter(ir->idev, &rawir); |
827 | break; | 870 | break; |
828 | case CMD_DATA: | 871 | case CMD_DATA: |
829 | ir->rem--; | 872 | ir->rem--; |
@@ -839,17 +882,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
839 | continue; | 882 | continue; |
840 | } | 883 | } |
841 | ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); | 884 | ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); |
842 | mceusb_dev_printdata(ir, ir->buf_in, i, ir->rem + 1, false); | 885 | mceusb_dev_printdata(ir, ir->buf_in, |
843 | if (ir->rem) { | 886 | i, ir->rem + 1, false); |
887 | if (ir->rem) | ||
844 | ir->parser_state = PARSE_IRDATA; | 888 | ir->parser_state = PARSE_IRDATA; |
845 | break; | ||
846 | } | ||
847 | /* | ||
848 | * a package with len=0 (e. g. 0x80) means end of | ||
849 | * data. We could use it to do the call to | ||
850 | * ir_raw_event_handle(). For now, we don't need to | ||
851 | * use it. | ||
852 | */ | ||
853 | break; | 889 | break; |
854 | } | 890 | } |
855 | 891 | ||
@@ -984,9 +1020,11 @@ static void mceusb_get_parameters(struct mceusb_dev *ir) | |||
984 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); | 1020 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); |
985 | mce_sync_in(ir, NULL, maxp); | 1021 | mce_sync_in(ir, NULL, maxp); |
986 | 1022 | ||
987 | /* get the transmitter bitmask */ | 1023 | if (!ir->flags.no_tx) { |
988 | mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); | 1024 | /* get the transmitter bitmask */ |
989 | mce_sync_in(ir, NULL, maxp); | 1025 | mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); |
1026 | mce_sync_in(ir, NULL, maxp); | ||
1027 | } | ||
990 | 1028 | ||
991 | /* get receiver timeout value */ | 1029 | /* get receiver timeout value */ |
992 | mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); | 1030 | mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); |
@@ -1035,12 +1073,18 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) | |||
1035 | props->priv = ir; | 1073 | props->priv = ir; |
1036 | props->driver_type = RC_DRIVER_IR_RAW; | 1074 | props->driver_type = RC_DRIVER_IR_RAW; |
1037 | props->allowed_protos = IR_TYPE_ALL; | 1075 | props->allowed_protos = IR_TYPE_ALL; |
1038 | props->s_tx_mask = mceusb_set_tx_mask; | 1076 | props->timeout = MS_TO_NS(1000); |
1039 | props->s_tx_carrier = mceusb_set_tx_carrier; | 1077 | if (!ir->flags.no_tx) { |
1040 | props->tx_ir = mceusb_tx_ir; | 1078 | props->s_tx_mask = mceusb_set_tx_mask; |
1079 | props->s_tx_carrier = mceusb_set_tx_carrier; | ||
1080 | props->tx_ir = mceusb_tx_ir; | ||
1081 | } | ||
1041 | 1082 | ||
1042 | ir->props = props; | 1083 | ir->props = props; |
1043 | 1084 | ||
1085 | usb_to_input_id(ir->usbdev, &idev->id); | ||
1086 | idev->dev.parent = ir->dev; | ||
1087 | |||
1044 | if (mceusb_model[ir->model].rc_map) | 1088 | if (mceusb_model[ir->model].rc_map) |
1045 | rc_map = mceusb_model[ir->model].rc_map; | 1089 | rc_map = mceusb_model[ir->model].rc_map; |
1046 | 1090 | ||
@@ -1074,16 +1118,16 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1074 | enum mceusb_model_type model = id->driver_info; | 1118 | enum mceusb_model_type model = id->driver_info; |
1075 | bool is_gen3; | 1119 | bool is_gen3; |
1076 | bool is_microsoft_gen1; | 1120 | bool is_microsoft_gen1; |
1077 | bool tx_mask_inverted; | 1121 | bool tx_mask_normal; |
1078 | bool is_polaris; | 1122 | bool is_polaris; |
1079 | 1123 | ||
1080 | dev_dbg(&intf->dev, ": %s called\n", __func__); | 1124 | dev_dbg(&intf->dev, "%s called\n", __func__); |
1081 | 1125 | ||
1082 | idesc = intf->cur_altsetting; | 1126 | idesc = intf->cur_altsetting; |
1083 | 1127 | ||
1084 | is_gen3 = mceusb_model[model].mce_gen3; | 1128 | is_gen3 = mceusb_model[model].mce_gen3; |
1085 | is_microsoft_gen1 = mceusb_model[model].mce_gen1; | 1129 | is_microsoft_gen1 = mceusb_model[model].mce_gen1; |
1086 | tx_mask_inverted = mceusb_model[model].tx_mask_inverted; | 1130 | tx_mask_normal = mceusb_model[model].tx_mask_normal; |
1087 | is_polaris = mceusb_model[model].is_polaris; | 1131 | is_polaris = mceusb_model[model].is_polaris; |
1088 | 1132 | ||
1089 | if (is_polaris) { | 1133 | if (is_polaris) { |
@@ -1107,7 +1151,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1107 | ep_in = ep; | 1151 | ep_in = ep; |
1108 | ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; | 1152 | ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; |
1109 | ep_in->bInterval = 1; | 1153 | ep_in->bInterval = 1; |
1110 | dev_dbg(&intf->dev, ": acceptable inbound endpoint " | 1154 | dev_dbg(&intf->dev, "acceptable inbound endpoint " |
1111 | "found\n"); | 1155 | "found\n"); |
1112 | } | 1156 | } |
1113 | 1157 | ||
@@ -1122,12 +1166,12 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1122 | ep_out = ep; | 1166 | ep_out = ep; |
1123 | ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; | 1167 | ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; |
1124 | ep_out->bInterval = 1; | 1168 | ep_out->bInterval = 1; |
1125 | dev_dbg(&intf->dev, ": acceptable outbound endpoint " | 1169 | dev_dbg(&intf->dev, "acceptable outbound endpoint " |
1126 | "found\n"); | 1170 | "found\n"); |
1127 | } | 1171 | } |
1128 | } | 1172 | } |
1129 | if (ep_in == NULL) { | 1173 | if (ep_in == NULL) { |
1130 | dev_dbg(&intf->dev, ": inbound and/or endpoint not found\n"); | 1174 | dev_dbg(&intf->dev, "inbound and/or endpoint not found\n"); |
1131 | return -ENODEV; | 1175 | return -ENODEV; |
1132 | } | 1176 | } |
1133 | 1177 | ||
@@ -1150,11 +1194,10 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1150 | ir->dev = &intf->dev; | 1194 | ir->dev = &intf->dev; |
1151 | ir->len_in = maxp; | 1195 | ir->len_in = maxp; |
1152 | ir->flags.microsoft_gen1 = is_microsoft_gen1; | 1196 | ir->flags.microsoft_gen1 = is_microsoft_gen1; |
1153 | ir->flags.tx_mask_inverted = tx_mask_inverted; | 1197 | ir->flags.tx_mask_normal = tx_mask_normal; |
1198 | ir->flags.no_tx = mceusb_model[model].no_tx; | ||
1154 | ir->model = model; | 1199 | ir->model = model; |
1155 | 1200 | ||
1156 | init_ir_raw_event(&ir->rawir); | ||
1157 | |||
1158 | /* Saving usb interface data for use by the transmitter routine */ | 1201 | /* Saving usb interface data for use by the transmitter routine */ |
1159 | ir->usb_ep_in = ep_in; | 1202 | ir->usb_ep_in = ep_in; |
1160 | ir->usb_ep_out = ep_out; | 1203 | ir->usb_ep_out = ep_out; |
@@ -1191,7 +1234,8 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1191 | 1234 | ||
1192 | mceusb_get_parameters(ir); | 1235 | mceusb_get_parameters(ir); |
1193 | 1236 | ||
1194 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); | 1237 | if (!ir->flags.no_tx) |
1238 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); | ||
1195 | 1239 | ||
1196 | usb_set_intfdata(intf, ir); | 1240 | usb_set_intfdata(intf, ir); |
1197 | 1241 | ||
diff --git a/drivers/media/IR/nuvoton-cir.c b/drivers/media/IR/nuvoton-cir.c index 301be53aee85..acc729c79cec 100644 --- a/drivers/media/IR/nuvoton-cir.c +++ b/drivers/media/IR/nuvoton-cir.c | |||
@@ -603,6 +603,8 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
603 | count = nvt->pkts; | 603 | count = nvt->pkts; |
604 | nvt_dbg_verbose("Processing buffer of len %d", count); | 604 | nvt_dbg_verbose("Processing buffer of len %d", count); |
605 | 605 | ||
606 | init_ir_raw_event(&rawir); | ||
607 | |||
606 | for (i = 0; i < count; i++) { | 608 | for (i = 0; i < count; i++) { |
607 | nvt->pkts--; | 609 | nvt->pkts--; |
608 | sample = nvt->buf[i]; | 610 | sample = nvt->buf[i]; |
@@ -643,11 +645,15 @@ static void nvt_process_rx_ir_data(struct nvt_dev *nvt) | |||
643 | * indicates end of IR signal, but new data incoming. In both | 645 | * indicates end of IR signal, but new data incoming. In both |
644 | * cases, it means we're ready to call ir_raw_event_handle | 646 | * cases, it means we're ready to call ir_raw_event_handle |
645 | */ | 647 | */ |
646 | if (sample == BUF_PULSE_BIT || ((sample != BUF_LEN_MASK) && | 648 | if ((sample == BUF_PULSE_BIT) && nvt->pkts) { |
647 | (sample & BUF_REPEAT_MASK) == BUF_REPEAT_BYTE)) | 649 | nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); |
648 | ir_raw_event_handle(nvt->rdev); | 650 | ir_raw_event_handle(nvt->rdev); |
651 | } | ||
649 | } | 652 | } |
650 | 653 | ||
654 | nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); | ||
655 | ir_raw_event_handle(nvt->rdev); | ||
656 | |||
651 | if (nvt->pkts) { | 657 | if (nvt->pkts) { |
652 | nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts); | 658 | nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts); |
653 | nvt->pkts = 0; | 659 | nvt->pkts = 0; |
diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c index 548381c35bfd..3a20aef67d08 100644 --- a/drivers/media/IR/streamzap.c +++ b/drivers/media/IR/streamzap.c | |||
@@ -34,8 +34,9 @@ | |||
34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/usb.h> | ||
38 | #include <linux/input.h> | 37 | #include <linux/input.h> |
38 | #include <linux/usb.h> | ||
39 | #include <linux/usb/input.h> | ||
39 | #include <media/ir-core.h> | 40 | #include <media/ir-core.h> |
40 | 41 | ||
41 | #define DRIVER_VERSION "1.61" | 42 | #define DRIVER_VERSION "1.61" |
@@ -140,7 +141,9 @@ static struct usb_driver streamzap_driver = { | |||
140 | 141 | ||
141 | static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) | 142 | static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) |
142 | { | 143 | { |
143 | ir_raw_event_store(sz->idev, &rawir); | 144 | dev_dbg(sz->dev, "Storing %s with duration %u us\n", |
145 | (rawir.pulse ? "pulse" : "space"), rawir.duration); | ||
146 | ir_raw_event_store_with_filter(sz->idev, &rawir); | ||
144 | } | 147 | } |
145 | 148 | ||
146 | static void sz_push_full_pulse(struct streamzap_ir *sz, | 149 | static void sz_push_full_pulse(struct streamzap_ir *sz, |
@@ -167,7 +170,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
167 | rawir.duration *= 1000; | 170 | rawir.duration *= 1000; |
168 | rawir.duration &= IR_MAX_DURATION; | 171 | rawir.duration &= IR_MAX_DURATION; |
169 | } | 172 | } |
170 | dev_dbg(sz->dev, "ls %u\n", rawir.duration); | ||
171 | sz_push(sz, rawir); | 173 | sz_push(sz, rawir); |
172 | 174 | ||
173 | sz->idle = false; | 175 | sz->idle = false; |
@@ -180,7 +182,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
180 | sz->sum += rawir.duration; | 182 | sz->sum += rawir.duration; |
181 | rawir.duration *= 1000; | 183 | rawir.duration *= 1000; |
182 | rawir.duration &= IR_MAX_DURATION; | 184 | rawir.duration &= IR_MAX_DURATION; |
183 | dev_dbg(sz->dev, "p %u\n", rawir.duration); | ||
184 | sz_push(sz, rawir); | 185 | sz_push(sz, rawir); |
185 | } | 186 | } |
186 | 187 | ||
@@ -200,7 +201,6 @@ static void sz_push_full_space(struct streamzap_ir *sz, | |||
200 | rawir.duration += SZ_RESOLUTION / 2; | 201 | rawir.duration += SZ_RESOLUTION / 2; |
201 | sz->sum += rawir.duration; | 202 | sz->sum += rawir.duration; |
202 | rawir.duration *= 1000; | 203 | rawir.duration *= 1000; |
203 | dev_dbg(sz->dev, "s %u\n", rawir.duration); | ||
204 | sz_push(sz, rawir); | 204 | sz_push(sz, rawir); |
205 | } | 205 | } |
206 | 206 | ||
@@ -221,8 +221,6 @@ static void streamzap_callback(struct urb *urb) | |||
221 | struct streamzap_ir *sz; | 221 | struct streamzap_ir *sz; |
222 | unsigned int i; | 222 | unsigned int i; |
223 | int len; | 223 | int len; |
224 | static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & | ||
225 | IR_MAX_DURATION) | 0x03000000); | ||
226 | 224 | ||
227 | if (!urb) | 225 | if (!urb) |
228 | return; | 226 | return; |
@@ -246,7 +244,7 @@ static void streamzap_callback(struct urb *urb) | |||
246 | 244 | ||
247 | dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); | 245 | dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); |
248 | for (i = 0; i < len; i++) { | 246 | for (i = 0; i < len; i++) { |
249 | dev_dbg(sz->dev, "sz idx %d: %x\n", | 247 | dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n", |
250 | i, (unsigned char)sz->buf_in[i]); | 248 | i, (unsigned char)sz->buf_in[i]); |
251 | switch (sz->decoder_state) { | 249 | switch (sz->decoder_state) { |
252 | case PulseSpace: | 250 | case PulseSpace: |
@@ -273,7 +271,7 @@ static void streamzap_callback(struct urb *urb) | |||
273 | DEFINE_IR_RAW_EVENT(rawir); | 271 | DEFINE_IR_RAW_EVENT(rawir); |
274 | 272 | ||
275 | rawir.pulse = false; | 273 | rawir.pulse = false; |
276 | rawir.duration = timeout; | 274 | rawir.duration = sz->props->timeout; |
277 | sz->idle = true; | 275 | sz->idle = true; |
278 | if (sz->timeout_enabled) | 276 | if (sz->timeout_enabled) |
279 | sz_push(sz, rawir); | 277 | sz_push(sz, rawir); |
@@ -335,6 +333,9 @@ static struct input_dev *streamzap_init_input_dev(struct streamzap_ir *sz) | |||
335 | 333 | ||
336 | sz->props = props; | 334 | sz->props = props; |
337 | 335 | ||
336 | usb_to_input_id(sz->usbdev, &idev->id); | ||
337 | idev->dev.parent = sz->dev; | ||
338 | |||
338 | ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); | 339 | ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); |
339 | if (ret < 0) { | 340 | if (ret < 0) { |
340 | dev_err(dev, "remote input device register failed\n"); | 341 | dev_err(dev, "remote input device register failed\n"); |
@@ -444,6 +445,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf, | |||
444 | sz->decoder_state = PulseSpace; | 445 | sz->decoder_state = PulseSpace; |
445 | /* FIXME: don't yet have a way to set this */ | 446 | /* FIXME: don't yet have a way to set this */ |
446 | sz->timeout_enabled = true; | 447 | sz->timeout_enabled = true; |
448 | sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & | ||
449 | IR_MAX_DURATION) | 0x03000000); | ||
447 | #if 0 | 450 | #if 0 |
448 | /* not yet supported, depends on patches from maxim */ | 451 | /* not yet supported, depends on patches from maxim */ |
449 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ | 452 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ |
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 05bde9ccb770..1d1d8d200755 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c | |||
@@ -558,7 +558,7 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e | |||
558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) | 558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) |
559 | { | 559 | { |
560 | struct saa7146_vv *vv = dev->vv_data; | 560 | struct saa7146_vv *vv = dev->vv_data; |
561 | struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat); | 561 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev, pixelformat); |
562 | 562 | ||
563 | int b_depth = vv->ov_fmt->depth; | 563 | int b_depth = vv->ov_fmt->depth; |
564 | int b_bpl = vv->ov_fb.fmt.bytesperline; | 564 | int b_bpl = vv->ov_fb.fmt.bytesperline; |
@@ -702,7 +702,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 | |||
702 | struct saa7146_vv *vv = dev->vv_data; | 702 | struct saa7146_vv *vv = dev->vv_data; |
703 | struct saa7146_video_dma vdma1; | 703 | struct saa7146_video_dma vdma1; |
704 | 704 | ||
705 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 705 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
706 | 706 | ||
707 | int width = buf->fmt->width; | 707 | int width = buf->fmt->width; |
708 | int height = buf->fmt->height; | 708 | int height = buf->fmt->height; |
@@ -827,7 +827,7 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71 | |||
827 | struct saa7146_video_dma vdma2; | 827 | struct saa7146_video_dma vdma2; |
828 | struct saa7146_video_dma vdma3; | 828 | struct saa7146_video_dma vdma3; |
829 | 829 | ||
830 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 830 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
831 | 831 | ||
832 | int width = buf->fmt->width; | 832 | int width = buf->fmt->width; |
833 | int height = buf->fmt->height; | 833 | int height = buf->fmt->height; |
@@ -994,7 +994,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar) | |||
994 | 994 | ||
995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) | 995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) |
996 | { | 996 | { |
997 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 997 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
998 | struct saa7146_vv *vv = dev->vv_data; | 998 | struct saa7146_vv *vv = dev->vv_data; |
999 | u32 vdma1_prot_addr; | 999 | u32 vdma1_prot_addr; |
1000 | 1000 | ||
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 741c5732b430..d246910129e8 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -84,7 +84,7 @@ static struct saa7146_format formats[] = { | |||
84 | 84 | ||
85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); | 85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); |
86 | 86 | ||
87 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc) | 87 | struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc) |
88 | { | 88 | { |
89 | int i, j = NUM_FORMATS; | 89 | int i, j = NUM_FORMATS; |
90 | 90 | ||
@@ -266,7 +266,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); | 266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
267 | struct scatterlist *list = dma->sglist; | 267 | struct scatterlist *list = dma->sglist; |
268 | int length = dma->sglen; | 268 | int length = dma->sglen; |
269 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 269 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
270 | 270 | ||
271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); | 271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); |
272 | 272 | ||
@@ -408,7 +408,7 @@ static int video_begin(struct saa7146_fh *fh) | |||
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 411 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
412 | /* we need to have a valid format set here */ | 412 | /* we need to have a valid format set here */ |
413 | BUG_ON(NULL == fmt); | 413 | BUG_ON(NULL == fmt); |
414 | 414 | ||
@@ -460,7 +460,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file) | |||
460 | return -EBUSY; | 460 | return -EBUSY; |
461 | } | 461 | } |
462 | 462 | ||
463 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 463 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
464 | /* we need to have a valid format set here */ | 464 | /* we need to have a valid format set here */ |
465 | BUG_ON(NULL == fmt); | 465 | BUG_ON(NULL == fmt); |
466 | 466 | ||
@@ -536,7 +536,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
536 | return -EPERM; | 536 | return -EPERM; |
537 | 537 | ||
538 | /* check args */ | 538 | /* check args */ |
539 | fmt = format_by_fourcc(dev, fb->fmt.pixelformat); | 539 | fmt = saa7146_format_by_fourcc(dev, fb->fmt.pixelformat); |
540 | if (NULL == fmt) | 540 | if (NULL == fmt) |
541 | return -EINVAL; | 541 | return -EINVAL; |
542 | 542 | ||
@@ -760,7 +760,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
760 | 760 | ||
761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); | 761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); |
762 | 762 | ||
763 | fmt = format_by_fourcc(dev, f->fmt.pix.pixelformat); | 763 | fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); |
764 | if (NULL == fmt) | 764 | if (NULL == fmt) |
765 | return -EINVAL; | 765 | return -EINVAL; |
766 | 766 | ||
@@ -1264,7 +1264,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1264 | buf->fmt = &fh->video_fmt; | 1264 | buf->fmt = &fh->video_fmt; |
1265 | buf->vb.field = fh->video_fmt.field; | 1265 | buf->vb.field = fh->video_fmt.field; |
1266 | 1266 | ||
1267 | sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 1267 | sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
1268 | 1268 | ||
1269 | release_all_pagetables(dev, buf); | 1269 | release_all_pagetables(dev, buf); |
1270 | if( 0 != IS_PLANAR(sfmt->trans)) { | 1270 | if( 0 != IS_PLANAR(sfmt->trans)) { |
@@ -1378,7 +1378,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; | 1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; |
1379 | fh->video_fmt.bytesperline = 0; | 1379 | fh->video_fmt.bytesperline = 0; |
1380 | fh->video_fmt.field = V4L2_FIELD_ANY; | 1380 | fh->video_fmt.field = V4L2_FIELD_ANY; |
1381 | sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 1381 | sfmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; | 1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; |
1383 | 1383 | ||
1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, | 1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, |
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig index 2385e6cca635..78b089526e02 100644 --- a/drivers/media/common/tuners/Kconfig +++ b/drivers/media/common/tuners/Kconfig | |||
@@ -31,7 +31,7 @@ config MEDIA_TUNER | |||
31 | select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE | 31 | select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE |
32 | select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE | 32 | select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE |
33 | 33 | ||
34 | menuconfig MEDIA_TUNER_CUSTOMISE | 34 | config MEDIA_TUNER_CUSTOMISE |
35 | bool "Customize analog and hybrid tuner modules to build" | 35 | bool "Customize analog and hybrid tuner modules to build" |
36 | depends on MEDIA_TUNER | 36 | depends on MEDIA_TUNER |
37 | default y if EMBEDDED | 37 | default y if EMBEDDED |
@@ -44,7 +44,8 @@ menuconfig MEDIA_TUNER_CUSTOMISE | |||
44 | 44 | ||
45 | If unsure say N. | 45 | If unsure say N. |
46 | 46 | ||
47 | if MEDIA_TUNER_CUSTOMISE | 47 | menu "Customize TV tuners" |
48 | visible if MEDIA_TUNER_CUSTOMISE | ||
48 | 49 | ||
49 | config MEDIA_TUNER_SIMPLE | 50 | config MEDIA_TUNER_SIMPLE |
50 | tristate "Simple tuner support" | 51 | tristate "Simple tuner support" |
@@ -185,5 +186,4 @@ config MEDIA_TUNER_TDA18218 | |||
185 | default m if MEDIA_TUNER_CUSTOMISE | 186 | default m if MEDIA_TUNER_CUSTOMISE |
186 | help | 187 | help |
187 | NXP TDA18218 silicon tuner driver. | 188 | NXP TDA18218 silicon tuner driver. |
188 | 189 | endmenu | |
189 | endif # MEDIA_TUNER_CUSTOMISE | ||
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index e9062b08a485..96b27016670e 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -12,9 +12,8 @@ config DVB_FE_CUSTOMISE | |||
12 | 12 | ||
13 | If unsure say N. | 13 | If unsure say N. |
14 | 14 | ||
15 | if DVB_FE_CUSTOMISE | ||
16 | |||
17 | menu "Customise DVB Frontends" | 15 | menu "Customise DVB Frontends" |
16 | visible if DVB_FE_CUSTOMISE | ||
18 | 17 | ||
19 | comment "Multistandard (satellite) frontends" | 18 | comment "Multistandard (satellite) frontends" |
20 | depends on DVB_CORE | 19 | depends on DVB_CORE |
@@ -619,5 +618,3 @@ config DVB_DUMMY_FE | |||
619 | tristate "Dummy frontend driver" | 618 | tristate "Dummy frontend driver" |
620 | default n | 619 | default n |
621 | endmenu | 620 | endmenu |
622 | |||
623 | endif | ||
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 5bf4985daede..05e832f61c3e 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -361,7 +361,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
361 | 361 | ||
362 | static const struct v4l2_file_operations rtrack_fops = { | 362 | static const struct v4l2_file_operations rtrack_fops = { |
363 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .ioctl = video_ioctl2, | 364 | .unlocked_ioctl = video_ioctl2, |
365 | }; | 365 | }; |
366 | 366 | ||
367 | static const struct v4l2_ioctl_ops rtrack_ioctl_ops = { | 367 | static const struct v4l2_ioctl_ops rtrack_ioctl_ops = { |
@@ -412,13 +412,6 @@ static int __init rtrack_init(void) | |||
412 | rt->vdev.release = video_device_release_empty; | 412 | rt->vdev.release = video_device_release_empty; |
413 | video_set_drvdata(&rt->vdev, rt); | 413 | video_set_drvdata(&rt->vdev, rt); |
414 | 414 | ||
415 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
416 | v4l2_device_unregister(&rt->v4l2_dev); | ||
417 | release_region(rt->io, 2); | ||
418 | return -EINVAL; | ||
419 | } | ||
420 | v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n"); | ||
421 | |||
422 | /* Set up the I/O locking */ | 415 | /* Set up the I/O locking */ |
423 | 416 | ||
424 | mutex_init(&rt->lock); | 417 | mutex_init(&rt->lock); |
@@ -430,6 +423,13 @@ static int __init rtrack_init(void) | |||
430 | sleep_delay(2000000); /* make sure it's totally down */ | 423 | sleep_delay(2000000); /* make sure it's totally down */ |
431 | outb(0xc0, rt->io); /* steady volume, mute card */ | 424 | outb(0xc0, rt->io); /* steady volume, mute card */ |
432 | 425 | ||
426 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
427 | v4l2_device_unregister(&rt->v4l2_dev); | ||
428 | release_region(rt->io, 2); | ||
429 | return -EINVAL; | ||
430 | } | ||
431 | v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n"); | ||
432 | |||
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index c22311393624..dd8a6ab0d437 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
@@ -324,7 +324,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
324 | 324 | ||
325 | static const struct v4l2_file_operations aztech_fops = { | 325 | static const struct v4l2_file_operations aztech_fops = { |
326 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
327 | .ioctl = video_ioctl2, | 327 | .unlocked_ioctl = video_ioctl2, |
328 | }; | 328 | }; |
329 | 329 | ||
330 | static const struct v4l2_ioctl_ops aztech_ioctl_ops = { | 330 | static const struct v4l2_ioctl_ops aztech_ioctl_ops = { |
@@ -375,6 +375,8 @@ static int __init aztech_init(void) | |||
375 | az->vdev.ioctl_ops = &aztech_ioctl_ops; | 375 | az->vdev.ioctl_ops = &aztech_ioctl_ops; |
376 | az->vdev.release = video_device_release_empty; | 376 | az->vdev.release = video_device_release_empty; |
377 | video_set_drvdata(&az->vdev, az); | 377 | video_set_drvdata(&az->vdev, az); |
378 | /* mute card - prevents noisy bootups */ | ||
379 | outb(0, az->io); | ||
378 | 380 | ||
379 | if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 381 | if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
380 | v4l2_device_unregister(v4l2_dev); | 382 | v4l2_device_unregister(v4l2_dev); |
@@ -383,8 +385,6 @@ static int __init aztech_init(void) | |||
383 | } | 385 | } |
384 | 386 | ||
385 | v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); | 387 | v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); |
386 | /* mute card - prevents noisy bootups */ | ||
387 | outb(0, az->io); | ||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index b701ea6e7c73..bc9ad0897c55 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c | |||
@@ -328,11 +328,10 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo | |||
328 | unsigned char readbuf[RDS_BUFFER]; | 328 | unsigned char readbuf[RDS_BUFFER]; |
329 | int i = 0; | 329 | int i = 0; |
330 | 330 | ||
331 | mutex_lock(&dev->lock); | ||
331 | if (dev->rdsstat == 0) { | 332 | if (dev->rdsstat == 0) { |
332 | mutex_lock(&dev->lock); | ||
333 | dev->rdsstat = 1; | 333 | dev->rdsstat = 1; |
334 | outb(0x80, dev->io); /* Select RDS fifo */ | 334 | outb(0x80, dev->io); /* Select RDS fifo */ |
335 | mutex_unlock(&dev->lock); | ||
336 | init_timer(&dev->readtimer); | 335 | init_timer(&dev->readtimer); |
337 | dev->readtimer.function = cadet_handler; | 336 | dev->readtimer.function = cadet_handler; |
338 | dev->readtimer.data = (unsigned long)dev; | 337 | dev->readtimer.data = (unsigned long)dev; |
@@ -340,12 +339,15 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo | |||
340 | add_timer(&dev->readtimer); | 339 | add_timer(&dev->readtimer); |
341 | } | 340 | } |
342 | if (dev->rdsin == dev->rdsout) { | 341 | if (dev->rdsin == dev->rdsout) { |
342 | mutex_unlock(&dev->lock); | ||
343 | if (file->f_flags & O_NONBLOCK) | 343 | if (file->f_flags & O_NONBLOCK) |
344 | return -EWOULDBLOCK; | 344 | return -EWOULDBLOCK; |
345 | interruptible_sleep_on(&dev->read_queue); | 345 | interruptible_sleep_on(&dev->read_queue); |
346 | mutex_lock(&dev->lock); | ||
346 | } | 347 | } |
347 | while (i < count && dev->rdsin != dev->rdsout) | 348 | while (i < count && dev->rdsin != dev->rdsout) |
348 | readbuf[i++] = dev->rdsbuf[dev->rdsout++]; | 349 | readbuf[i++] = dev->rdsbuf[dev->rdsout++]; |
350 | mutex_unlock(&dev->lock); | ||
349 | 351 | ||
350 | if (copy_to_user(data, readbuf, i)) | 352 | if (copy_to_user(data, readbuf, i)) |
351 | return -EFAULT; | 353 | return -EFAULT; |
@@ -525,9 +527,11 @@ static int cadet_open(struct file *file) | |||
525 | { | 527 | { |
526 | struct cadet *dev = video_drvdata(file); | 528 | struct cadet *dev = video_drvdata(file); |
527 | 529 | ||
530 | mutex_lock(&dev->lock); | ||
528 | dev->users++; | 531 | dev->users++; |
529 | if (1 == dev->users) | 532 | if (1 == dev->users) |
530 | init_waitqueue_head(&dev->read_queue); | 533 | init_waitqueue_head(&dev->read_queue); |
534 | mutex_unlock(&dev->lock); | ||
531 | return 0; | 535 | return 0; |
532 | } | 536 | } |
533 | 537 | ||
@@ -535,11 +539,13 @@ static int cadet_release(struct file *file) | |||
535 | { | 539 | { |
536 | struct cadet *dev = video_drvdata(file); | 540 | struct cadet *dev = video_drvdata(file); |
537 | 541 | ||
542 | mutex_lock(&dev->lock); | ||
538 | dev->users--; | 543 | dev->users--; |
539 | if (0 == dev->users) { | 544 | if (0 == dev->users) { |
540 | del_timer_sync(&dev->readtimer); | 545 | del_timer_sync(&dev->readtimer); |
541 | dev->rdsstat = 0; | 546 | dev->rdsstat = 0; |
542 | } | 547 | } |
548 | mutex_unlock(&dev->lock); | ||
543 | return 0; | 549 | return 0; |
544 | } | 550 | } |
545 | 551 | ||
@@ -559,7 +565,7 @@ static const struct v4l2_file_operations cadet_fops = { | |||
559 | .open = cadet_open, | 565 | .open = cadet_open, |
560 | .release = cadet_release, | 566 | .release = cadet_release, |
561 | .read = cadet_read, | 567 | .read = cadet_read, |
562 | .ioctl = video_ioctl2, | 568 | .unlocked_ioctl = video_ioctl2, |
563 | .poll = cadet_poll, | 569 | .poll = cadet_poll, |
564 | }; | 570 | }; |
565 | 571 | ||
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 79039674a0e0..28fa85ba2087 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -361,7 +361,7 @@ MODULE_DEVICE_TABLE(pci, gemtek_pci_id); | |||
361 | 361 | ||
362 | static const struct v4l2_file_operations gemtek_pci_fops = { | 362 | static const struct v4l2_file_operations gemtek_pci_fops = { |
363 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .ioctl = video_ioctl2, | 364 | .unlocked_ioctl = video_ioctl2, |
365 | }; | 365 | }; |
366 | 366 | ||
367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { | 367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { |
@@ -422,11 +422,11 @@ static int __devinit gemtek_pci_probe(struct pci_dev *pdev, const struct pci_dev | |||
422 | card->vdev.release = video_device_release_empty; | 422 | card->vdev.release = video_device_release_empty; |
423 | video_set_drvdata(&card->vdev, card); | 423 | video_set_drvdata(&card->vdev, card); |
424 | 424 | ||
425 | gemtek_pci_mute(card); | ||
426 | |||
425 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) | 427 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) |
426 | goto err_video; | 428 | goto err_video; |
427 | 429 | ||
428 | gemtek_pci_mute(card); | ||
429 | |||
430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", | 430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", |
431 | pdev->revision, card->iobase, card->iobase + card->length - 1); | 431 | pdev->revision, card->iobase, card->iobase + card->length - 1); |
432 | 432 | ||
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 73985f641f07..259936422e49 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c | |||
@@ -378,7 +378,7 @@ static int gemtek_probe(struct gemtek *gt) | |||
378 | 378 | ||
379 | static const struct v4l2_file_operations gemtek_fops = { | 379 | static const struct v4l2_file_operations gemtek_fops = { |
380 | .owner = THIS_MODULE, | 380 | .owner = THIS_MODULE, |
381 | .ioctl = video_ioctl2, | 381 | .unlocked_ioctl = video_ioctl2, |
382 | }; | 382 | }; |
383 | 383 | ||
384 | static int vidioc_querycap(struct file *file, void *priv, | 384 | static int vidioc_querycap(struct file *file, void *priv, |
@@ -577,12 +577,6 @@ static int __init gemtek_init(void) | |||
577 | gt->vdev.release = video_device_release_empty; | 577 | gt->vdev.release = video_device_release_empty; |
578 | video_set_drvdata(>->vdev, gt); | 578 | video_set_drvdata(>->vdev, gt); |
579 | 579 | ||
580 | if (video_register_device(>->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
581 | v4l2_device_unregister(v4l2_dev); | ||
582 | release_region(gt->io, 1); | ||
583 | return -EBUSY; | ||
584 | } | ||
585 | |||
586 | /* Set defaults */ | 580 | /* Set defaults */ |
587 | gt->lastfreq = GEMTEK_LOWFREQ; | 581 | gt->lastfreq = GEMTEK_LOWFREQ; |
588 | gt->bu2614data = 0; | 582 | gt->bu2614data = 0; |
@@ -590,6 +584,12 @@ static int __init gemtek_init(void) | |||
590 | if (initmute) | 584 | if (initmute) |
591 | gemtek_mute(gt); | 585 | gemtek_mute(gt); |
592 | 586 | ||
587 | if (video_register_device(>->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
588 | v4l2_device_unregister(v4l2_dev); | ||
589 | release_region(gt->io, 1); | ||
590 | return -EBUSY; | ||
591 | } | ||
592 | |||
593 | return 0; | 593 | return 0; |
594 | } | 594 | } |
595 | 595 | ||
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 08f1051979ca..6af61bfeb178 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -299,7 +299,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
299 | 299 | ||
300 | static const struct v4l2_file_operations maestro_fops = { | 300 | static const struct v4l2_file_operations maestro_fops = { |
301 | .owner = THIS_MODULE, | 301 | .owner = THIS_MODULE, |
302 | .ioctl = video_ioctl2, | 302 | .unlocked_ioctl = video_ioctl2, |
303 | }; | 303 | }; |
304 | 304 | ||
305 | static const struct v4l2_ioctl_ops maestro_ioctl_ops = { | 305 | static const struct v4l2_ioctl_ops maestro_ioctl_ops = { |
@@ -383,22 +383,20 @@ static int __devinit maestro_probe(struct pci_dev *pdev, | |||
383 | dev->vdev.release = video_device_release_empty; | 383 | dev->vdev.release = video_device_release_empty; |
384 | video_set_drvdata(&dev->vdev, dev); | 384 | video_set_drvdata(&dev->vdev, dev); |
385 | 385 | ||
386 | if (!radio_power_on(dev)) { | ||
387 | retval = -EIO; | ||
388 | goto errfr1; | ||
389 | } | ||
390 | |||
386 | retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); | 391 | retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); |
387 | if (retval) { | 392 | if (retval) { |
388 | v4l2_err(v4l2_dev, "can't register video device!\n"); | 393 | v4l2_err(v4l2_dev, "can't register video device!\n"); |
389 | goto errfr1; | 394 | goto errfr1; |
390 | } | 395 | } |
391 | 396 | ||
392 | if (!radio_power_on(dev)) { | ||
393 | retval = -EIO; | ||
394 | goto errunr; | ||
395 | } | ||
396 | |||
397 | v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n"); | 397 | v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n"); |
398 | 398 | ||
399 | return 0; | 399 | return 0; |
400 | errunr: | ||
401 | video_unregister_device(&dev->vdev); | ||
402 | errfr1: | 400 | errfr1: |
403 | v4l2_device_unregister(v4l2_dev); | 401 | v4l2_device_unregister(v4l2_dev); |
404 | errfr: | 402 | errfr: |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 255d40df4b46..6459a220b0dd 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -346,7 +346,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
346 | 346 | ||
347 | static const struct v4l2_file_operations maxiradio_fops = { | 347 | static const struct v4l2_file_operations maxiradio_fops = { |
348 | .owner = THIS_MODULE, | 348 | .owner = THIS_MODULE, |
349 | .ioctl = video_ioctl2, | 349 | .unlocked_ioctl = video_ioctl2, |
350 | }; | 350 | }; |
351 | 351 | ||
352 | static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = { | 352 | static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = { |
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c index 4ff885445fd4..3fb76e3834c9 100644 --- a/drivers/media/radio/radio-miropcm20.c +++ b/drivers/media/radio/radio-miropcm20.c | |||
@@ -33,6 +33,7 @@ struct pcm20 { | |||
33 | unsigned long freq; | 33 | unsigned long freq; |
34 | int muted; | 34 | int muted; |
35 | struct snd_miro_aci *aci; | 35 | struct snd_miro_aci *aci; |
36 | struct mutex lock; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static struct pcm20 pcm20_card = { | 39 | static struct pcm20 pcm20_card = { |
@@ -72,7 +73,7 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq) | |||
72 | 73 | ||
73 | static const struct v4l2_file_operations pcm20_fops = { | 74 | static const struct v4l2_file_operations pcm20_fops = { |
74 | .owner = THIS_MODULE, | 75 | .owner = THIS_MODULE, |
75 | .ioctl = video_ioctl2, | 76 | .unlocked_ioctl = video_ioctl2, |
76 | }; | 77 | }; |
77 | 78 | ||
78 | static int vidioc_querycap(struct file *file, void *priv, | 79 | static int vidioc_querycap(struct file *file, void *priv, |
@@ -229,7 +230,7 @@ static int __init pcm20_init(void) | |||
229 | return -ENODEV; | 230 | return -ENODEV; |
230 | } | 231 | } |
231 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); | 232 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); |
232 | 233 | mutex_init(&dev->lock); | |
233 | 234 | ||
234 | res = v4l2_device_register(NULL, v4l2_dev); | 235 | res = v4l2_device_register(NULL, v4l2_dev); |
235 | if (res < 0) { | 236 | if (res < 0) { |
@@ -242,6 +243,7 @@ static int __init pcm20_init(void) | |||
242 | dev->vdev.fops = &pcm20_fops; | 243 | dev->vdev.fops = &pcm20_fops; |
243 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; | 244 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; |
244 | dev->vdev.release = video_device_release_empty; | 245 | dev->vdev.release = video_device_release_empty; |
246 | dev->vdev.lock = &dev->lock; | ||
245 | video_set_drvdata(&dev->vdev, dev); | 247 | video_set_drvdata(&dev->vdev, dev); |
246 | 248 | ||
247 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) | 249 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) |
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index a79296aac9a9..8d6ea591bd18 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c | |||
@@ -266,7 +266,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
266 | 266 | ||
267 | static const struct v4l2_file_operations rtrack2_fops = { | 267 | static const struct v4l2_file_operations rtrack2_fops = { |
268 | .owner = THIS_MODULE, | 268 | .owner = THIS_MODULE, |
269 | .ioctl = video_ioctl2, | 269 | .unlocked_ioctl = video_ioctl2, |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = { | 272 | static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = { |
@@ -315,6 +315,10 @@ static int __init rtrack2_init(void) | |||
315 | dev->vdev.release = video_device_release_empty; | 315 | dev->vdev.release = video_device_release_empty; |
316 | video_set_drvdata(&dev->vdev, dev); | 316 | video_set_drvdata(&dev->vdev, dev); |
317 | 317 | ||
318 | /* mute card - prevents noisy bootups */ | ||
319 | outb(1, dev->io); | ||
320 | dev->muted = 1; | ||
321 | |||
318 | mutex_init(&dev->lock); | 322 | mutex_init(&dev->lock); |
319 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 323 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
320 | v4l2_device_unregister(v4l2_dev); | 324 | v4l2_device_unregister(v4l2_dev); |
@@ -324,10 +328,6 @@ static int __init rtrack2_init(void) | |||
324 | 328 | ||
325 | v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n"); | 329 | v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n"); |
326 | 330 | ||
327 | /* mute card - prevents noisy bootups */ | ||
328 | outb(1, dev->io); | ||
329 | dev->muted = 1; | ||
330 | |||
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 985359d18aa5..b5a5f89e238a 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -260,7 +260,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
260 | 260 | ||
261 | static const struct v4l2_file_operations fmi_fops = { | 261 | static const struct v4l2_file_operations fmi_fops = { |
262 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
263 | .ioctl = video_ioctl2, | 263 | .unlocked_ioctl = video_ioctl2, |
264 | }; | 264 | }; |
265 | 265 | ||
266 | static const struct v4l2_ioctl_ops fmi_ioctl_ops = { | 266 | static const struct v4l2_ioctl_ops fmi_ioctl_ops = { |
@@ -382,6 +382,9 @@ static int __init fmi_init(void) | |||
382 | 382 | ||
383 | mutex_init(&fmi->lock); | 383 | mutex_init(&fmi->lock); |
384 | 384 | ||
385 | /* mute card - prevents noisy bootups */ | ||
386 | fmi_mute(fmi); | ||
387 | |||
385 | if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 388 | if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
386 | v4l2_device_unregister(v4l2_dev); | 389 | v4l2_device_unregister(v4l2_dev); |
387 | release_region(fmi->io, 2); | 390 | release_region(fmi->io, 2); |
@@ -391,8 +394,6 @@ static int __init fmi_init(void) | |||
391 | } | 394 | } |
392 | 395 | ||
393 | v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); | 396 | v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); |
394 | /* mute card - prevents noisy bootups */ | ||
395 | fmi_mute(fmi); | ||
396 | return 0; | 397 | return 0; |
397 | } | 398 | } |
398 | 399 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 52c7bbb32b8b..dc3f04c52d5e 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -376,7 +376,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
376 | 376 | ||
377 | static const struct v4l2_file_operations fmr2_fops = { | 377 | static const struct v4l2_file_operations fmr2_fops = { |
378 | .owner = THIS_MODULE, | 378 | .owner = THIS_MODULE, |
379 | .ioctl = video_ioctl2, | 379 | .unlocked_ioctl = video_ioctl2, |
380 | }; | 380 | }; |
381 | 381 | ||
382 | static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { | 382 | static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { |
@@ -424,6 +424,10 @@ static int __init fmr2_init(void) | |||
424 | fmr2->vdev.release = video_device_release_empty; | 424 | fmr2->vdev.release = video_device_release_empty; |
425 | video_set_drvdata(&fmr2->vdev, fmr2); | 425 | video_set_drvdata(&fmr2->vdev, fmr2); |
426 | 426 | ||
427 | /* mute card - prevents noisy bootups */ | ||
428 | fmr2_mute(fmr2->io); | ||
429 | fmr2_product_info(fmr2); | ||
430 | |||
427 | if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 431 | if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
428 | v4l2_device_unregister(v4l2_dev); | 432 | v4l2_device_unregister(v4l2_dev); |
429 | release_region(fmr2->io, 2); | 433 | release_region(fmr2->io, 2); |
@@ -431,11 +435,6 @@ static int __init fmr2_init(void) | |||
431 | } | 435 | } |
432 | 436 | ||
433 | v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); | 437 | v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); |
434 | /* mute card - prevents noisy bootups */ | ||
435 | mutex_lock(&fmr2->lock); | ||
436 | fmr2_mute(fmr2->io); | ||
437 | fmr2_product_info(fmr2); | ||
438 | mutex_unlock(&fmr2->lock); | ||
439 | debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); | 438 | debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); |
440 | return 0; | 439 | return 0; |
441 | } | 440 | } |
diff --git a/drivers/media/radio/radio-si4713.c b/drivers/media/radio/radio-si4713.c index 6a435786b63d..726d367ad8d0 100644 --- a/drivers/media/radio/radio-si4713.c +++ b/drivers/media/radio/radio-si4713.c | |||
@@ -53,7 +53,8 @@ struct radio_si4713_device { | |||
53 | /* radio_si4713_fops - file operations interface */ | 53 | /* radio_si4713_fops - file operations interface */ |
54 | static const struct v4l2_file_operations radio_si4713_fops = { | 54 | static const struct v4l2_file_operations radio_si4713_fops = { |
55 | .owner = THIS_MODULE, | 55 | .owner = THIS_MODULE, |
56 | .ioctl = video_ioctl2, | 56 | /* Note: locking is done at the subdev level in the i2c driver. */ |
57 | .unlocked_ioctl = video_ioctl2, | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | /* Video4Linux Interface */ | 60 | /* Video4Linux Interface */ |
@@ -291,7 +292,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) | |||
291 | goto unregister_v4l2_dev; | 292 | goto unregister_v4l2_dev; |
292 | } | 293 | } |
293 | 294 | ||
294 | sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter, NULL, | 295 | sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter, |
295 | pdata->subdev_board_info, NULL); | 296 | pdata->subdev_board_info, NULL); |
296 | if (!sd) { | 297 | if (!sd) { |
297 | dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n"); | 298 | dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n"); |
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 789d2ec66e19..0e71d816c725 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c | |||
@@ -142,7 +142,6 @@ struct tea5764_device { | |||
142 | struct video_device *videodev; | 142 | struct video_device *videodev; |
143 | struct tea5764_regs regs; | 143 | struct tea5764_regs regs; |
144 | struct mutex mutex; | 144 | struct mutex mutex; |
145 | int users; | ||
146 | }; | 145 | }; |
147 | 146 | ||
148 | /* I2C code related */ | 147 | /* I2C code related */ |
@@ -458,41 +457,10 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
458 | return 0; | 457 | return 0; |
459 | } | 458 | } |
460 | 459 | ||
461 | static int tea5764_open(struct file *file) | ||
462 | { | ||
463 | /* Currently we support only one device */ | ||
464 | struct tea5764_device *radio = video_drvdata(file); | ||
465 | |||
466 | mutex_lock(&radio->mutex); | ||
467 | /* Only exclusive access */ | ||
468 | if (radio->users) { | ||
469 | mutex_unlock(&radio->mutex); | ||
470 | return -EBUSY; | ||
471 | } | ||
472 | radio->users++; | ||
473 | mutex_unlock(&radio->mutex); | ||
474 | file->private_data = radio; | ||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | static int tea5764_close(struct file *file) | ||
479 | { | ||
480 | struct tea5764_device *radio = video_drvdata(file); | ||
481 | |||
482 | if (!radio) | ||
483 | return -ENODEV; | ||
484 | mutex_lock(&radio->mutex); | ||
485 | radio->users--; | ||
486 | mutex_unlock(&radio->mutex); | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | /* File system interface */ | 460 | /* File system interface */ |
491 | static const struct v4l2_file_operations tea5764_fops = { | 461 | static const struct v4l2_file_operations tea5764_fops = { |
492 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
493 | .open = tea5764_open, | 463 | .unlocked_ioctl = video_ioctl2, |
494 | .release = tea5764_close, | ||
495 | .ioctl = video_ioctl2, | ||
496 | }; | 464 | }; |
497 | 465 | ||
498 | static const struct v4l2_ioctl_ops tea5764_ioctl_ops = { | 466 | static const struct v4l2_ioctl_ops tea5764_ioctl_ops = { |
@@ -527,7 +495,7 @@ static int __devinit tea5764_i2c_probe(struct i2c_client *client, | |||
527 | int ret; | 495 | int ret; |
528 | 496 | ||
529 | PDEBUG("probe"); | 497 | PDEBUG("probe"); |
530 | radio = kmalloc(sizeof(struct tea5764_device), GFP_KERNEL); | 498 | radio = kzalloc(sizeof(struct tea5764_device), GFP_KERNEL); |
531 | if (!radio) | 499 | if (!radio) |
532 | return -ENOMEM; | 500 | return -ENOMEM; |
533 | 501 | ||
@@ -555,12 +523,7 @@ static int __devinit tea5764_i2c_probe(struct i2c_client *client, | |||
555 | 523 | ||
556 | i2c_set_clientdata(client, radio); | 524 | i2c_set_clientdata(client, radio); |
557 | video_set_drvdata(radio->videodev, radio); | 525 | video_set_drvdata(radio->videodev, radio); |
558 | 526 | radio->videodev->lock = &radio->mutex; | |
559 | ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); | ||
560 | if (ret < 0) { | ||
561 | PWARN("Could not register video device!"); | ||
562 | goto errrel; | ||
563 | } | ||
564 | 527 | ||
565 | /* initialize and power off the chip */ | 528 | /* initialize and power off the chip */ |
566 | tea5764_i2c_read(radio); | 529 | tea5764_i2c_read(radio); |
@@ -568,6 +531,12 @@ static int __devinit tea5764_i2c_probe(struct i2c_client *client, | |||
568 | tea5764_mute(radio, 1); | 531 | tea5764_mute(radio, 1); |
569 | tea5764_power_down(radio); | 532 | tea5764_power_down(radio); |
570 | 533 | ||
534 | ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); | ||
535 | if (ret < 0) { | ||
536 | PWARN("Could not register video device!"); | ||
537 | goto errrel; | ||
538 | } | ||
539 | |||
571 | PINFO("registered."); | 540 | PINFO("registered."); |
572 | return 0; | 541 | return 0; |
573 | errrel: | 542 | errrel: |
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index fc1c860fd438..a32663917059 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c | |||
@@ -338,7 +338,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
338 | 338 | ||
339 | static const struct v4l2_file_operations terratec_fops = { | 339 | static const struct v4l2_file_operations terratec_fops = { |
340 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
341 | .ioctl = video_ioctl2, | 341 | .unlocked_ioctl = video_ioctl2, |
342 | }; | 342 | }; |
343 | 343 | ||
344 | static const struct v4l2_ioctl_ops terratec_ioctl_ops = { | 344 | static const struct v4l2_ioctl_ops terratec_ioctl_ops = { |
@@ -389,6 +389,9 @@ static int __init terratec_init(void) | |||
389 | 389 | ||
390 | mutex_init(&tt->lock); | 390 | mutex_init(&tt->lock); |
391 | 391 | ||
392 | /* mute card - prevents noisy bootups */ | ||
393 | tt_write_vol(tt, 0); | ||
394 | |||
392 | if (video_register_device(&tt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 395 | if (video_register_device(&tt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
393 | v4l2_device_unregister(&tt->v4l2_dev); | 396 | v4l2_device_unregister(&tt->v4l2_dev); |
394 | release_region(tt->io, 2); | 397 | release_region(tt->io, 2); |
@@ -396,9 +399,6 @@ static int __init terratec_init(void) | |||
396 | } | 399 | } |
397 | 400 | ||
398 | v4l2_info(v4l2_dev, "TERRATEC ActivRadio Standalone card driver.\n"); | 401 | v4l2_info(v4l2_dev, "TERRATEC ActivRadio Standalone card driver.\n"); |
399 | |||
400 | /* mute card - prevents noisy bootups */ | ||
401 | tt_write_vol(tt, 0); | ||
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index b8bb3ef47df5..a185610b376b 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c | |||
@@ -34,6 +34,7 @@ struct timbradio { | |||
34 | struct v4l2_subdev *sd_dsp; | 34 | struct v4l2_subdev *sd_dsp; |
35 | struct video_device video_dev; | 35 | struct video_device video_dev; |
36 | struct v4l2_device v4l2_dev; | 36 | struct v4l2_device v4l2_dev; |
37 | struct mutex lock; | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | 40 | ||
@@ -142,7 +143,7 @@ static const struct v4l2_ioctl_ops timbradio_ioctl_ops = { | |||
142 | 143 | ||
143 | static const struct v4l2_file_operations timbradio_fops = { | 144 | static const struct v4l2_file_operations timbradio_fops = { |
144 | .owner = THIS_MODULE, | 145 | .owner = THIS_MODULE, |
145 | .ioctl = video_ioctl2, | 146 | .unlocked_ioctl = video_ioctl2, |
146 | }; | 147 | }; |
147 | 148 | ||
148 | static int __devinit timbradio_probe(struct platform_device *pdev) | 149 | static int __devinit timbradio_probe(struct platform_device *pdev) |
@@ -164,6 +165,7 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
164 | } | 165 | } |
165 | 166 | ||
166 | tr->pdata = *pdata; | 167 | tr->pdata = *pdata; |
168 | mutex_init(&tr->lock); | ||
167 | 169 | ||
168 | strlcpy(tr->video_dev.name, "Timberdale Radio", | 170 | strlcpy(tr->video_dev.name, "Timberdale Radio", |
169 | sizeof(tr->video_dev.name)); | 171 | sizeof(tr->video_dev.name)); |
@@ -171,6 +173,7 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
171 | tr->video_dev.ioctl_ops = &timbradio_ioctl_ops; | 173 | tr->video_dev.ioctl_ops = &timbradio_ioctl_ops; |
172 | tr->video_dev.release = video_device_release_empty; | 174 | tr->video_dev.release = video_device_release_empty; |
173 | tr->video_dev.minor = -1; | 175 | tr->video_dev.minor = -1; |
176 | tr->video_dev.lock = &tr->lock; | ||
174 | 177 | ||
175 | strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); | 178 | strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); |
176 | err = v4l2_device_register(NULL, &tr->v4l2_dev); | 179 | err = v4l2_device_register(NULL, &tr->v4l2_dev); |
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index 9d6dcf8af5b0..22fa9cc28abe 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c | |||
@@ -344,7 +344,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
344 | 344 | ||
345 | static const struct v4l2_file_operations trust_fops = { | 345 | static const struct v4l2_file_operations trust_fops = { |
346 | .owner = THIS_MODULE, | 346 | .owner = THIS_MODULE, |
347 | .ioctl = video_ioctl2, | 347 | .unlocked_ioctl = video_ioctl2, |
348 | }; | 348 | }; |
349 | 349 | ||
350 | static const struct v4l2_ioctl_ops trust_ioctl_ops = { | 350 | static const struct v4l2_ioctl_ops trust_ioctl_ops = { |
@@ -396,14 +396,6 @@ static int __init trust_init(void) | |||
396 | tr->vdev.release = video_device_release_empty; | 396 | tr->vdev.release = video_device_release_empty; |
397 | video_set_drvdata(&tr->vdev, tr); | 397 | video_set_drvdata(&tr->vdev, tr); |
398 | 398 | ||
399 | if (video_register_device(&tr->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
400 | v4l2_device_unregister(v4l2_dev); | ||
401 | release_region(tr->io, 2); | ||
402 | return -EINVAL; | ||
403 | } | ||
404 | |||
405 | v4l2_info(v4l2_dev, "Trust FM Radio card driver v1.0.\n"); | ||
406 | |||
407 | write_i2c(tr, 2, TDA7318_ADDR, 0x80); /* speaker att. LF = 0 dB */ | 399 | write_i2c(tr, 2, TDA7318_ADDR, 0x80); /* speaker att. LF = 0 dB */ |
408 | write_i2c(tr, 2, TDA7318_ADDR, 0xa0); /* speaker att. RF = 0 dB */ | 400 | write_i2c(tr, 2, TDA7318_ADDR, 0xa0); /* speaker att. RF = 0 dB */ |
409 | write_i2c(tr, 2, TDA7318_ADDR, 0xc0); /* speaker att. LR = 0 dB */ | 401 | write_i2c(tr, 2, TDA7318_ADDR, 0xc0); /* speaker att. LR = 0 dB */ |
@@ -418,6 +410,14 @@ static int __init trust_init(void) | |||
418 | /* mute card - prevents noisy bootups */ | 410 | /* mute card - prevents noisy bootups */ |
419 | tr_setmute(tr, 1); | 411 | tr_setmute(tr, 1); |
420 | 412 | ||
413 | if (video_register_device(&tr->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
414 | v4l2_device_unregister(v4l2_dev); | ||
415 | release_region(tr->io, 2); | ||
416 | return -EINVAL; | ||
417 | } | ||
418 | |||
419 | v4l2_info(v4l2_dev, "Trust FM Radio card driver v1.0.\n"); | ||
420 | |||
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | 423 | ||
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index b1f630527dc1..8dbbf08f2207 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -317,7 +317,7 @@ static int vidioc_log_status(struct file *file, void *priv) | |||
317 | 317 | ||
318 | static const struct v4l2_file_operations typhoon_fops = { | 318 | static const struct v4l2_file_operations typhoon_fops = { |
319 | .owner = THIS_MODULE, | 319 | .owner = THIS_MODULE, |
320 | .ioctl = video_ioctl2, | 320 | .unlocked_ioctl = video_ioctl2, |
321 | }; | 321 | }; |
322 | 322 | ||
323 | static const struct v4l2_ioctl_ops typhoon_ioctl_ops = { | 323 | static const struct v4l2_ioctl_ops typhoon_ioctl_ops = { |
@@ -344,18 +344,18 @@ static int __init typhoon_init(void) | |||
344 | 344 | ||
345 | strlcpy(v4l2_dev->name, "typhoon", sizeof(v4l2_dev->name)); | 345 | strlcpy(v4l2_dev->name, "typhoon", sizeof(v4l2_dev->name)); |
346 | dev->io = io; | 346 | dev->io = io; |
347 | dev->curfreq = dev->mutefreq = mutefreq; | ||
348 | 347 | ||
349 | if (dev->io == -1) { | 348 | if (dev->io == -1) { |
350 | v4l2_err(v4l2_dev, "You must set an I/O address with io=0x316 or io=0x336\n"); | 349 | v4l2_err(v4l2_dev, "You must set an I/O address with io=0x316 or io=0x336\n"); |
351 | return -EINVAL; | 350 | return -EINVAL; |
352 | } | 351 | } |
353 | 352 | ||
354 | if (dev->mutefreq < 87000 || dev->mutefreq > 108500) { | 353 | if (mutefreq < 87000 || mutefreq > 108500) { |
355 | v4l2_err(v4l2_dev, "You must set a frequency (in kHz) used when muting the card,\n"); | 354 | v4l2_err(v4l2_dev, "You must set a frequency (in kHz) used when muting the card,\n"); |
356 | v4l2_err(v4l2_dev, "e.g. with \"mutefreq=87500\" (87000 <= mutefreq <= 108500)\n"); | 355 | v4l2_err(v4l2_dev, "e.g. with \"mutefreq=87500\" (87000 <= mutefreq <= 108500)\n"); |
357 | return -EINVAL; | 356 | return -EINVAL; |
358 | } | 357 | } |
358 | dev->curfreq = dev->mutefreq = mutefreq << 4; | ||
359 | 359 | ||
360 | mutex_init(&dev->lock); | 360 | mutex_init(&dev->lock); |
361 | if (!request_region(dev->io, 8, "typhoon")) { | 361 | if (!request_region(dev->io, 8, "typhoon")) { |
@@ -378,17 +378,17 @@ static int __init typhoon_init(void) | |||
378 | dev->vdev.ioctl_ops = &typhoon_ioctl_ops; | 378 | dev->vdev.ioctl_ops = &typhoon_ioctl_ops; |
379 | dev->vdev.release = video_device_release_empty; | 379 | dev->vdev.release = video_device_release_empty; |
380 | video_set_drvdata(&dev->vdev, dev); | 380 | video_set_drvdata(&dev->vdev, dev); |
381 | |||
382 | /* mute card - prevents noisy bootups */ | ||
383 | typhoon_mute(dev); | ||
384 | |||
381 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 385 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
382 | v4l2_device_unregister(&dev->v4l2_dev); | 386 | v4l2_device_unregister(&dev->v4l2_dev); |
383 | release_region(dev->io, 8); | 387 | release_region(dev->io, 8); |
384 | return -EINVAL; | 388 | return -EINVAL; |
385 | } | 389 | } |
386 | v4l2_info(v4l2_dev, "port 0x%x.\n", dev->io); | 390 | v4l2_info(v4l2_dev, "port 0x%x.\n", dev->io); |
387 | v4l2_info(v4l2_dev, "mute frequency is %lu kHz.\n", dev->mutefreq); | 391 | v4l2_info(v4l2_dev, "mute frequency is %lu kHz.\n", mutefreq); |
388 | dev->mutefreq <<= 4; | ||
389 | |||
390 | /* mute card - prevents noisy bootups */ | ||
391 | typhoon_mute(dev); | ||
392 | 392 | ||
393 | return 0; | 393 | return 0; |
394 | } | 394 | } |
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index f31eab99c943..af99c5bd88c1 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
@@ -377,7 +377,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
377 | static const struct v4l2_file_operations zoltrix_fops = | 377 | static const struct v4l2_file_operations zoltrix_fops = |
378 | { | 378 | { |
379 | .owner = THIS_MODULE, | 379 | .owner = THIS_MODULE, |
380 | .ioctl = video_ioctl2, | 380 | .unlocked_ioctl = video_ioctl2, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = { | 383 | static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = { |
@@ -424,20 +424,6 @@ static int __init zoltrix_init(void) | |||
424 | return res; | 424 | return res; |
425 | } | 425 | } |
426 | 426 | ||
427 | strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name)); | ||
428 | zol->vdev.v4l2_dev = v4l2_dev; | ||
429 | zol->vdev.fops = &zoltrix_fops; | ||
430 | zol->vdev.ioctl_ops = &zoltrix_ioctl_ops; | ||
431 | zol->vdev.release = video_device_release_empty; | ||
432 | video_set_drvdata(&zol->vdev, zol); | ||
433 | |||
434 | if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
435 | v4l2_device_unregister(v4l2_dev); | ||
436 | release_region(zol->io, 2); | ||
437 | return -EINVAL; | ||
438 | } | ||
439 | v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n"); | ||
440 | |||
441 | mutex_init(&zol->lock); | 427 | mutex_init(&zol->lock); |
442 | 428 | ||
443 | /* mute card - prevents noisy bootups */ | 429 | /* mute card - prevents noisy bootups */ |
@@ -452,6 +438,20 @@ static int __init zoltrix_init(void) | |||
452 | zol->curvol = 0; | 438 | zol->curvol = 0; |
453 | zol->stereo = 1; | 439 | zol->stereo = 1; |
454 | 440 | ||
441 | strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name)); | ||
442 | zol->vdev.v4l2_dev = v4l2_dev; | ||
443 | zol->vdev.fops = &zoltrix_fops; | ||
444 | zol->vdev.ioctl_ops = &zoltrix_ioctl_ops; | ||
445 | zol->vdev.release = video_device_release_empty; | ||
446 | video_set_drvdata(&zol->vdev, zol); | ||
447 | |||
448 | if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
449 | v4l2_device_unregister(v4l2_dev); | ||
450 | release_region(zol->io, 2); | ||
451 | return -EINVAL; | ||
452 | } | ||
453 | v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n"); | ||
454 | |||
455 | return 0; | 455 | return 0; |
456 | } | 456 | } |
457 | 457 | ||
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index ac16e815e275..6830d2848bd7 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -112,7 +112,7 @@ config VIDEO_IR_I2C | |||
112 | # | 112 | # |
113 | 113 | ||
114 | menu "Encoders/decoders and other helper chips" | 114 | menu "Encoders/decoders and other helper chips" |
115 | depends on !VIDEO_HELPER_CHIPS_AUTO | 115 | visible if !VIDEO_HELPER_CHIPS_AUTO |
116 | 116 | ||
117 | comment "Audio decoders" | 117 | comment "Audio decoders" |
118 | 118 | ||
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 31e7a123d19a..f989f2820d88 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c | |||
@@ -712,7 +712,7 @@ static int ar_initialize(struct ar *ar) | |||
712 | static const struct v4l2_file_operations ar_fops = { | 712 | static const struct v4l2_file_operations ar_fops = { |
713 | .owner = THIS_MODULE, | 713 | .owner = THIS_MODULE, |
714 | .read = ar_read, | 714 | .read = ar_read, |
715 | .ioctl = video_ioctl2, | 715 | .unlocked_ioctl = video_ioctl2, |
716 | }; | 716 | }; |
717 | 717 | ||
718 | static const struct v4l2_ioctl_ops ar_ioctl_ops = { | 718 | static const struct v4l2_ioctl_ops ar_ioctl_ops = { |
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 0453816d4ec3..01be89fa5c78 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
@@ -212,7 +212,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
212 | be abstracted out if we ever need to support a different | 212 | be abstracted out if we ever need to support a different |
213 | demod) */ | 213 | demod) */ |
214 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 214 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
215 | NULL, "au8522", 0x8e >> 1, NULL); | 215 | "au8522", 0x8e >> 1, NULL); |
216 | if (sd == NULL) | 216 | if (sd == NULL) |
217 | printk(KERN_ERR "analog subdev registration failed\n"); | 217 | printk(KERN_ERR "analog subdev registration failed\n"); |
218 | } | 218 | } |
@@ -221,7 +221,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
221 | if (dev->board.tuner_type != TUNER_ABSENT) { | 221 | if (dev->board.tuner_type != TUNER_ABSENT) { |
222 | /* Load the tuner module, which does the attach */ | 222 | /* Load the tuner module, which does the attach */ |
223 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 223 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
224 | NULL, "tuner", dev->board.tuner_addr, NULL); | 224 | "tuner", dev->board.tuner_addr, NULL); |
225 | if (sd == NULL) | 225 | if (sd == NULL) |
226 | printk(KERN_ERR "tuner subdev registration fail\n"); | 226 | printk(KERN_ERR "tuner subdev registration fail\n"); |
227 | 227 | ||
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 87d8b006ef77..49efcf660ba6 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -3529,7 +3529,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3529 | struct v4l2_subdev *sd; | 3529 | struct v4l2_subdev *sd; |
3530 | 3530 | ||
3531 | sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3531 | sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3532 | &btv->c.i2c_adap, NULL, "saa6588", 0, addrs); | 3532 | &btv->c.i2c_adap, "saa6588", 0, addrs); |
3533 | btv->has_saa6588 = (sd != NULL); | 3533 | btv->has_saa6588 = (sd != NULL); |
3534 | } | 3534 | } |
3535 | 3535 | ||
@@ -3554,7 +3554,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3554 | }; | 3554 | }; |
3555 | 3555 | ||
3556 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3556 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3557 | &btv->c.i2c_adap, NULL, "msp3400", 0, addrs); | 3557 | &btv->c.i2c_adap, "msp3400", 0, addrs); |
3558 | if (btv->sd_msp34xx) | 3558 | if (btv->sd_msp34xx) |
3559 | return; | 3559 | return; |
3560 | goto no_audio; | 3560 | goto no_audio; |
@@ -3568,7 +3568,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3568 | }; | 3568 | }; |
3569 | 3569 | ||
3570 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3570 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3571 | &btv->c.i2c_adap, NULL, "tda7432", 0, addrs)) | 3571 | &btv->c.i2c_adap, "tda7432", 0, addrs)) |
3572 | return; | 3572 | return; |
3573 | goto no_audio; | 3573 | goto no_audio; |
3574 | } | 3574 | } |
@@ -3576,7 +3576,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3576 | case 3: { | 3576 | case 3: { |
3577 | /* The user specified that we should probe for tvaudio */ | 3577 | /* The user specified that we should probe for tvaudio */ |
3578 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3578 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3579 | &btv->c.i2c_adap, NULL, "tvaudio", 0, tvaudio_addrs()); | 3579 | &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs()); |
3580 | if (btv->sd_tvaudio) | 3580 | if (btv->sd_tvaudio) |
3581 | return; | 3581 | return; |
3582 | goto no_audio; | 3582 | goto no_audio; |
@@ -3596,11 +3596,11 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3596 | found is really something else (e.g. a tea6300). */ | 3596 | found is really something else (e.g. a tea6300). */ |
3597 | if (!bttv_tvcards[btv->c.type].no_msp34xx) { | 3597 | if (!bttv_tvcards[btv->c.type].no_msp34xx) { |
3598 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3598 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3599 | &btv->c.i2c_adap, NULL, "msp3400", | 3599 | &btv->c.i2c_adap, "msp3400", |
3600 | 0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1)); | 3600 | 0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1)); |
3601 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { | 3601 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { |
3602 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3602 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3603 | &btv->c.i2c_adap, NULL, "msp3400", | 3603 | &btv->c.i2c_adap, "msp3400", |
3604 | 0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1)); | 3604 | 0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1)); |
3605 | } | 3605 | } |
3606 | 3606 | ||
@@ -3616,13 +3616,13 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3616 | }; | 3616 | }; |
3617 | 3617 | ||
3618 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3618 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3619 | &btv->c.i2c_adap, NULL, "tda7432", 0, addrs)) | 3619 | &btv->c.i2c_adap, "tda7432", 0, addrs)) |
3620 | return; | 3620 | return; |
3621 | } | 3621 | } |
3622 | 3622 | ||
3623 | /* Now see if we can find one of the tvaudio devices. */ | 3623 | /* Now see if we can find one of the tvaudio devices. */ |
3624 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3624 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3625 | &btv->c.i2c_adap, NULL, "tvaudio", 0, tvaudio_addrs()); | 3625 | &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs()); |
3626 | if (btv->sd_tvaudio) | 3626 | if (btv->sd_tvaudio) |
3627 | return; | 3627 | return; |
3628 | 3628 | ||
@@ -3646,13 +3646,13 @@ void __devinit bttv_init_tuner(struct bttv *btv) | |||
3646 | /* Load tuner module before issuing tuner config call! */ | 3646 | /* Load tuner module before issuing tuner config call! */ |
3647 | if (bttv_tvcards[btv->c.type].has_radio) | 3647 | if (bttv_tvcards[btv->c.type].has_radio) |
3648 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3648 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3649 | &btv->c.i2c_adap, NULL, "tuner", | 3649 | &btv->c.i2c_adap, "tuner", |
3650 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3650 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3651 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3651 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3652 | &btv->c.i2c_adap, NULL, "tuner", | 3652 | &btv->c.i2c_adap, "tuner", |
3653 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3653 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3654 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3654 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3655 | &btv->c.i2c_adap, NULL, "tuner", | 3655 | &btv->c.i2c_adap, "tuner", |
3656 | 0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); | 3656 | 0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); |
3657 | 3657 | ||
3658 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; | 3658 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index a529619e51f6..0902ec041c7a 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -854,7 +854,6 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) | |||
854 | xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; | 854 | xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; |
855 | 855 | ||
856 | /* is it free? */ | 856 | /* is it free? */ |
857 | mutex_lock(&btv->lock); | ||
858 | if (btv->resources & xbits) { | 857 | if (btv->resources & xbits) { |
859 | /* no, someone else uses it */ | 858 | /* no, someone else uses it */ |
860 | goto fail; | 859 | goto fail; |
@@ -884,11 +883,9 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) | |||
884 | /* it's free, grab it */ | 883 | /* it's free, grab it */ |
885 | fh->resources |= bit; | 884 | fh->resources |= bit; |
886 | btv->resources |= bit; | 885 | btv->resources |= bit; |
887 | mutex_unlock(&btv->lock); | ||
888 | return 1; | 886 | return 1; |
889 | 887 | ||
890 | fail: | 888 | fail: |
891 | mutex_unlock(&btv->lock); | ||
892 | return 0; | 889 | return 0; |
893 | } | 890 | } |
894 | 891 | ||
@@ -940,7 +937,6 @@ void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
940 | /* trying to free ressources not allocated by us ... */ | 937 | /* trying to free ressources not allocated by us ... */ |
941 | printk("bttv: BUG! (btres)\n"); | 938 | printk("bttv: BUG! (btres)\n"); |
942 | } | 939 | } |
943 | mutex_lock(&btv->lock); | ||
944 | fh->resources &= ~bits; | 940 | fh->resources &= ~bits; |
945 | btv->resources &= ~bits; | 941 | btv->resources &= ~bits; |
946 | 942 | ||
@@ -951,8 +947,6 @@ void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
951 | 947 | ||
952 | if (0 == (bits & VBI_RESOURCES)) | 948 | if (0 == (bits & VBI_RESOURCES)) |
953 | disclaim_vbi_lines(btv); | 949 | disclaim_vbi_lines(btv); |
954 | |||
955 | mutex_unlock(&btv->lock); | ||
956 | } | 950 | } |
957 | 951 | ||
958 | /* ----------------------------------------------------------------------- */ | 952 | /* ----------------------------------------------------------------------- */ |
@@ -1713,28 +1707,20 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, | |||
1713 | 1707 | ||
1714 | /* Make sure tvnorm and vbi_end remain consistent | 1708 | /* Make sure tvnorm and vbi_end remain consistent |
1715 | until we're done. */ | 1709 | until we're done. */ |
1716 | mutex_lock(&btv->lock); | ||
1717 | 1710 | ||
1718 | norm = btv->tvnorm; | 1711 | norm = btv->tvnorm; |
1719 | 1712 | ||
1720 | /* In this mode capturing always starts at defrect.top | 1713 | /* In this mode capturing always starts at defrect.top |
1721 | (default VDELAY), ignoring cropping parameters. */ | 1714 | (default VDELAY), ignoring cropping parameters. */ |
1722 | if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { | 1715 | if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { |
1723 | mutex_unlock(&btv->lock); | ||
1724 | return -EINVAL; | 1716 | return -EINVAL; |
1725 | } | 1717 | } |
1726 | 1718 | ||
1727 | mutex_unlock(&btv->lock); | ||
1728 | |||
1729 | c.rect = bttv_tvnorms[norm].cropcap.defrect; | 1719 | c.rect = bttv_tvnorms[norm].cropcap.defrect; |
1730 | } else { | 1720 | } else { |
1731 | mutex_lock(&btv->lock); | ||
1732 | |||
1733 | norm = btv->tvnorm; | 1721 | norm = btv->tvnorm; |
1734 | c = btv->crop[!!fh->do_crop]; | 1722 | c = btv->crop[!!fh->do_crop]; |
1735 | 1723 | ||
1736 | mutex_unlock(&btv->lock); | ||
1737 | |||
1738 | if (width < c.min_scaled_width || | 1724 | if (width < c.min_scaled_width || |
1739 | width > c.max_scaled_width || | 1725 | width > c.max_scaled_width || |
1740 | height < c.min_scaled_height) | 1726 | height < c.min_scaled_height) |
@@ -1858,7 +1844,6 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1858 | unsigned int i; | 1844 | unsigned int i; |
1859 | int err; | 1845 | int err; |
1860 | 1846 | ||
1861 | mutex_lock(&btv->lock); | ||
1862 | err = v4l2_prio_check(&btv->prio, fh->prio); | 1847 | err = v4l2_prio_check(&btv->prio, fh->prio); |
1863 | if (err) | 1848 | if (err) |
1864 | goto err; | 1849 | goto err; |
@@ -1874,7 +1859,6 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1874 | set_tvnorm(btv, i); | 1859 | set_tvnorm(btv, i); |
1875 | 1860 | ||
1876 | err: | 1861 | err: |
1877 | mutex_unlock(&btv->lock); | ||
1878 | 1862 | ||
1879 | return err; | 1863 | return err; |
1880 | } | 1864 | } |
@@ -1898,7 +1882,6 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
1898 | struct bttv *btv = fh->btv; | 1882 | struct bttv *btv = fh->btv; |
1899 | int rc = 0; | 1883 | int rc = 0; |
1900 | 1884 | ||
1901 | mutex_lock(&btv->lock); | ||
1902 | if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { | 1885 | if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { |
1903 | rc = -EINVAL; | 1886 | rc = -EINVAL; |
1904 | goto err; | 1887 | goto err; |
@@ -1928,7 +1911,6 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
1928 | i->std = BTTV_NORMS; | 1911 | i->std = BTTV_NORMS; |
1929 | 1912 | ||
1930 | err: | 1913 | err: |
1931 | mutex_unlock(&btv->lock); | ||
1932 | 1914 | ||
1933 | return rc; | 1915 | return rc; |
1934 | } | 1916 | } |
@@ -1938,9 +1920,7 @@ static int bttv_g_input(struct file *file, void *priv, unsigned int *i) | |||
1938 | struct bttv_fh *fh = priv; | 1920 | struct bttv_fh *fh = priv; |
1939 | struct bttv *btv = fh->btv; | 1921 | struct bttv *btv = fh->btv; |
1940 | 1922 | ||
1941 | mutex_lock(&btv->lock); | ||
1942 | *i = btv->input; | 1923 | *i = btv->input; |
1943 | mutex_unlock(&btv->lock); | ||
1944 | 1924 | ||
1945 | return 0; | 1925 | return 0; |
1946 | } | 1926 | } |
@@ -1952,7 +1932,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) | |||
1952 | 1932 | ||
1953 | int err; | 1933 | int err; |
1954 | 1934 | ||
1955 | mutex_lock(&btv->lock); | ||
1956 | err = v4l2_prio_check(&btv->prio, fh->prio); | 1935 | err = v4l2_prio_check(&btv->prio, fh->prio); |
1957 | if (unlikely(err)) | 1936 | if (unlikely(err)) |
1958 | goto err; | 1937 | goto err; |
@@ -1965,7 +1944,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) | |||
1965 | set_input(btv, i, btv->tvnorm); | 1944 | set_input(btv, i, btv->tvnorm); |
1966 | 1945 | ||
1967 | err: | 1946 | err: |
1968 | mutex_unlock(&btv->lock); | ||
1969 | return 0; | 1947 | return 0; |
1970 | } | 1948 | } |
1971 | 1949 | ||
@@ -1979,7 +1957,6 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
1979 | if (unlikely(0 != t->index)) | 1957 | if (unlikely(0 != t->index)) |
1980 | return -EINVAL; | 1958 | return -EINVAL; |
1981 | 1959 | ||
1982 | mutex_lock(&btv->lock); | ||
1983 | if (unlikely(btv->tuner_type == TUNER_ABSENT)) { | 1960 | if (unlikely(btv->tuner_type == TUNER_ABSENT)) { |
1984 | err = -EINVAL; | 1961 | err = -EINVAL; |
1985 | goto err; | 1962 | goto err; |
@@ -1995,7 +1972,6 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
1995 | btv->audio_mode_gpio(btv, t, 1); | 1972 | btv->audio_mode_gpio(btv, t, 1); |
1996 | 1973 | ||
1997 | err: | 1974 | err: |
1998 | mutex_unlock(&btv->lock); | ||
1999 | 1975 | ||
2000 | return 0; | 1976 | return 0; |
2001 | } | 1977 | } |
@@ -2006,10 +1982,8 @@ static int bttv_g_frequency(struct file *file, void *priv, | |||
2006 | struct bttv_fh *fh = priv; | 1982 | struct bttv_fh *fh = priv; |
2007 | struct bttv *btv = fh->btv; | 1983 | struct bttv *btv = fh->btv; |
2008 | 1984 | ||
2009 | mutex_lock(&btv->lock); | ||
2010 | f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1985 | f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
2011 | f->frequency = btv->freq; | 1986 | f->frequency = btv->freq; |
2012 | mutex_unlock(&btv->lock); | ||
2013 | 1987 | ||
2014 | return 0; | 1988 | return 0; |
2015 | } | 1989 | } |
@@ -2024,7 +1998,6 @@ static int bttv_s_frequency(struct file *file, void *priv, | |||
2024 | if (unlikely(f->tuner != 0)) | 1998 | if (unlikely(f->tuner != 0)) |
2025 | return -EINVAL; | 1999 | return -EINVAL; |
2026 | 2000 | ||
2027 | mutex_lock(&btv->lock); | ||
2028 | err = v4l2_prio_check(&btv->prio, fh->prio); | 2001 | err = v4l2_prio_check(&btv->prio, fh->prio); |
2029 | if (unlikely(err)) | 2002 | if (unlikely(err)) |
2030 | goto err; | 2003 | goto err; |
@@ -2039,7 +2012,6 @@ static int bttv_s_frequency(struct file *file, void *priv, | |||
2039 | if (btv->has_matchbox && btv->radio_user) | 2012 | if (btv->has_matchbox && btv->radio_user) |
2040 | tea5757_set_freq(btv, btv->freq); | 2013 | tea5757_set_freq(btv, btv->freq); |
2041 | err: | 2014 | err: |
2042 | mutex_unlock(&btv->lock); | ||
2043 | 2015 | ||
2044 | return 0; | 2016 | return 0; |
2045 | } | 2017 | } |
@@ -2172,7 +2144,6 @@ limit_scaled_size_lock (struct bttv_fh * fh, | |||
2172 | 2144 | ||
2173 | /* Make sure tvnorm, vbi_end and the current cropping parameters | 2145 | /* Make sure tvnorm, vbi_end and the current cropping parameters |
2174 | remain consistent until we're done. */ | 2146 | remain consistent until we're done. */ |
2175 | mutex_lock(&btv->lock); | ||
2176 | 2147 | ||
2177 | b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; | 2148 | b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; |
2178 | 2149 | ||
@@ -2250,7 +2221,6 @@ limit_scaled_size_lock (struct bttv_fh * fh, | |||
2250 | rc = 0; /* success */ | 2221 | rc = 0; /* success */ |
2251 | 2222 | ||
2252 | fail: | 2223 | fail: |
2253 | mutex_unlock(&btv->lock); | ||
2254 | 2224 | ||
2255 | return rc; | 2225 | return rc; |
2256 | } | 2226 | } |
@@ -2282,9 +2252,7 @@ verify_window_lock (struct bttv_fh * fh, | |||
2282 | if (V4L2_FIELD_ANY == field) { | 2252 | if (V4L2_FIELD_ANY == field) { |
2283 | __s32 height2; | 2253 | __s32 height2; |
2284 | 2254 | ||
2285 | mutex_lock(&fh->btv->lock); | ||
2286 | height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; | 2255 | height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; |
2287 | mutex_unlock(&fh->btv->lock); | ||
2288 | field = (win->w.height > height2) | 2256 | field = (win->w.height > height2) |
2289 | ? V4L2_FIELD_INTERLACED | 2257 | ? V4L2_FIELD_INTERLACED |
2290 | : V4L2_FIELD_TOP; | 2258 | : V4L2_FIELD_TOP; |
@@ -2360,7 +2328,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
2360 | } | 2328 | } |
2361 | } | 2329 | } |
2362 | 2330 | ||
2363 | mutex_lock(&fh->cap.vb_lock); | ||
2364 | /* clip against screen */ | 2331 | /* clip against screen */ |
2365 | if (NULL != btv->fbuf.base) | 2332 | if (NULL != btv->fbuf.base) |
2366 | n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, | 2333 | n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, |
@@ -2391,13 +2358,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
2391 | fh->ov.field = win->field; | 2358 | fh->ov.field = win->field; |
2392 | fh->ov.setup_ok = 1; | 2359 | fh->ov.setup_ok = 1; |
2393 | 2360 | ||
2394 | /* | ||
2395 | * FIXME: btv is protected by btv->lock mutex, while btv->init | ||
2396 | * is protected by fh->cap.vb_lock. This seems to open the | ||
2397 | * possibility for some race situations. Maybe the better would | ||
2398 | * be to unify those locks or to use another way to store the | ||
2399 | * init values that will be consumed by videobuf callbacks | ||
2400 | */ | ||
2401 | btv->init.ov.w.width = win->w.width; | 2361 | btv->init.ov.w.width = win->w.width; |
2402 | btv->init.ov.w.height = win->w.height; | 2362 | btv->init.ov.w.height = win->w.height; |
2403 | btv->init.ov.field = win->field; | 2363 | btv->init.ov.field = win->field; |
@@ -2412,7 +2372,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
2412 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2372 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2413 | retval = bttv_switch_overlay(btv,fh,new); | 2373 | retval = bttv_switch_overlay(btv,fh,new); |
2414 | } | 2374 | } |
2415 | mutex_unlock(&fh->cap.vb_lock); | ||
2416 | return retval; | 2375 | return retval; |
2417 | } | 2376 | } |
2418 | 2377 | ||
@@ -2526,9 +2485,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv, | |||
2526 | if (V4L2_FIELD_ANY == field) { | 2485 | if (V4L2_FIELD_ANY == field) { |
2527 | __s32 height2; | 2486 | __s32 height2; |
2528 | 2487 | ||
2529 | mutex_lock(&btv->lock); | ||
2530 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; | 2488 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; |
2531 | mutex_unlock(&btv->lock); | ||
2532 | field = (f->fmt.pix.height > height2) | 2489 | field = (f->fmt.pix.height > height2) |
2533 | ? V4L2_FIELD_INTERLACED | 2490 | ? V4L2_FIELD_INTERLACED |
2534 | : V4L2_FIELD_BOTTOM; | 2491 | : V4L2_FIELD_BOTTOM; |
@@ -2614,7 +2571,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, | |||
2614 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 2571 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); |
2615 | 2572 | ||
2616 | /* update our state informations */ | 2573 | /* update our state informations */ |
2617 | mutex_lock(&fh->cap.vb_lock); | ||
2618 | fh->fmt = fmt; | 2574 | fh->fmt = fmt; |
2619 | fh->cap.field = f->fmt.pix.field; | 2575 | fh->cap.field = f->fmt.pix.field; |
2620 | fh->cap.last = V4L2_FIELD_NONE; | 2576 | fh->cap.last = V4L2_FIELD_NONE; |
@@ -2623,7 +2579,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, | |||
2623 | btv->init.fmt = fmt; | 2579 | btv->init.fmt = fmt; |
2624 | btv->init.width = f->fmt.pix.width; | 2580 | btv->init.width = f->fmt.pix.width; |
2625 | btv->init.height = f->fmt.pix.height; | 2581 | btv->init.height = f->fmt.pix.height; |
2626 | mutex_unlock(&fh->cap.vb_lock); | ||
2627 | 2582 | ||
2628 | return 0; | 2583 | return 0; |
2629 | } | 2584 | } |
@@ -2649,11 +2604,9 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2649 | unsigned int i; | 2604 | unsigned int i; |
2650 | struct bttv_fh *fh = priv; | 2605 | struct bttv_fh *fh = priv; |
2651 | 2606 | ||
2652 | mutex_lock(&fh->cap.vb_lock); | ||
2653 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2607 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2654 | V4L2_MEMORY_MMAP); | 2608 | V4L2_MEMORY_MMAP); |
2655 | if (retval < 0) { | 2609 | if (retval < 0) { |
2656 | mutex_unlock(&fh->cap.vb_lock); | ||
2657 | return retval; | 2610 | return retval; |
2658 | } | 2611 | } |
2659 | 2612 | ||
@@ -2665,7 +2618,6 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2665 | for (i = 0; i < gbuffers; i++) | 2618 | for (i = 0; i < gbuffers; i++) |
2666 | mbuf->offsets[i] = i * gbufsize; | 2619 | mbuf->offsets[i] = i * gbufsize; |
2667 | 2620 | ||
2668 | mutex_unlock(&fh->cap.vb_lock); | ||
2669 | return 0; | 2621 | return 0; |
2670 | } | 2622 | } |
2671 | #endif | 2623 | #endif |
@@ -2775,10 +2727,8 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2775 | int retval = 0; | 2727 | int retval = 0; |
2776 | 2728 | ||
2777 | if (on) { | 2729 | if (on) { |
2778 | mutex_lock(&fh->cap.vb_lock); | ||
2779 | /* verify args */ | 2730 | /* verify args */ |
2780 | if (unlikely(!btv->fbuf.base)) { | 2731 | if (unlikely(!btv->fbuf.base)) { |
2781 | mutex_unlock(&fh->cap.vb_lock); | ||
2782 | return -EINVAL; | 2732 | return -EINVAL; |
2783 | } | 2733 | } |
2784 | if (unlikely(!fh->ov.setup_ok)) { | 2734 | if (unlikely(!fh->ov.setup_ok)) { |
@@ -2787,13 +2737,11 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2787 | } | 2737 | } |
2788 | if (retval) | 2738 | if (retval) |
2789 | return retval; | 2739 | return retval; |
2790 | mutex_unlock(&fh->cap.vb_lock); | ||
2791 | } | 2740 | } |
2792 | 2741 | ||
2793 | if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) | 2742 | if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) |
2794 | return -EBUSY; | 2743 | return -EBUSY; |
2795 | 2744 | ||
2796 | mutex_lock(&fh->cap.vb_lock); | ||
2797 | if (on) { | 2745 | if (on) { |
2798 | fh->ov.tvnorm = btv->tvnorm; | 2746 | fh->ov.tvnorm = btv->tvnorm; |
2799 | new = videobuf_sg_alloc(sizeof(*new)); | 2747 | new = videobuf_sg_alloc(sizeof(*new)); |
@@ -2805,7 +2753,6 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2805 | 2753 | ||
2806 | /* switch over */ | 2754 | /* switch over */ |
2807 | retval = bttv_switch_overlay(btv, fh, new); | 2755 | retval = bttv_switch_overlay(btv, fh, new); |
2808 | mutex_unlock(&fh->cap.vb_lock); | ||
2809 | return retval; | 2756 | return retval; |
2810 | } | 2757 | } |
2811 | 2758 | ||
@@ -2844,7 +2791,6 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2844 | } | 2791 | } |
2845 | 2792 | ||
2846 | /* ok, accept it */ | 2793 | /* ok, accept it */ |
2847 | mutex_lock(&fh->cap.vb_lock); | ||
2848 | btv->fbuf.base = fb->base; | 2794 | btv->fbuf.base = fb->base; |
2849 | btv->fbuf.fmt.width = fb->fmt.width; | 2795 | btv->fbuf.fmt.width = fb->fmt.width; |
2850 | btv->fbuf.fmt.height = fb->fmt.height; | 2796 | btv->fbuf.fmt.height = fb->fmt.height; |
@@ -2876,7 +2822,6 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2876 | retval = bttv_switch_overlay(btv, fh, new); | 2822 | retval = bttv_switch_overlay(btv, fh, new); |
2877 | } | 2823 | } |
2878 | } | 2824 | } |
2879 | mutex_unlock(&fh->cap.vb_lock); | ||
2880 | return retval; | 2825 | return retval; |
2881 | } | 2826 | } |
2882 | 2827 | ||
@@ -2955,7 +2900,6 @@ static int bttv_queryctrl(struct file *file, void *priv, | |||
2955 | c->id >= V4L2_CID_PRIVATE_LASTP1)) | 2900 | c->id >= V4L2_CID_PRIVATE_LASTP1)) |
2956 | return -EINVAL; | 2901 | return -EINVAL; |
2957 | 2902 | ||
2958 | mutex_lock(&btv->lock); | ||
2959 | if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) | 2903 | if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) |
2960 | *c = no_ctl; | 2904 | *c = no_ctl; |
2961 | else { | 2905 | else { |
@@ -2963,7 +2907,6 @@ static int bttv_queryctrl(struct file *file, void *priv, | |||
2963 | 2907 | ||
2964 | *c = (NULL != ctrl) ? *ctrl : no_ctl; | 2908 | *c = (NULL != ctrl) ? *ctrl : no_ctl; |
2965 | } | 2909 | } |
2966 | mutex_unlock(&btv->lock); | ||
2967 | 2910 | ||
2968 | return 0; | 2911 | return 0; |
2969 | } | 2912 | } |
@@ -2974,10 +2917,8 @@ static int bttv_g_parm(struct file *file, void *f, | |||
2974 | struct bttv_fh *fh = f; | 2917 | struct bttv_fh *fh = f; |
2975 | struct bttv *btv = fh->btv; | 2918 | struct bttv *btv = fh->btv; |
2976 | 2919 | ||
2977 | mutex_lock(&btv->lock); | ||
2978 | v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, | 2920 | v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, |
2979 | &parm->parm.capture.timeperframe); | 2921 | &parm->parm.capture.timeperframe); |
2980 | mutex_unlock(&btv->lock); | ||
2981 | 2922 | ||
2982 | return 0; | 2923 | return 0; |
2983 | } | 2924 | } |
@@ -2993,7 +2934,6 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
2993 | if (0 != t->index) | 2934 | if (0 != t->index) |
2994 | return -EINVAL; | 2935 | return -EINVAL; |
2995 | 2936 | ||
2996 | mutex_lock(&btv->lock); | ||
2997 | t->rxsubchans = V4L2_TUNER_SUB_MONO; | 2937 | t->rxsubchans = V4L2_TUNER_SUB_MONO; |
2998 | bttv_call_all(btv, tuner, g_tuner, t); | 2938 | bttv_call_all(btv, tuner, g_tuner, t); |
2999 | strcpy(t->name, "Television"); | 2939 | strcpy(t->name, "Television"); |
@@ -3005,7 +2945,6 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
3005 | if (btv->audio_mode_gpio) | 2945 | if (btv->audio_mode_gpio) |
3006 | btv->audio_mode_gpio(btv, t, 0); | 2946 | btv->audio_mode_gpio(btv, t, 0); |
3007 | 2947 | ||
3008 | mutex_unlock(&btv->lock); | ||
3009 | return 0; | 2948 | return 0; |
3010 | } | 2949 | } |
3011 | 2950 | ||
@@ -3014,9 +2953,7 @@ static int bttv_g_priority(struct file *file, void *f, enum v4l2_priority *p) | |||
3014 | struct bttv_fh *fh = f; | 2953 | struct bttv_fh *fh = f; |
3015 | struct bttv *btv = fh->btv; | 2954 | struct bttv *btv = fh->btv; |
3016 | 2955 | ||
3017 | mutex_lock(&btv->lock); | ||
3018 | *p = v4l2_prio_max(&btv->prio); | 2956 | *p = v4l2_prio_max(&btv->prio); |
3019 | mutex_unlock(&btv->lock); | ||
3020 | 2957 | ||
3021 | return 0; | 2958 | return 0; |
3022 | } | 2959 | } |
@@ -3028,9 +2965,7 @@ static int bttv_s_priority(struct file *file, void *f, | |||
3028 | struct bttv *btv = fh->btv; | 2965 | struct bttv *btv = fh->btv; |
3029 | int rc; | 2966 | int rc; |
3030 | 2967 | ||
3031 | mutex_lock(&btv->lock); | ||
3032 | rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); | 2968 | rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); |
3033 | mutex_unlock(&btv->lock); | ||
3034 | 2969 | ||
3035 | return rc; | 2970 | return rc; |
3036 | } | 2971 | } |
@@ -3045,9 +2980,7 @@ static int bttv_cropcap(struct file *file, void *priv, | |||
3045 | cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) | 2980 | cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) |
3046 | return -EINVAL; | 2981 | return -EINVAL; |
3047 | 2982 | ||
3048 | mutex_lock(&btv->lock); | ||
3049 | *cap = bttv_tvnorms[btv->tvnorm].cropcap; | 2983 | *cap = bttv_tvnorms[btv->tvnorm].cropcap; |
3050 | mutex_unlock(&btv->lock); | ||
3051 | 2984 | ||
3052 | return 0; | 2985 | return 0; |
3053 | } | 2986 | } |
@@ -3065,9 +2998,7 @@ static int bttv_g_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3065 | inconsistent with fh->width or fh->height and apps | 2998 | inconsistent with fh->width or fh->height and apps |
3066 | do not expect a change here. */ | 2999 | do not expect a change here. */ |
3067 | 3000 | ||
3068 | mutex_lock(&btv->lock); | ||
3069 | crop->c = btv->crop[!!fh->do_crop].rect; | 3001 | crop->c = btv->crop[!!fh->do_crop].rect; |
3070 | mutex_unlock(&btv->lock); | ||
3071 | 3002 | ||
3072 | return 0; | 3003 | return 0; |
3073 | } | 3004 | } |
@@ -3091,17 +3022,14 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3091 | /* Make sure tvnorm, vbi_end and the current cropping | 3022 | /* Make sure tvnorm, vbi_end and the current cropping |
3092 | parameters remain consistent until we're done. Note | 3023 | parameters remain consistent until we're done. Note |
3093 | read() may change vbi_end in check_alloc_btres_lock(). */ | 3024 | read() may change vbi_end in check_alloc_btres_lock(). */ |
3094 | mutex_lock(&btv->lock); | ||
3095 | retval = v4l2_prio_check(&btv->prio, fh->prio); | 3025 | retval = v4l2_prio_check(&btv->prio, fh->prio); |
3096 | if (0 != retval) { | 3026 | if (0 != retval) { |
3097 | mutex_unlock(&btv->lock); | ||
3098 | return retval; | 3027 | return retval; |
3099 | } | 3028 | } |
3100 | 3029 | ||
3101 | retval = -EBUSY; | 3030 | retval = -EBUSY; |
3102 | 3031 | ||
3103 | if (locked_btres(fh->btv, VIDEO_RESOURCES)) { | 3032 | if (locked_btres(fh->btv, VIDEO_RESOURCES)) { |
3104 | mutex_unlock(&btv->lock); | ||
3105 | return retval; | 3033 | return retval; |
3106 | } | 3034 | } |
3107 | 3035 | ||
@@ -3113,7 +3041,6 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3113 | 3041 | ||
3114 | b_top = max(b->top, btv->vbi_end); | 3042 | b_top = max(b->top, btv->vbi_end); |
3115 | if (b_top + 32 >= b_bottom) { | 3043 | if (b_top + 32 >= b_bottom) { |
3116 | mutex_unlock(&btv->lock); | ||
3117 | return retval; | 3044 | return retval; |
3118 | } | 3045 | } |
3119 | 3046 | ||
@@ -3136,12 +3063,8 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3136 | 3063 | ||
3137 | btv->crop[1] = c; | 3064 | btv->crop[1] = c; |
3138 | 3065 | ||
3139 | mutex_unlock(&btv->lock); | ||
3140 | |||
3141 | fh->do_crop = 1; | 3066 | fh->do_crop = 1; |
3142 | 3067 | ||
3143 | mutex_lock(&fh->cap.vb_lock); | ||
3144 | |||
3145 | if (fh->width < c.min_scaled_width) { | 3068 | if (fh->width < c.min_scaled_width) { |
3146 | fh->width = c.min_scaled_width; | 3069 | fh->width = c.min_scaled_width; |
3147 | btv->init.width = c.min_scaled_width; | 3070 | btv->init.width = c.min_scaled_width; |
@@ -3158,8 +3081,6 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3158 | btv->init.height = c.max_scaled_height; | 3081 | btv->init.height = c.max_scaled_height; |
3159 | } | 3082 | } |
3160 | 3083 | ||
3161 | mutex_unlock(&fh->cap.vb_lock); | ||
3162 | |||
3163 | return 0; | 3084 | return 0; |
3164 | } | 3085 | } |
3165 | 3086 | ||
@@ -3227,7 +3148,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3227 | return videobuf_poll_stream(file, &fh->vbi, wait); | 3148 | return videobuf_poll_stream(file, &fh->vbi, wait); |
3228 | } | 3149 | } |
3229 | 3150 | ||
3230 | mutex_lock(&fh->cap.vb_lock); | ||
3231 | if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { | 3151 | if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { |
3232 | /* streaming capture */ | 3152 | /* streaming capture */ |
3233 | if (list_empty(&fh->cap.stream)) | 3153 | if (list_empty(&fh->cap.stream)) |
@@ -3262,7 +3182,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3262 | else | 3182 | else |
3263 | rc = 0; | 3183 | rc = 0; |
3264 | err: | 3184 | err: |
3265 | mutex_unlock(&fh->cap.vb_lock); | ||
3266 | return rc; | 3185 | return rc; |
3267 | } | 3186 | } |
3268 | 3187 | ||
@@ -3293,23 +3212,11 @@ static int bttv_open(struct file *file) | |||
3293 | return -ENOMEM; | 3212 | return -ENOMEM; |
3294 | file->private_data = fh; | 3213 | file->private_data = fh; |
3295 | 3214 | ||
3296 | /* | ||
3297 | * btv is protected by btv->lock mutex, while btv->init and other | ||
3298 | * streaming vars are protected by fh->cap.vb_lock. We need to take | ||
3299 | * care of both locks to avoid troubles. However, vb_lock is used also | ||
3300 | * inside videobuf, without calling buf->lock. So, it is a very bad | ||
3301 | * idea to hold both locks at the same time. | ||
3302 | * Let's first copy btv->init at fh, holding cap.vb_lock, and then work | ||
3303 | * with the rest of init, holding btv->lock. | ||
3304 | */ | ||
3305 | mutex_lock(&fh->cap.vb_lock); | ||
3306 | *fh = btv->init; | 3215 | *fh = btv->init; |
3307 | mutex_unlock(&fh->cap.vb_lock); | ||
3308 | 3216 | ||
3309 | fh->type = type; | 3217 | fh->type = type; |
3310 | fh->ov.setup_ok = 0; | 3218 | fh->ov.setup_ok = 0; |
3311 | 3219 | ||
3312 | mutex_lock(&btv->lock); | ||
3313 | v4l2_prio_open(&btv->prio, &fh->prio); | 3220 | v4l2_prio_open(&btv->prio, &fh->prio); |
3314 | 3221 | ||
3315 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, | 3222 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, |
@@ -3317,13 +3224,13 @@ static int bttv_open(struct file *file) | |||
3317 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 3224 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
3318 | V4L2_FIELD_INTERLACED, | 3225 | V4L2_FIELD_INTERLACED, |
3319 | sizeof(struct bttv_buffer), | 3226 | sizeof(struct bttv_buffer), |
3320 | fh, NULL); | 3227 | fh, &btv->lock); |
3321 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, | 3228 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, |
3322 | &btv->c.pci->dev, &btv->s_lock, | 3229 | &btv->c.pci->dev, &btv->s_lock, |
3323 | V4L2_BUF_TYPE_VBI_CAPTURE, | 3230 | V4L2_BUF_TYPE_VBI_CAPTURE, |
3324 | V4L2_FIELD_SEQ_TB, | 3231 | V4L2_FIELD_SEQ_TB, |
3325 | sizeof(struct bttv_buffer), | 3232 | sizeof(struct bttv_buffer), |
3326 | fh, NULL); | 3233 | fh, &btv->lock); |
3327 | set_tvnorm(btv,btv->tvnorm); | 3234 | set_tvnorm(btv,btv->tvnorm); |
3328 | set_input(btv, btv->input, btv->tvnorm); | 3235 | set_input(btv, btv->input, btv->tvnorm); |
3329 | 3236 | ||
@@ -3346,7 +3253,6 @@ static int bttv_open(struct file *file) | |||
3346 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); | 3253 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); |
3347 | 3254 | ||
3348 | bttv_field_count(btv); | 3255 | bttv_field_count(btv); |
3349 | mutex_unlock(&btv->lock); | ||
3350 | return 0; | 3256 | return 0; |
3351 | } | 3257 | } |
3352 | 3258 | ||
@@ -3355,7 +3261,6 @@ static int bttv_release(struct file *file) | |||
3355 | struct bttv_fh *fh = file->private_data; | 3261 | struct bttv_fh *fh = file->private_data; |
3356 | struct bttv *btv = fh->btv; | 3262 | struct bttv *btv = fh->btv; |
3357 | 3263 | ||
3358 | mutex_lock(&btv->lock); | ||
3359 | /* turn off overlay */ | 3264 | /* turn off overlay */ |
3360 | if (check_btres(fh, RESOURCE_OVERLAY)) | 3265 | if (check_btres(fh, RESOURCE_OVERLAY)) |
3361 | bttv_switch_overlay(btv,fh,NULL); | 3266 | bttv_switch_overlay(btv,fh,NULL); |
@@ -3381,14 +3286,8 @@ static int bttv_release(struct file *file) | |||
3381 | 3286 | ||
3382 | /* free stuff */ | 3287 | /* free stuff */ |
3383 | 3288 | ||
3384 | /* | ||
3385 | * videobuf uses cap.vb_lock - we should avoid holding btv->lock, | ||
3386 | * otherwise we may have dead lock conditions | ||
3387 | */ | ||
3388 | mutex_unlock(&btv->lock); | ||
3389 | videobuf_mmap_free(&fh->cap); | 3289 | videobuf_mmap_free(&fh->cap); |
3390 | videobuf_mmap_free(&fh->vbi); | 3290 | videobuf_mmap_free(&fh->vbi); |
3391 | mutex_lock(&btv->lock); | ||
3392 | v4l2_prio_close(&btv->prio, fh->prio); | 3291 | v4l2_prio_close(&btv->prio, fh->prio); |
3393 | file->private_data = NULL; | 3292 | file->private_data = NULL; |
3394 | kfree(fh); | 3293 | kfree(fh); |
@@ -3398,7 +3297,6 @@ static int bttv_release(struct file *file) | |||
3398 | 3297 | ||
3399 | if (!btv->users) | 3298 | if (!btv->users) |
3400 | audio_mute(btv, 1); | 3299 | audio_mute(btv, 1); |
3401 | mutex_unlock(&btv->lock); | ||
3402 | 3300 | ||
3403 | return 0; | 3301 | return 0; |
3404 | } | 3302 | } |
@@ -3502,11 +3400,8 @@ static int radio_open(struct file *file) | |||
3502 | if (unlikely(!fh)) | 3400 | if (unlikely(!fh)) |
3503 | return -ENOMEM; | 3401 | return -ENOMEM; |
3504 | file->private_data = fh; | 3402 | file->private_data = fh; |
3505 | mutex_lock(&fh->cap.vb_lock); | ||
3506 | *fh = btv->init; | 3403 | *fh = btv->init; |
3507 | mutex_unlock(&fh->cap.vb_lock); | ||
3508 | 3404 | ||
3509 | mutex_lock(&btv->lock); | ||
3510 | v4l2_prio_open(&btv->prio, &fh->prio); | 3405 | v4l2_prio_open(&btv->prio, &fh->prio); |
3511 | 3406 | ||
3512 | btv->radio_user++; | 3407 | btv->radio_user++; |
@@ -3514,7 +3409,6 @@ static int radio_open(struct file *file) | |||
3514 | bttv_call_all(btv, tuner, s_radio); | 3409 | bttv_call_all(btv, tuner, s_radio); |
3515 | audio_input(btv,TVAUDIO_INPUT_RADIO); | 3410 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3516 | 3411 | ||
3517 | mutex_unlock(&btv->lock); | ||
3518 | return 0; | 3412 | return 0; |
3519 | } | 3413 | } |
3520 | 3414 | ||
@@ -3524,7 +3418,6 @@ static int radio_release(struct file *file) | |||
3524 | struct bttv *btv = fh->btv; | 3418 | struct bttv *btv = fh->btv; |
3525 | struct rds_command cmd; | 3419 | struct rds_command cmd; |
3526 | 3420 | ||
3527 | mutex_lock(&btv->lock); | ||
3528 | v4l2_prio_close(&btv->prio, fh->prio); | 3421 | v4l2_prio_close(&btv->prio, fh->prio); |
3529 | file->private_data = NULL; | 3422 | file->private_data = NULL; |
3530 | kfree(fh); | 3423 | kfree(fh); |
@@ -3532,7 +3425,6 @@ static int radio_release(struct file *file) | |||
3532 | btv->radio_user--; | 3425 | btv->radio_user--; |
3533 | 3426 | ||
3534 | bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); | 3427 | bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); |
3535 | mutex_unlock(&btv->lock); | ||
3536 | 3428 | ||
3537 | return 0; | 3429 | return 0; |
3538 | } | 3430 | } |
@@ -3561,7 +3453,6 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
3561 | return -EINVAL; | 3453 | return -EINVAL; |
3562 | if (0 != t->index) | 3454 | if (0 != t->index) |
3563 | return -EINVAL; | 3455 | return -EINVAL; |
3564 | mutex_lock(&btv->lock); | ||
3565 | strcpy(t->name, "Radio"); | 3456 | strcpy(t->name, "Radio"); |
3566 | t->type = V4L2_TUNER_RADIO; | 3457 | t->type = V4L2_TUNER_RADIO; |
3567 | 3458 | ||
@@ -3570,8 +3461,6 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
3570 | if (btv->audio_mode_gpio) | 3461 | if (btv->audio_mode_gpio) |
3571 | btv->audio_mode_gpio(btv, t, 0); | 3462 | btv->audio_mode_gpio(btv, t, 0); |
3572 | 3463 | ||
3573 | mutex_unlock(&btv->lock); | ||
3574 | |||
3575 | return 0; | 3464 | return 0; |
3576 | } | 3465 | } |
3577 | 3466 | ||
@@ -3692,7 +3581,7 @@ static const struct v4l2_file_operations radio_fops = | |||
3692 | .open = radio_open, | 3581 | .open = radio_open, |
3693 | .read = radio_read, | 3582 | .read = radio_read, |
3694 | .release = radio_release, | 3583 | .release = radio_release, |
3695 | .ioctl = video_ioctl2, | 3584 | .unlocked_ioctl = video_ioctl2, |
3696 | .poll = radio_poll, | 3585 | .poll = radio_poll, |
3697 | }; | 3586 | }; |
3698 | 3587 | ||
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 935e0c9a9674..c1193506131c 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -860,7 +860,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
860 | 860 | ||
861 | static const struct v4l2_file_operations qcam_fops = { | 861 | static const struct v4l2_file_operations qcam_fops = { |
862 | .owner = THIS_MODULE, | 862 | .owner = THIS_MODULE, |
863 | .ioctl = video_ioctl2, | 863 | .unlocked_ioctl = video_ioctl2, |
864 | .read = qcam_read, | 864 | .read = qcam_read, |
865 | }; | 865 | }; |
866 | 866 | ||
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 6e4b19698c13..24fc00965a12 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c | |||
@@ -718,7 +718,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
718 | 718 | ||
719 | static const struct v4l2_file_operations qcam_fops = { | 719 | static const struct v4l2_file_operations qcam_fops = { |
720 | .owner = THIS_MODULE, | 720 | .owner = THIS_MODULE, |
721 | .ioctl = video_ioctl2, | 721 | .unlocked_ioctl = video_ioctl2, |
722 | .read = qcam_read, | 722 | .read = qcam_read, |
723 | }; | 723 | }; |
724 | 724 | ||
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 7bc36670071a..0dfff50891e4 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -1775,7 +1775,7 @@ static const struct v4l2_file_operations cafe_v4l_fops = { | |||
1775 | .read = cafe_v4l_read, | 1775 | .read = cafe_v4l_read, |
1776 | .poll = cafe_v4l_poll, | 1776 | .poll = cafe_v4l_poll, |
1777 | .mmap = cafe_v4l_mmap, | 1777 | .mmap = cafe_v4l_mmap, |
1778 | .ioctl = video_ioctl2, | 1778 | .unlocked_ioctl = video_ioctl2, |
1779 | }; | 1779 | }; |
1780 | 1780 | ||
1781 | static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { | 1781 | static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { |
@@ -2066,8 +2066,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2066 | 2066 | ||
2067 | cam->sensor_addr = 0x42; | 2067 | cam->sensor_addr = 0x42; |
2068 | cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, | 2068 | cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, |
2069 | "ov7670", "ov7670", 0, &sensor_cfg, cam->sensor_addr, | 2069 | "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL); |
2070 | NULL); | ||
2071 | if (cam->sensor == NULL) { | 2070 | if (cam->sensor == NULL) { |
2072 | ret = -ENODEV; | 2071 | ret = -ENODEV; |
2073 | goto out_smbus; | 2072 | goto out_smbus; |
diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c index 8f55692db36d..82d195be9197 100644 --- a/drivers/media/video/cx18/cx18-alsa-pcm.c +++ b/drivers/media/video/cx18/cx18-alsa-pcm.c | |||
@@ -218,7 +218,13 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) | |||
218 | static int snd_cx18_pcm_ioctl(struct snd_pcm_substream *substream, | 218 | static int snd_cx18_pcm_ioctl(struct snd_pcm_substream *substream, |
219 | unsigned int cmd, void *arg) | 219 | unsigned int cmd, void *arg) |
220 | { | 220 | { |
221 | return snd_pcm_lib_ioctl(substream, cmd, arg); | 221 | struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream); |
222 | int ret; | ||
223 | |||
224 | snd_cx18_lock(cxsc); | ||
225 | ret = snd_pcm_lib_ioctl(substream, cmd, arg); | ||
226 | snd_cx18_unlock(cxsc); | ||
227 | return ret; | ||
222 | } | 228 | } |
223 | 229 | ||
224 | 230 | ||
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index a09caf883170..e71a026f3419 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -122,15 +122,15 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
122 | if (hw == CX18_HW_TUNER) { | 122 | if (hw == CX18_HW_TUNER) { |
123 | /* special tuner group handling */ | 123 | /* special tuner group handling */ |
124 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, | 124 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
125 | adap, NULL, type, 0, cx->card_i2c->radio); | 125 | adap, type, 0, cx->card_i2c->radio); |
126 | if (sd != NULL) | 126 | if (sd != NULL) |
127 | sd->grp_id = hw; | 127 | sd->grp_id = hw; |
128 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, | 128 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
129 | adap, NULL, type, 0, cx->card_i2c->demod); | 129 | adap, type, 0, cx->card_i2c->demod); |
130 | if (sd != NULL) | 130 | if (sd != NULL) |
131 | sd->grp_id = hw; | 131 | sd->grp_id = hw; |
132 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, | 132 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
133 | adap, NULL, type, 0, cx->card_i2c->tv); | 133 | adap, type, 0, cx->card_i2c->tv); |
134 | if (sd != NULL) | 134 | if (sd != NULL) |
135 | sd->grp_id = hw; | 135 | sd->grp_id = hw; |
136 | return sd != NULL ? 0 : -1; | 136 | return sd != NULL ? 0 : -1; |
@@ -144,7 +144,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
144 | return -1; | 144 | return -1; |
145 | 145 | ||
146 | /* It's an I2C device other than an analog tuner or IR chip */ | 146 | /* It's an I2C device other than an analog tuner or IR chip */ |
147 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, NULL, type, hw_addrs[idx], | 147 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, type, hw_addrs[idx], |
148 | NULL); | 148 | NULL); |
149 | if (sd != NULL) | 149 | if (sd != NULL) |
150 | sd->grp_id = hw; | 150 | sd->grp_id = hw; |
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 9045f1ece0eb..ab461e27d9dd 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -41,7 +41,7 @@ static struct v4l2_file_operations cx18_v4l2_enc_fops = { | |||
41 | .read = cx18_v4l2_read, | 41 | .read = cx18_v4l2_read, |
42 | .open = cx18_v4l2_open, | 42 | .open = cx18_v4l2_open, |
43 | /* FIXME change to video_ioctl2 if serialization lock can be removed */ | 43 | /* FIXME change to video_ioctl2 if serialization lock can be removed */ |
44 | .ioctl = cx18_v4l2_ioctl, | 44 | .unlocked_ioctl = cx18_v4l2_ioctl, |
45 | .release = cx18_v4l2_close, | 45 | .release = cx18_v4l2_close, |
46 | .poll = cx18_v4l2_enc_poll, | 46 | .poll = cx18_v4l2_enc_poll, |
47 | }; | 47 | }; |
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 56c2d8195ac6..2c78d188bb06 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -560,7 +560,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
560 | if (dev->board.decoder == CX231XX_AVDECODER) { | 560 | if (dev->board.decoder == CX231XX_AVDECODER) { |
561 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 561 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
562 | &dev->i2c_bus[0].i2c_adap, | 562 | &dev->i2c_bus[0].i2c_adap, |
563 | NULL, "cx25840", 0x88 >> 1, NULL); | 563 | "cx25840", 0x88 >> 1, NULL); |
564 | if (dev->sd_cx25840 == NULL) | 564 | if (dev->sd_cx25840 == NULL) |
565 | cx231xx_info("cx25840 subdev registration failure\n"); | 565 | cx231xx_info("cx25840 subdev registration failure\n"); |
566 | cx25840_call(dev, core, load_fw); | 566 | cx25840_call(dev, core, load_fw); |
@@ -571,7 +571,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
571 | if (dev->board.tuner_type != TUNER_ABSENT) { | 571 | if (dev->board.tuner_type != TUNER_ABSENT) { |
572 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 572 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
573 | &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap, | 573 | &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap, |
574 | NULL, "tuner", | 574 | "tuner", |
575 | dev->tuner_addr, NULL); | 575 | dev->tuner_addr, NULL); |
576 | if (dev->sd_tuner == NULL) | 576 | if (dev->sd_tuner == NULL) |
577 | cx231xx_info("tuner subdev registration failure\n"); | 577 | cx231xx_info("tuner subdev registration failure\n"); |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index db054004e462..8861309268b1 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -1247,7 +1247,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1247 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: | 1247 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: |
1248 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1248 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1249 | &dev->i2c_bus[2].i2c_adap, | 1249 | &dev->i2c_bus[2].i2c_adap, |
1250 | NULL, "cx25840", 0x88 >> 1, NULL); | 1250 | "cx25840", 0x88 >> 1, NULL); |
1251 | if (dev->sd_cx25840) { | 1251 | if (dev->sd_cx25840) { |
1252 | dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE; | 1252 | dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE; |
1253 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); | 1253 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 3cc9f462d08d..8b2fb8a4375c 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -1507,10 +1507,10 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1507 | if (dev->tuner_addr) | 1507 | if (dev->tuner_addr) |
1508 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1508 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1509 | &dev->i2c_bus[1].i2c_adap, | 1509 | &dev->i2c_bus[1].i2c_adap, |
1510 | NULL, "tuner", dev->tuner_addr, NULL); | 1510 | "tuner", dev->tuner_addr, NULL); |
1511 | else | 1511 | else |
1512 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1512 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1513 | &dev->i2c_bus[1].i2c_adap, NULL, | 1513 | &dev->i2c_bus[1].i2c_adap, |
1514 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_TV)); | 1514 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_TV)); |
1515 | if (sd) { | 1515 | if (sd) { |
1516 | struct tuner_setup tun_setup; | 1516 | struct tuner_setup tun_setup; |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index b26fcba8600c..9b9e169cce90 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -3515,19 +3515,18 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
3515 | later code configures a tea5767. | 3515 | later code configures a tea5767. |
3516 | */ | 3516 | */ |
3517 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 3517 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3518 | NULL, "tuner", | 3518 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3519 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | ||
3520 | if (has_demod) | 3519 | if (has_demod) |
3521 | v4l2_i2c_new_subdev(&core->v4l2_dev, | 3520 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
3522 | &core->i2c_adap, NULL, "tuner", | 3521 | &core->i2c_adap, "tuner", |
3523 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3522 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3524 | if (core->board.tuner_addr == ADDR_UNSET) { | 3523 | if (core->board.tuner_addr == ADDR_UNSET) { |
3525 | v4l2_i2c_new_subdev(&core->v4l2_dev, | 3524 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
3526 | &core->i2c_adap, NULL, "tuner", | 3525 | &core->i2c_adap, "tuner", |
3527 | 0, has_demod ? tv_addrs + 4 : tv_addrs); | 3526 | 0, has_demod ? tv_addrs + 4 : tv_addrs); |
3528 | } else { | 3527 | } else { |
3529 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 3528 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3530 | NULL, "tuner", core->board.tuner_addr, NULL); | 3529 | "tuner", core->board.tuner_addr, NULL); |
3531 | } | 3530 | } |
3532 | } | 3531 | } |
3533 | 3532 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 88b51194f917..62cea9549404 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1895,14 +1895,13 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1895 | 1895 | ||
1896 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 1896 | if (core->board.audio_chip == V4L2_IDENT_WM8775) |
1897 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 1897 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
1898 | NULL, "wm8775", 0x36 >> 1, NULL); | 1898 | "wm8775", 0x36 >> 1, NULL); |
1899 | 1899 | ||
1900 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { | 1900 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { |
1901 | /* This probes for a tda9874 as is used on some | 1901 | /* This probes for a tda9874 as is used on some |
1902 | Pixelview Ultra boards. */ | 1902 | Pixelview Ultra boards. */ |
1903 | v4l2_i2c_new_subdev(&core->v4l2_dev, | 1903 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
1904 | &core->i2c_adap, | 1904 | "tvaudio", 0, I2C_ADDRS(0xb0 >> 1)); |
1905 | NULL, "tvaudio", 0, I2C_ADDRS(0xb0 >> 1)); | ||
1906 | } | 1905 | } |
1907 | 1906 | ||
1908 | switch (core->boardnr) { | 1907 | switch (core->boardnr) { |
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index d8e38cc4ec40..7333a9bb2549 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c | |||
@@ -1986,7 +1986,6 @@ static __init int vpfe_probe(struct platform_device *pdev) | |||
1986 | vpfe_dev->sd[i] = | 1986 | vpfe_dev->sd[i] = |
1987 | v4l2_i2c_new_subdev_board(&vpfe_dev->v4l2_dev, | 1987 | v4l2_i2c_new_subdev_board(&vpfe_dev->v4l2_dev, |
1988 | i2c_adap, | 1988 | i2c_adap, |
1989 | NULL, | ||
1990 | &sdinfo->board_info, | 1989 | &sdinfo->board_info, |
1991 | NULL); | 1990 | NULL); |
1992 | if (vpfe_dev->sd[i]) { | 1991 | if (vpfe_dev->sd[i]) { |
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 6ac6acd16352..193abab6b355 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -2013,7 +2013,6 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
2013 | vpif_obj.sd[i] = | 2013 | vpif_obj.sd[i] = |
2014 | v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, | 2014 | v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, |
2015 | i2c_adap, | 2015 | i2c_adap, |
2016 | NULL, | ||
2017 | &subdevdata->board_info, | 2016 | &subdevdata->board_info, |
2018 | NULL); | 2017 | NULL); |
2019 | 2018 | ||
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 685f6a6ee603..412c65d54fe1 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -1553,7 +1553,7 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1553 | 1553 | ||
1554 | for (i = 0; i < subdev_count; i++) { | 1554 | for (i = 0; i < subdev_count; i++) { |
1555 | vpif_obj.sd[i] = v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, | 1555 | vpif_obj.sd[i] = v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, |
1556 | i2c_adap, NULL, | 1556 | i2c_adap, |
1557 | &subdevdata[i].board_info, | 1557 | &subdevdata[i].board_info, |
1558 | NULL); | 1558 | NULL); |
1559 | if (!vpif_obj.sd[i]) { | 1559 | if (!vpif_obj.sd[i]) { |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 54859233f311..f7e9168157a5 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -2554,39 +2554,39 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2554 | /* request some modules */ | 2554 | /* request some modules */ |
2555 | if (dev->board.has_msp34xx) | 2555 | if (dev->board.has_msp34xx) |
2556 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2556 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2557 | NULL, "msp3400", 0, msp3400_addrs); | 2557 | "msp3400", 0, msp3400_addrs); |
2558 | 2558 | ||
2559 | if (dev->board.decoder == EM28XX_SAA711X) | 2559 | if (dev->board.decoder == EM28XX_SAA711X) |
2560 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2560 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2561 | NULL, "saa7115_auto", 0, saa711x_addrs); | 2561 | "saa7115_auto", 0, saa711x_addrs); |
2562 | 2562 | ||
2563 | if (dev->board.decoder == EM28XX_TVP5150) | 2563 | if (dev->board.decoder == EM28XX_TVP5150) |
2564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2565 | NULL, "tvp5150", 0, tvp5150_addrs); | 2565 | "tvp5150", 0, tvp5150_addrs); |
2566 | 2566 | ||
2567 | if (dev->em28xx_sensor == EM28XX_MT9V011) { | 2567 | if (dev->em28xx_sensor == EM28XX_MT9V011) { |
2568 | struct v4l2_subdev *sd; | 2568 | struct v4l2_subdev *sd; |
2569 | 2569 | ||
2570 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2570 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2571 | &dev->i2c_adap, NULL, "mt9v011", 0, mt9v011_addrs); | 2571 | &dev->i2c_adap, "mt9v011", 0, mt9v011_addrs); |
2572 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); | 2572 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); |
2573 | } | 2573 | } |
2574 | 2574 | ||
2575 | 2575 | ||
2576 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 2576 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
2577 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2577 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2578 | NULL, "tvaudio", dev->board.tvaudio_addr, NULL); | 2578 | "tvaudio", dev->board.tvaudio_addr, NULL); |
2579 | 2579 | ||
2580 | if (dev->board.tuner_type != TUNER_ABSENT) { | 2580 | if (dev->board.tuner_type != TUNER_ABSENT) { |
2581 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); | 2581 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); |
2582 | 2582 | ||
2583 | if (dev->board.radio.type) | 2583 | if (dev->board.radio.type) |
2584 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2584 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2585 | NULL, "tuner", dev->board.radio_addr, NULL); | 2585 | "tuner", dev->board.radio_addr, NULL); |
2586 | 2586 | ||
2587 | if (has_demod) | 2587 | if (has_demod) |
2588 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2588 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2589 | &dev->i2c_adap, NULL, "tuner", | 2589 | &dev->i2c_adap, "tuner", |
2590 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 2590 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
2591 | if (dev->tuner_addr == 0) { | 2591 | if (dev->tuner_addr == 0) { |
2592 | enum v4l2_i2c_tuner_type type = | 2592 | enum v4l2_i2c_tuner_type type = |
@@ -2594,14 +2594,14 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2594 | struct v4l2_subdev *sd; | 2594 | struct v4l2_subdev *sd; |
2595 | 2595 | ||
2596 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2596 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2597 | &dev->i2c_adap, NULL, "tuner", | 2597 | &dev->i2c_adap, "tuner", |
2598 | 0, v4l2_i2c_tuner_addrs(type)); | 2598 | 0, v4l2_i2c_tuner_addrs(type)); |
2599 | 2599 | ||
2600 | if (sd) | 2600 | if (sd) |
2601 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); | 2601 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); |
2602 | } else { | 2602 | } else { |
2603 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2603 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2604 | NULL, "tuner", dev->tuner_addr, NULL); | 2604 | "tuner", dev->tuner_addr, NULL); |
2605 | } | 2605 | } |
2606 | } | 2606 | } |
2607 | 2607 | ||
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index a5cfc76b40b7..bb164099ea2c 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -2530,7 +2530,7 @@ static const struct v4l2_file_operations et61x251_fops = { | |||
2530 | .owner = THIS_MODULE, | 2530 | .owner = THIS_MODULE, |
2531 | .open = et61x251_open, | 2531 | .open = et61x251_open, |
2532 | .release = et61x251_release, | 2532 | .release = et61x251_release, |
2533 | .ioctl = et61x251_ioctl, | 2533 | .unlocked_ioctl = et61x251_ioctl, |
2534 | .read = et61x251_read, | 2534 | .read = et61x251_read, |
2535 | .poll = et61x251_poll, | 2535 | .poll = et61x251_poll, |
2536 | .mmap = et61x251_mmap, | 2536 | .mmap = et61x251_mmap, |
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 9a075d83dd1f..b8faff2dd711 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c | |||
@@ -1486,7 +1486,7 @@ static int __devinit viu_of_probe(struct platform_device *op, | |||
1486 | 1486 | ||
1487 | ad = i2c_get_adapter(0); | 1487 | ad = i2c_get_adapter(0); |
1488 | viu_dev->decoder = v4l2_i2c_new_subdev(&viu_dev->v4l2_dev, ad, | 1488 | viu_dev->decoder = v4l2_i2c_new_subdev(&viu_dev->v4l2_dev, ad, |
1489 | NULL, "saa7113", VIU_VIDEO_DECODER_ADDR, NULL); | 1489 | "saa7113", VIU_VIDEO_DECODER_ADDR, NULL); |
1490 | 1490 | ||
1491 | viu_dev->vidq.timeout.function = viu_vid_timeout; | 1491 | viu_dev->vidq.timeout.function = viu_vid_timeout; |
1492 | viu_dev->vidq.timeout.data = (unsigned long)viu_dev; | 1492 | viu_dev->vidq.timeout.data = (unsigned long)viu_dev; |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 330dadc00106..e23de57e2c73 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -63,7 +63,10 @@ struct sd { | |||
63 | #define QUALITY_DEF 80 | 63 | #define QUALITY_DEF 80 |
64 | u8 jpegqual; /* webcam quality */ | 64 | u8 jpegqual; /* webcam quality */ |
65 | 65 | ||
66 | u8 reg01; | ||
67 | u8 reg17; | ||
66 | u8 reg18; | 68 | u8 reg18; |
69 | u8 flags; | ||
67 | 70 | ||
68 | s8 ag_cnt; | 71 | s8 ag_cnt; |
69 | #define AG_CNT_START 13 | 72 | #define AG_CNT_START 13 |
@@ -96,6 +99,22 @@ enum sensors { | |||
96 | SENSOR_SP80708, | 99 | SENSOR_SP80708, |
97 | }; | 100 | }; |
98 | 101 | ||
102 | /* device flags */ | ||
103 | #define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ | ||
104 | |||
105 | /* sn9c1xx definitions */ | ||
106 | /* register 0x01 */ | ||
107 | #define S_PWR_DN 0x01 /* sensor power down */ | ||
108 | #define S_PDN_INV 0x02 /* inverse pin S_PWR_DN */ | ||
109 | #define V_TX_EN 0x04 /* video transfer enable */ | ||
110 | #define LED 0x08 /* output to pin LED */ | ||
111 | #define SCL_SEL_OD 0x20 /* open-drain mode */ | ||
112 | #define SYS_SEL_48M 0x40 /* system clock 0: 24MHz, 1: 48MHz */ | ||
113 | /* register 0x17 */ | ||
114 | #define MCK_SIZE_MASK 0x1f /* sensor master clock */ | ||
115 | #define SEN_CLK_EN 0x20 /* enable sensor clock */ | ||
116 | #define DEF_EN 0x80 /* defect pixel by 0: soft, 1: hard */ | ||
117 | |||
99 | /* V4L2 controls supported by the driver */ | 118 | /* V4L2 controls supported by the driver */ |
100 | static void setbrightness(struct gspca_dev *gspca_dev); | 119 | static void setbrightness(struct gspca_dev *gspca_dev); |
101 | static void setcontrast(struct gspca_dev *gspca_dev); | 120 | static void setcontrast(struct gspca_dev *gspca_dev); |
@@ -1755,141 +1774,6 @@ static void po2030n_probe(struct gspca_dev *gspca_dev) | |||
1755 | } | 1774 | } |
1756 | } | 1775 | } |
1757 | 1776 | ||
1758 | static void bridge_init(struct gspca_dev *gspca_dev, | ||
1759 | const u8 *sn9c1xx) | ||
1760 | { | ||
1761 | struct sd *sd = (struct sd *) gspca_dev; | ||
1762 | u8 reg0102[2]; | ||
1763 | const u8 *reg9a; | ||
1764 | static const u8 reg9a_def[] = | ||
1765 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | ||
1766 | static const u8 reg9a_spec[] = | ||
1767 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | ||
1768 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | ||
1769 | |||
1770 | /* sensor clock already enabled in sd_init */ | ||
1771 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | ||
1772 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | ||
1773 | |||
1774 | /* configure gpio */ | ||
1775 | reg0102[0] = sn9c1xx[1]; | ||
1776 | reg0102[1] = sn9c1xx[2]; | ||
1777 | if (gspca_dev->audio) | ||
1778 | reg0102[1] |= 0x04; /* keep the audio connection */ | ||
1779 | reg_w(gspca_dev, 0x01, reg0102, 2); | ||
1780 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | ||
1781 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | ||
1782 | switch (sd->sensor) { | ||
1783 | case SENSOR_GC0307: | ||
1784 | case SENSOR_OV7660: | ||
1785 | case SENSOR_PO1030: | ||
1786 | case SENSOR_PO2030N: | ||
1787 | case SENSOR_SOI768: | ||
1788 | case SENSOR_SP80708: | ||
1789 | reg9a = reg9a_spec; | ||
1790 | break; | ||
1791 | default: | ||
1792 | reg9a = reg9a_def; | ||
1793 | break; | ||
1794 | } | ||
1795 | reg_w(gspca_dev, 0x9a, reg9a, 6); | ||
1796 | |||
1797 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | ||
1798 | |||
1799 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | ||
1800 | |||
1801 | switch (sd->sensor) { | ||
1802 | case SENSOR_ADCM1700: | ||
1803 | reg_w1(gspca_dev, 0x01, 0x43); | ||
1804 | reg_w1(gspca_dev, 0x17, 0x62); | ||
1805 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1806 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1807 | break; | ||
1808 | case SENSOR_GC0307: | ||
1809 | msleep(50); | ||
1810 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1811 | reg_w1(gspca_dev, 0x17, 0x22); | ||
1812 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1813 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1814 | msleep(50); | ||
1815 | break; | ||
1816 | case SENSOR_MI0360B: | ||
1817 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1818 | reg_w1(gspca_dev, 0x17, 0x60); | ||
1819 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1820 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1821 | break; | ||
1822 | case SENSOR_MT9V111: | ||
1823 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1824 | reg_w1(gspca_dev, 0x17, 0x61); | ||
1825 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1826 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1827 | break; | ||
1828 | case SENSOR_OM6802: | ||
1829 | msleep(10); | ||
1830 | reg_w1(gspca_dev, 0x02, 0x73); | ||
1831 | reg_w1(gspca_dev, 0x17, 0x60); | ||
1832 | reg_w1(gspca_dev, 0x01, 0x22); | ||
1833 | msleep(100); | ||
1834 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1835 | reg_w1(gspca_dev, 0x17, 0x64); | ||
1836 | reg_w1(gspca_dev, 0x17, 0x64); | ||
1837 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1838 | msleep(10); | ||
1839 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1840 | i2c_w8(gspca_dev, om6802_init0[0]); | ||
1841 | i2c_w8(gspca_dev, om6802_init0[1]); | ||
1842 | msleep(15); | ||
1843 | reg_w1(gspca_dev, 0x02, 0x71); | ||
1844 | msleep(150); | ||
1845 | break; | ||
1846 | case SENSOR_OV7630: | ||
1847 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1848 | reg_w1(gspca_dev, 0x17, 0xe2); | ||
1849 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1850 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1851 | break; | ||
1852 | case SENSOR_OV7648: | ||
1853 | reg_w1(gspca_dev, 0x01, 0x63); | ||
1854 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1855 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1856 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1857 | break; | ||
1858 | case SENSOR_PO1030: | ||
1859 | case SENSOR_SOI768: | ||
1860 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1861 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1862 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1863 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1864 | break; | ||
1865 | case SENSOR_PO2030N: | ||
1866 | case SENSOR_OV7660: | ||
1867 | reg_w1(gspca_dev, 0x01, 0x63); | ||
1868 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1869 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1870 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1871 | break; | ||
1872 | case SENSOR_SP80708: | ||
1873 | reg_w1(gspca_dev, 0x01, 0x63); | ||
1874 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1875 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1876 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1877 | msleep(100); | ||
1878 | reg_w1(gspca_dev, 0x02, 0x62); | ||
1879 | break; | ||
1880 | default: | ||
1881 | /* case SENSOR_HV7131R: */ | ||
1882 | /* case SENSOR_MI0360: */ | ||
1883 | /* case SENSOR_MO4000: */ | ||
1884 | reg_w1(gspca_dev, 0x01, 0x43); | ||
1885 | reg_w1(gspca_dev, 0x17, 0x61); | ||
1886 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1887 | if (sd->sensor == SENSOR_HV7131R) | ||
1888 | hv7131r_probe(gspca_dev); | ||
1889 | break; | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | /* this function is called at probe time */ | 1777 | /* this function is called at probe time */ |
1894 | static int sd_config(struct gspca_dev *gspca_dev, | 1778 | static int sd_config(struct gspca_dev *gspca_dev, |
1895 | const struct usb_device_id *id) | 1779 | const struct usb_device_id *id) |
@@ -1898,7 +1782,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1898 | struct cam *cam; | 1782 | struct cam *cam; |
1899 | 1783 | ||
1900 | sd->bridge = id->driver_info >> 16; | 1784 | sd->bridge = id->driver_info >> 16; |
1901 | sd->sensor = id->driver_info; | 1785 | sd->sensor = id->driver_info >> 8; |
1786 | sd->flags = id->driver_info; | ||
1902 | 1787 | ||
1903 | cam = &gspca_dev->cam; | 1788 | cam = &gspca_dev->cam; |
1904 | if (sd->sensor == SENSOR_ADCM1700) { | 1789 | if (sd->sensor == SENSOR_ADCM1700) { |
@@ -1929,7 +1814,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
1929 | /* setup a selector by bridge */ | 1814 | /* setup a selector by bridge */ |
1930 | reg_w1(gspca_dev, 0xf1, 0x01); | 1815 | reg_w1(gspca_dev, 0xf1, 0x01); |
1931 | reg_r(gspca_dev, 0x00, 1); | 1816 | reg_r(gspca_dev, 0x00, 1); |
1932 | reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]); | 1817 | reg_w1(gspca_dev, 0xf1, 0x00); |
1933 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ | 1818 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ |
1934 | regF1 = gspca_dev->usb_buf[0]; | 1819 | regF1 = gspca_dev->usb_buf[0]; |
1935 | if (gspca_dev->usb_err < 0) | 1820 | if (gspca_dev->usb_err < 0) |
@@ -2423,10 +2308,17 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2423 | { | 2308 | { |
2424 | struct sd *sd = (struct sd *) gspca_dev; | 2309 | struct sd *sd = (struct sd *) gspca_dev; |
2425 | int i; | 2310 | int i; |
2426 | u8 reg1, reg17; | 2311 | u8 reg01, reg17; |
2312 | u8 reg0102[2]; | ||
2427 | const u8 *sn9c1xx; | 2313 | const u8 *sn9c1xx; |
2428 | const u8 (*init)[8]; | 2314 | const u8 (*init)[8]; |
2315 | const u8 *reg9a; | ||
2429 | int mode; | 2316 | int mode; |
2317 | static const u8 reg9a_def[] = | ||
2318 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | ||
2319 | static const u8 reg9a_spec[] = | ||
2320 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | ||
2321 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | ||
2430 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; | 2322 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
2431 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | 2323 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
2432 | static const u8 CA_adcm1700[] = | 2324 | static const u8 CA_adcm1700[] = |
@@ -2448,7 +2340,85 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2448 | 2340 | ||
2449 | /* initialize the bridge */ | 2341 | /* initialize the bridge */ |
2450 | sn9c1xx = sn_tb[sd->sensor]; | 2342 | sn9c1xx = sn_tb[sd->sensor]; |
2451 | bridge_init(gspca_dev, sn9c1xx); | 2343 | |
2344 | /* sensor clock already enabled in sd_init */ | ||
2345 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | ||
2346 | reg01 = sn9c1xx[1]; | ||
2347 | if (sd->flags & PDN_INV) | ||
2348 | reg01 ^= S_PDN_INV; /* power down inverted */ | ||
2349 | reg_w1(gspca_dev, 0x01, reg01); | ||
2350 | |||
2351 | /* configure gpio */ | ||
2352 | reg0102[0] = reg01; | ||
2353 | reg0102[1] = sn9c1xx[2]; | ||
2354 | if (gspca_dev->audio) | ||
2355 | reg0102[1] |= 0x04; /* keep the audio connection */ | ||
2356 | reg_w(gspca_dev, 0x01, reg0102, 2); | ||
2357 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | ||
2358 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | ||
2359 | switch (sd->sensor) { | ||
2360 | case SENSOR_GC0307: | ||
2361 | case SENSOR_OV7660: | ||
2362 | case SENSOR_PO1030: | ||
2363 | case SENSOR_PO2030N: | ||
2364 | case SENSOR_SOI768: | ||
2365 | case SENSOR_SP80708: | ||
2366 | reg9a = reg9a_spec; | ||
2367 | break; | ||
2368 | default: | ||
2369 | reg9a = reg9a_def; | ||
2370 | break; | ||
2371 | } | ||
2372 | reg_w(gspca_dev, 0x9a, reg9a, 6); | ||
2373 | |||
2374 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | ||
2375 | |||
2376 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | ||
2377 | |||
2378 | reg17 = sn9c1xx[0x17]; | ||
2379 | switch (sd->sensor) { | ||
2380 | case SENSOR_GC0307: | ||
2381 | msleep(50); /*fixme: is it useful? */ | ||
2382 | break; | ||
2383 | case SENSOR_OM6802: | ||
2384 | msleep(10); | ||
2385 | reg_w1(gspca_dev, 0x02, 0x73); | ||
2386 | reg17 |= SEN_CLK_EN; | ||
2387 | reg_w1(gspca_dev, 0x17, reg17); | ||
2388 | reg_w1(gspca_dev, 0x01, 0x22); | ||
2389 | msleep(100); | ||
2390 | reg01 = SCL_SEL_OD | S_PDN_INV; | ||
2391 | reg17 &= MCK_SIZE_MASK; | ||
2392 | reg17 |= 0x04; /* clock / 4 */ | ||
2393 | break; | ||
2394 | } | ||
2395 | reg01 |= SYS_SEL_48M; | ||
2396 | reg_w1(gspca_dev, 0x01, reg01); | ||
2397 | reg17 |= SEN_CLK_EN; | ||
2398 | reg_w1(gspca_dev, 0x17, reg17); | ||
2399 | reg01 &= ~S_PWR_DN; /* sensor power on */ | ||
2400 | reg_w1(gspca_dev, 0x01, reg01); | ||
2401 | reg01 &= ~SYS_SEL_48M; | ||
2402 | reg_w1(gspca_dev, 0x01, reg01); | ||
2403 | |||
2404 | switch (sd->sensor) { | ||
2405 | case SENSOR_HV7131R: | ||
2406 | hv7131r_probe(gspca_dev); /*fixme: is it useful? */ | ||
2407 | break; | ||
2408 | case SENSOR_OM6802: | ||
2409 | msleep(10); | ||
2410 | reg_w1(gspca_dev, 0x01, reg01); | ||
2411 | i2c_w8(gspca_dev, om6802_init0[0]); | ||
2412 | i2c_w8(gspca_dev, om6802_init0[1]); | ||
2413 | msleep(15); | ||
2414 | reg_w1(gspca_dev, 0x02, 0x71); | ||
2415 | msleep(150); | ||
2416 | break; | ||
2417 | case SENSOR_SP80708: | ||
2418 | msleep(100); | ||
2419 | reg_w1(gspca_dev, 0x02, 0x62); | ||
2420 | break; | ||
2421 | } | ||
2452 | 2422 | ||
2453 | /* initialize the sensor */ | 2423 | /* initialize the sensor */ |
2454 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); | 2424 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); |
@@ -2476,30 +2446,11 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2476 | } | 2446 | } |
2477 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); | 2447 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
2478 | switch (sd->sensor) { | 2448 | switch (sd->sensor) { |
2479 | case SENSOR_GC0307: | 2449 | case SENSOR_OM6802: |
2480 | reg17 = 0xa2; | 2450 | /* case SENSOR_OV7648: * fixme: sometimes */ |
2481 | break; | ||
2482 | case SENSOR_MT9V111: | ||
2483 | case SENSOR_MI0360B: | ||
2484 | reg17 = 0xe0; | ||
2485 | break; | ||
2486 | case SENSOR_ADCM1700: | ||
2487 | case SENSOR_OV7630: | ||
2488 | reg17 = 0xe2; | ||
2489 | break; | ||
2490 | case SENSOR_OV7648: | ||
2491 | reg17 = 0x20; | ||
2492 | break; | ||
2493 | case SENSOR_OV7660: | ||
2494 | case SENSOR_SOI768: | ||
2495 | reg17 = 0xa0; | ||
2496 | break; | ||
2497 | case SENSOR_PO1030: | ||
2498 | case SENSOR_PO2030N: | ||
2499 | reg17 = 0xa0; | ||
2500 | break; | 2451 | break; |
2501 | default: | 2452 | default: |
2502 | reg17 = 0x60; | 2453 | reg17 |= DEF_EN; |
2503 | break; | 2454 | break; |
2504 | } | 2455 | } |
2505 | reg_w1(gspca_dev, 0x17, reg17); | 2456 | reg_w1(gspca_dev, 0x17, reg17); |
@@ -2546,95 +2497,67 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2546 | 2497 | ||
2547 | init = NULL; | 2498 | init = NULL; |
2548 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; | 2499 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; |
2549 | if (mode) | 2500 | reg01 |= SYS_SEL_48M | V_TX_EN; |
2550 | reg1 = 0x46; /* 320x240: clk 48Mhz, video trf enable */ | 2501 | reg17 &= ~MCK_SIZE_MASK; |
2551 | else | 2502 | reg17 |= 0x02; /* clock / 2 */ |
2552 | reg1 = 0x06; /* 640x480: clk 24Mhz, video trf enable */ | ||
2553 | reg17 = 0x61; /* 0x:20: enable sensor clock */ | ||
2554 | switch (sd->sensor) { | 2503 | switch (sd->sensor) { |
2555 | case SENSOR_ADCM1700: | 2504 | case SENSOR_ADCM1700: |
2556 | init = adcm1700_sensor_param1; | 2505 | init = adcm1700_sensor_param1; |
2557 | reg1 = 0x46; | ||
2558 | reg17 = 0xe2; | ||
2559 | break; | 2506 | break; |
2560 | case SENSOR_GC0307: | 2507 | case SENSOR_GC0307: |
2561 | init = gc0307_sensor_param1; | 2508 | init = gc0307_sensor_param1; |
2562 | reg17 = 0xa2; | 2509 | break; |
2563 | reg1 = 0x44; | 2510 | case SENSOR_HV7131R: |
2511 | case SENSOR_MI0360: | ||
2512 | if (mode) | ||
2513 | reg01 |= SYS_SEL_48M; /* 320x240: clk 48Mhz */ | ||
2514 | else | ||
2515 | reg01 &= ~SYS_SEL_48M; /* 640x480: clk 24Mhz */ | ||
2516 | reg17 &= ~MCK_SIZE_MASK; | ||
2517 | reg17 |= 0x01; /* clock / 1 */ | ||
2564 | break; | 2518 | break; |
2565 | case SENSOR_MI0360B: | 2519 | case SENSOR_MI0360B: |
2566 | init = mi0360b_sensor_param1; | 2520 | init = mi0360b_sensor_param1; |
2567 | reg1 &= ~0x02; /* don't inverse pin S_PWR_DN */ | ||
2568 | reg17 = 0xe2; | ||
2569 | break; | 2521 | break; |
2570 | case SENSOR_MO4000: | 2522 | case SENSOR_MO4000: |
2571 | if (mode) { | 2523 | if (mode) { /* if 320x240 */ |
2572 | /* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */ | 2524 | reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ |
2573 | reg1 = 0x06; /* clk 24Mz */ | 2525 | reg17 &= ~MCK_SIZE_MASK; |
2574 | } else { | 2526 | reg17 |= 0x01; /* clock / 1 */ |
2575 | reg17 = 0x22; /* 640 MCKSIZE */ | ||
2576 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | ||
2577 | } | 2527 | } |
2578 | break; | 2528 | break; |
2579 | case SENSOR_MT9V111: | 2529 | case SENSOR_MT9V111: |
2580 | init = mt9v111_sensor_param1; | 2530 | init = mt9v111_sensor_param1; |
2581 | if (mode) { | ||
2582 | reg1 = 0x04; /* 320 clk 48Mhz */ | ||
2583 | } else { | ||
2584 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | ||
2585 | reg17 = 0xc2; | ||
2586 | } | ||
2587 | break; | 2531 | break; |
2588 | case SENSOR_OM6802: | 2532 | case SENSOR_OM6802: |
2589 | init = om6802_sensor_param1; | 2533 | init = om6802_sensor_param1; |
2590 | reg17 = 0x64; /* 640 MCKSIZE */ | 2534 | if (!mode) { /* if 640x480 */ |
2535 | reg17 &= ~MCK_SIZE_MASK; | ||
2536 | reg17 |= 0x01; /* clock / 4 */ | ||
2537 | } | ||
2591 | break; | 2538 | break; |
2592 | case SENSOR_OV7630: | 2539 | case SENSOR_OV7630: |
2593 | init = ov7630_sensor_param1; | 2540 | init = ov7630_sensor_param1; |
2594 | reg17 = 0xe2; | ||
2595 | reg1 = 0x44; | ||
2596 | break; | 2541 | break; |
2597 | case SENSOR_OV7648: | 2542 | case SENSOR_OV7648: |
2598 | init = ov7648_sensor_param1; | 2543 | init = ov7648_sensor_param1; |
2599 | reg17 = 0x21; | 2544 | reg17 &= ~MCK_SIZE_MASK; |
2600 | /* reg1 = 0x42; * 42 - 46? */ | 2545 | reg17 |= 0x01; /* clock / 1 */ |
2601 | break; | 2546 | break; |
2602 | case SENSOR_OV7660: | 2547 | case SENSOR_OV7660: |
2603 | init = ov7660_sensor_param1; | 2548 | init = ov7660_sensor_param1; |
2604 | if (sd->bridge == BRIDGE_SN9C120) { | ||
2605 | if (mode) { /* 320x240 - 160x120 */ | ||
2606 | reg17 = 0xa2; | ||
2607 | reg1 = 0x44; /* 48 Mhz, video trf eneble */ | ||
2608 | } | ||
2609 | } else { | ||
2610 | reg17 = 0x22; | ||
2611 | reg1 = 0x06; /* 24 Mhz, video trf eneble | ||
2612 | * inverse power down */ | ||
2613 | } | ||
2614 | break; | 2549 | break; |
2615 | case SENSOR_PO1030: | 2550 | case SENSOR_PO1030: |
2616 | init = po1030_sensor_param1; | 2551 | init = po1030_sensor_param1; |
2617 | reg17 = 0xa2; | ||
2618 | reg1 = 0x44; | ||
2619 | break; | 2552 | break; |
2620 | case SENSOR_PO2030N: | 2553 | case SENSOR_PO2030N: |
2621 | init = po2030n_sensor_param1; | 2554 | init = po2030n_sensor_param1; |
2622 | reg1 = 0x46; | ||
2623 | reg17 = 0xa2; | ||
2624 | break; | 2555 | break; |
2625 | case SENSOR_SOI768: | 2556 | case SENSOR_SOI768: |
2626 | init = soi768_sensor_param1; | 2557 | init = soi768_sensor_param1; |
2627 | reg1 = 0x44; | ||
2628 | reg17 = 0xa2; | ||
2629 | break; | 2558 | break; |
2630 | case SENSOR_SP80708: | 2559 | case SENSOR_SP80708: |
2631 | init = sp80708_sensor_param1; | 2560 | init = sp80708_sensor_param1; |
2632 | if (mode) { | ||
2633 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ | ||
2634 | } else { | ||
2635 | reg1 = 0x46; /* 640 clk 48Mz */ | ||
2636 | reg17 = 0xa2; | ||
2637 | } | ||
2638 | break; | 2561 | break; |
2639 | } | 2562 | } |
2640 | 2563 | ||
@@ -2684,7 +2607,9 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2684 | setjpegqual(gspca_dev); | 2607 | setjpegqual(gspca_dev); |
2685 | 2608 | ||
2686 | reg_w1(gspca_dev, 0x17, reg17); | 2609 | reg_w1(gspca_dev, 0x17, reg17); |
2687 | reg_w1(gspca_dev, 0x01, reg1); | 2610 | reg_w1(gspca_dev, 0x01, reg01); |
2611 | sd->reg01 = reg01; | ||
2612 | sd->reg17 = reg17; | ||
2688 | 2613 | ||
2689 | sethvflip(gspca_dev); | 2614 | sethvflip(gspca_dev); |
2690 | setbrightness(gspca_dev); | 2615 | setbrightness(gspca_dev); |
@@ -2706,41 +2631,64 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
2706 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; | 2631 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
2707 | static const u8 stopsoi768[] = | 2632 | static const u8 stopsoi768[] = |
2708 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; | 2633 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; |
2709 | u8 data; | 2634 | u8 reg01; |
2710 | const u8 *sn9c1xx; | 2635 | u8 reg17; |
2711 | 2636 | ||
2712 | data = 0x0b; | 2637 | reg01 = sd->reg01; |
2638 | reg17 = sd->reg17 & ~SEN_CLK_EN; | ||
2713 | switch (sd->sensor) { | 2639 | switch (sd->sensor) { |
2640 | case SENSOR_ADCM1700: | ||
2714 | case SENSOR_GC0307: | 2641 | case SENSOR_GC0307: |
2715 | data = 0x29; | 2642 | case SENSOR_PO2030N: |
2643 | case SENSOR_SP80708: | ||
2644 | reg01 |= LED; | ||
2645 | reg_w1(gspca_dev, 0x01, reg01); | ||
2646 | reg01 &= ~(LED | V_TX_EN); | ||
2647 | reg_w1(gspca_dev, 0x01, reg01); | ||
2648 | /* reg_w1(gspca_dev, 0x02, 0x??); * LED off ? */ | ||
2716 | break; | 2649 | break; |
2717 | case SENSOR_HV7131R: | 2650 | case SENSOR_HV7131R: |
2651 | reg01 &= ~V_TX_EN; | ||
2652 | reg_w1(gspca_dev, 0x01, reg01); | ||
2718 | i2c_w8(gspca_dev, stophv7131); | 2653 | i2c_w8(gspca_dev, stophv7131); |
2719 | data = 0x2b; | ||
2720 | break; | 2654 | break; |
2721 | case SENSOR_MI0360: | 2655 | case SENSOR_MI0360: |
2722 | case SENSOR_MI0360B: | 2656 | case SENSOR_MI0360B: |
2657 | reg01 &= ~V_TX_EN; | ||
2658 | reg_w1(gspca_dev, 0x01, reg01); | ||
2659 | /* reg_w1(gspca_dev, 0x02, 0x40); * LED off ? */ | ||
2723 | i2c_w8(gspca_dev, stopmi0360); | 2660 | i2c_w8(gspca_dev, stopmi0360); |
2724 | data = 0x29; | ||
2725 | break; | 2661 | break; |
2726 | case SENSOR_OV7648: | ||
2727 | i2c_w8(gspca_dev, stopov7648); | ||
2728 | /* fall thru */ | ||
2729 | case SENSOR_MT9V111: | 2662 | case SENSOR_MT9V111: |
2730 | case SENSOR_OV7630: | 2663 | case SENSOR_OM6802: |
2731 | case SENSOR_PO1030: | 2664 | case SENSOR_PO1030: |
2732 | data = 0x29; | 2665 | reg01 &= ~V_TX_EN; |
2666 | reg_w1(gspca_dev, 0x01, reg01); | ||
2667 | break; | ||
2668 | case SENSOR_OV7630: | ||
2669 | case SENSOR_OV7648: | ||
2670 | reg01 &= ~V_TX_EN; | ||
2671 | reg_w1(gspca_dev, 0x01, reg01); | ||
2672 | i2c_w8(gspca_dev, stopov7648); | ||
2673 | break; | ||
2674 | case SENSOR_OV7660: | ||
2675 | reg01 &= ~V_TX_EN; | ||
2676 | reg_w1(gspca_dev, 0x01, reg01); | ||
2733 | break; | 2677 | break; |
2734 | case SENSOR_SOI768: | 2678 | case SENSOR_SOI768: |
2735 | i2c_w8(gspca_dev, stopsoi768); | 2679 | i2c_w8(gspca_dev, stopsoi768); |
2736 | data = 0x29; | ||
2737 | break; | 2680 | break; |
2738 | } | 2681 | } |
2739 | sn9c1xx = sn_tb[sd->sensor]; | 2682 | |
2740 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 2683 | reg01 |= SCL_SEL_OD; |
2741 | reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); | 2684 | reg_w1(gspca_dev, 0x01, reg01); |
2742 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 2685 | reg01 |= S_PWR_DN; /* sensor power down */ |
2743 | reg_w1(gspca_dev, 0x01, data); | 2686 | reg_w1(gspca_dev, 0x01, reg01); |
2687 | reg_w1(gspca_dev, 0x17, reg17); | ||
2688 | reg01 &= ~SYS_SEL_48M; /* clock 24MHz */ | ||
2689 | reg_w1(gspca_dev, 0x01, reg01); | ||
2690 | reg01 |= LED; | ||
2691 | reg_w1(gspca_dev, 0x01, reg01); | ||
2744 | /* Don't disable sensor clock as that disables the button on the cam */ | 2692 | /* Don't disable sensor clock as that disables the button on the cam */ |
2745 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ | 2693 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ |
2746 | } | 2694 | } |
@@ -2954,14 +2902,18 @@ static const struct sd_desc sd_desc = { | |||
2954 | /* -- module initialisation -- */ | 2902 | /* -- module initialisation -- */ |
2955 | #define BS(bridge, sensor) \ | 2903 | #define BS(bridge, sensor) \ |
2956 | .driver_info = (BRIDGE_ ## bridge << 16) \ | 2904 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
2957 | | SENSOR_ ## sensor | 2905 | | (SENSOR_ ## sensor << 8) |
2906 | #define BSF(bridge, sensor, flags) \ | ||
2907 | .driver_info = (BRIDGE_ ## bridge << 16) \ | ||
2908 | | (SENSOR_ ## sensor << 8) \ | ||
2909 | | (flags) | ||
2958 | static const __devinitdata struct usb_device_id device_table[] = { | 2910 | static const __devinitdata struct usb_device_id device_table[] = { |
2959 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | 2911 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
2960 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, | 2912 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
2961 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | 2913 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
2962 | #endif | 2914 | #endif |
2963 | {USB_DEVICE(0x045e, 0x00f5), BS(SN9C105, OV7660)}, | 2915 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, |
2964 | {USB_DEVICE(0x045e, 0x00f7), BS(SN9C105, OV7660)}, | 2916 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)}, |
2965 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, | 2917 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
2966 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, | 2918 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, |
2967 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, | 2919 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 9e8039ac909e..665191c9b407 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -239,19 +239,16 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
239 | return -1; | 239 | return -1; |
240 | if (hw == IVTV_HW_TUNER) { | 240 | if (hw == IVTV_HW_TUNER) { |
241 | /* special tuner handling */ | 241 | /* special tuner handling */ |
242 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 242 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, |
243 | adap, NULL, type, | 243 | itv->card_i2c->radio); |
244 | 0, itv->card_i2c->radio); | ||
245 | if (sd) | 244 | if (sd) |
246 | sd->grp_id = 1 << idx; | 245 | sd->grp_id = 1 << idx; |
247 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 246 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, |
248 | adap, NULL, type, | 247 | itv->card_i2c->demod); |
249 | 0, itv->card_i2c->demod); | ||
250 | if (sd) | 248 | if (sd) |
251 | sd->grp_id = 1 << idx; | 249 | sd->grp_id = 1 << idx; |
252 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 250 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, |
253 | adap, NULL, type, | 251 | itv->card_i2c->tv); |
254 | 0, itv->card_i2c->tv); | ||
255 | if (sd) | 252 | if (sd) |
256 | sd->grp_id = 1 << idx; | 253 | sd->grp_id = 1 << idx; |
257 | return sd ? 0 : -1; | 254 | return sd ? 0 : -1; |
@@ -267,17 +264,16 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
267 | /* It's an I2C device other than an analog tuner or IR chip */ | 264 | /* It's an I2C device other than an analog tuner or IR chip */ |
268 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { | 265 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { |
269 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 266 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
270 | adap, NULL, type, 0, I2C_ADDRS(hw_addrs[idx])); | 267 | adap, type, 0, I2C_ADDRS(hw_addrs[idx])); |
271 | } else if (hw == IVTV_HW_CX25840) { | 268 | } else if (hw == IVTV_HW_CX25840) { |
272 | struct cx25840_platform_data pdata; | 269 | struct cx25840_platform_data pdata; |
273 | 270 | ||
274 | pdata.pvr150_workaround = itv->pvr150_workaround; | 271 | pdata.pvr150_workaround = itv->pvr150_workaround; |
275 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, | 272 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, |
276 | adap, NULL, type, 0, &pdata, hw_addrs[idx], | 273 | adap, type, 0, &pdata, hw_addrs[idx], NULL); |
277 | NULL); | ||
278 | } else { | 274 | } else { |
279 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 275 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
280 | adap, NULL, type, hw_addrs[idx], NULL); | 276 | adap, type, hw_addrs[idx], NULL); |
281 | } | 277 | } |
282 | if (sd) | 278 | if (sd) |
283 | sd->grp_id = 1 << idx; | 279 | sd->grp_id = 1 << idx; |
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 2be23bccd3c8..48d2c2419c13 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
@@ -1659,7 +1659,7 @@ static const struct v4l2_file_operations meye_fops = { | |||
1659 | .open = meye_open, | 1659 | .open = meye_open, |
1660 | .release = meye_release, | 1660 | .release = meye_release, |
1661 | .mmap = meye_mmap, | 1661 | .mmap = meye_mmap, |
1662 | .ioctl = video_ioctl2, | 1662 | .unlocked_ioctl = video_ioctl2, |
1663 | .poll = meye_poll, | 1663 | .poll = meye_poll, |
1664 | }; | 1664 | }; |
1665 | 1665 | ||
@@ -1831,12 +1831,6 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
1831 | msleep(1); | 1831 | msleep(1); |
1832 | mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); | 1832 | mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); |
1833 | 1833 | ||
1834 | if (video_register_device(meye.vdev, VFL_TYPE_GRABBER, | ||
1835 | video_nr) < 0) { | ||
1836 | v4l2_err(v4l2_dev, "video_register_device failed\n"); | ||
1837 | goto outvideoreg; | ||
1838 | } | ||
1839 | |||
1840 | mutex_init(&meye.lock); | 1834 | mutex_init(&meye.lock); |
1841 | init_waitqueue_head(&meye.proc_list); | 1835 | init_waitqueue_head(&meye.proc_list); |
1842 | meye.brightness = 32 << 10; | 1836 | meye.brightness = 32 << 10; |
@@ -1858,6 +1852,12 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
1858 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0); | 1852 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0); |
1859 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48); | 1853 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48); |
1860 | 1854 | ||
1855 | if (video_register_device(meye.vdev, VFL_TYPE_GRABBER, | ||
1856 | video_nr) < 0) { | ||
1857 | v4l2_err(v4l2_dev, "video_register_device failed\n"); | ||
1858 | goto outvideoreg; | ||
1859 | } | ||
1860 | |||
1861 | v4l2_info(v4l2_dev, "Motion Eye Camera Driver v%s.\n", | 1861 | v4l2_info(v4l2_dev, "Motion Eye Camera Driver v%s.\n", |
1862 | MEYE_DRIVER_VERSION); | 1862 | MEYE_DRIVER_VERSION); |
1863 | v4l2_info(v4l2_dev, "mchip KL5A72002 rev. %d, base %lx, irq %d\n", | 1863 | v4l2_info(v4l2_dev, "mchip KL5A72002 rev. %d, base %lx, irq %d\n", |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 072bd2d1cfad..13565cba237d 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -807,8 +807,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd, | |||
807 | 807 | ||
808 | if (common_flags & SOCAM_PCLK_SAMPLE_RISING) | 808 | if (common_flags & SOCAM_PCLK_SAMPLE_RISING) |
809 | csicr1 |= CSICR1_REDGE; | 809 | csicr1 |= CSICR1_REDGE; |
810 | if (common_flags & SOCAM_PCLK_SAMPLE_FALLING) | ||
811 | csicr1 |= CSICR1_INV_PCLK; | ||
812 | if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) | 810 | if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) |
813 | csicr1 |= CSICR1_SOF_POL; | 811 | csicr1 |= CSICR1_SOF_POL; |
814 | if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH) | 812 | if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH) |
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 94ba698d0ad4..4e8fd965f151 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -185,17 +185,17 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 187 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
188 | NULL, "saa7111", I2C_SAA7111A, NULL); | 188 | "saa7111", I2C_SAA7111A, NULL); |
189 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 189 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
190 | NULL, "tea6420", I2C_TEA6420_1, NULL); | 190 | "tea6420", I2C_TEA6420_1, NULL); |
191 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 191 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
192 | NULL, "tea6420", I2C_TEA6420_2, NULL); | 192 | "tea6420", I2C_TEA6420_2, NULL); |
193 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 193 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
194 | NULL, "tea6415c", I2C_TEA6415C, NULL); | 194 | "tea6415c", I2C_TEA6415C, NULL); |
195 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 195 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
196 | NULL, "tda9840", I2C_TDA9840, NULL); | 196 | "tda9840", I2C_TDA9840, NULL); |
197 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 197 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
198 | NULL, "tuner", I2C_TUNER, NULL); | 198 | "tuner", I2C_TUNER, NULL); |
199 | 199 | ||
200 | /* check if all devices are present */ | 200 | /* check if all devices are present */ |
201 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || | 201 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || |
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 7129b50757db..7551907f8c28 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -932,7 +932,7 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
932 | 932 | ||
933 | static const struct v4l2_file_operations pms_fops = { | 933 | static const struct v4l2_file_operations pms_fops = { |
934 | .owner = THIS_MODULE, | 934 | .owner = THIS_MODULE, |
935 | .ioctl = video_ioctl2, | 935 | .unlocked_ioctl = video_ioctl2, |
936 | .read = pms_read, | 936 | .read = pms_read, |
937 | }; | 937 | }; |
938 | 938 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index bef202752cc8..66ad516bdfd9 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -2088,16 +2088,14 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, | |||
2088 | " Setting up with specified i2c address 0x%x", | 2088 | " Setting up with specified i2c address 0x%x", |
2089 | mid, i2caddr[0]); | 2089 | mid, i2caddr[0]); |
2090 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, | 2090 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2091 | NULL, fname, | 2091 | fname, i2caddr[0], NULL); |
2092 | i2caddr[0], NULL); | ||
2093 | } else { | 2092 | } else { |
2094 | pvr2_trace(PVR2_TRACE_INIT, | 2093 | pvr2_trace(PVR2_TRACE_INIT, |
2095 | "Module ID %u:" | 2094 | "Module ID %u:" |
2096 | " Setting up with address probe list", | 2095 | " Setting up with address probe list", |
2097 | mid); | 2096 | mid); |
2098 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, | 2097 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2099 | NULL, fname, | 2098 | fname, 0, i2caddr); |
2100 | 0, i2caddr); | ||
2101 | } | 2099 | } |
2102 | 2100 | ||
2103 | if (!sd) { | 2101 | if (!sd) { |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index e8f13d3e2df1..2f500809f53d 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -44,7 +44,7 @@ static struct v4l2_subdev *fimc_subdev_register(struct fimc_dev *fimc, | |||
44 | return ERR_PTR(-ENOMEM); | 44 | return ERR_PTR(-ENOMEM); |
45 | 45 | ||
46 | sd = v4l2_i2c_new_subdev_board(&vid_cap->v4l2_dev, i2c_adap, | 46 | sd = v4l2_i2c_new_subdev_board(&vid_cap->v4l2_dev, i2c_adap, |
47 | MODULE_NAME, isp_info->board_info, NULL); | 47 | isp_info->board_info, NULL); |
48 | if (!sd) { | 48 | if (!sd) { |
49 | v4l2_err(&vid_cap->v4l2_dev, "failed to acquire subdev\n"); | 49 | v4l2_err(&vid_cap->v4l2_dev, "failed to acquire subdev\n"); |
50 | return NULL; | 50 | return NULL; |
@@ -522,6 +522,7 @@ static int fimc_cap_streamon(struct file *file, void *priv, | |||
522 | INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); | 522 | INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); |
523 | fimc->vid_cap.active_buf_cnt = 0; | 523 | fimc->vid_cap.active_buf_cnt = 0; |
524 | fimc->vid_cap.frame_count = 0; | 524 | fimc->vid_cap.frame_count = 0; |
525 | fimc->vid_cap.buf_index = fimc_hw_get_frame_index(fimc); | ||
525 | 526 | ||
526 | set_bit(ST_CAPT_PEND, &fimc->state); | 527 | set_bit(ST_CAPT_PEND, &fimc->state); |
527 | ret = videobuf_streamon(&fimc->vid_cap.vbq); | 528 | ret = videobuf_streamon(&fimc->vid_cap.vbq); |
@@ -652,6 +653,50 @@ static int fimc_cap_s_ctrl(struct file *file, void *priv, | |||
652 | return ret; | 653 | return ret; |
653 | } | 654 | } |
654 | 655 | ||
656 | static int fimc_cap_cropcap(struct file *file, void *fh, | ||
657 | struct v4l2_cropcap *cr) | ||
658 | { | ||
659 | struct fimc_frame *f; | ||
660 | struct fimc_ctx *ctx = fh; | ||
661 | struct fimc_dev *fimc = ctx->fimc_dev; | ||
662 | |||
663 | if (cr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
664 | return -EINVAL; | ||
665 | |||
666 | if (mutex_lock_interruptible(&fimc->lock)) | ||
667 | return -ERESTARTSYS; | ||
668 | |||
669 | f = &ctx->s_frame; | ||
670 | cr->bounds.left = 0; | ||
671 | cr->bounds.top = 0; | ||
672 | cr->bounds.width = f->o_width; | ||
673 | cr->bounds.height = f->o_height; | ||
674 | cr->defrect = cr->bounds; | ||
675 | |||
676 | mutex_unlock(&fimc->lock); | ||
677 | return 0; | ||
678 | } | ||
679 | |||
680 | static int fimc_cap_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) | ||
681 | { | ||
682 | struct fimc_frame *f; | ||
683 | struct fimc_ctx *ctx = file->private_data; | ||
684 | struct fimc_dev *fimc = ctx->fimc_dev; | ||
685 | |||
686 | |||
687 | if (mutex_lock_interruptible(&fimc->lock)) | ||
688 | return -ERESTARTSYS; | ||
689 | |||
690 | f = &ctx->s_frame; | ||
691 | cr->c.left = f->offs_h; | ||
692 | cr->c.top = f->offs_v; | ||
693 | cr->c.width = f->width; | ||
694 | cr->c.height = f->height; | ||
695 | |||
696 | mutex_unlock(&fimc->lock); | ||
697 | return 0; | ||
698 | } | ||
699 | |||
655 | static int fimc_cap_s_crop(struct file *file, void *fh, | 700 | static int fimc_cap_s_crop(struct file *file, void *fh, |
656 | struct v4l2_crop *cr) | 701 | struct v4l2_crop *cr) |
657 | { | 702 | { |
@@ -716,9 +761,9 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = { | |||
716 | .vidioc_g_ctrl = fimc_vidioc_g_ctrl, | 761 | .vidioc_g_ctrl = fimc_vidioc_g_ctrl, |
717 | .vidioc_s_ctrl = fimc_cap_s_ctrl, | 762 | .vidioc_s_ctrl = fimc_cap_s_ctrl, |
718 | 763 | ||
719 | .vidioc_g_crop = fimc_vidioc_g_crop, | 764 | .vidioc_g_crop = fimc_cap_g_crop, |
720 | .vidioc_s_crop = fimc_cap_s_crop, | 765 | .vidioc_s_crop = fimc_cap_s_crop, |
721 | .vidioc_cropcap = fimc_vidioc_cropcap, | 766 | .vidioc_cropcap = fimc_cap_cropcap, |
722 | 767 | ||
723 | .vidioc_enum_input = fimc_cap_enum_input, | 768 | .vidioc_enum_input = fimc_cap_enum_input, |
724 | .vidioc_s_input = fimc_cap_s_input, | 769 | .vidioc_s_input = fimc_cap_s_input, |
@@ -785,7 +830,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc) | |||
785 | videobuf_queue_dma_contig_init(&vid_cap->vbq, &fimc_qops, | 830 | videobuf_queue_dma_contig_init(&vid_cap->vbq, &fimc_qops, |
786 | vid_cap->v4l2_dev.dev, &fimc->irqlock, | 831 | vid_cap->v4l2_dev.dev, &fimc->irqlock, |
787 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 832 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
788 | sizeof(struct fimc_vid_buffer), (void *)ctx); | 833 | sizeof(struct fimc_vid_buffer), (void *)ctx, NULL); |
789 | 834 | ||
790 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); | 835 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); |
791 | if (ret) { | 836 | if (ret) { |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 2e7c547894b6..bb99f2d805d3 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -50,8 +50,8 @@ static struct fimc_fmt fimc_formats[] = { | |||
50 | .planes_cnt = 1, | 50 | .planes_cnt = 1, |
51 | .flags = FMT_FLAGS_M2M, | 51 | .flags = FMT_FLAGS_M2M, |
52 | }, { | 52 | }, { |
53 | .name = "XRGB-8-8-8-8, 24 bpp", | 53 | .name = "XRGB-8-8-8-8, 32 bpp", |
54 | .fourcc = V4L2_PIX_FMT_RGB24, | 54 | .fourcc = V4L2_PIX_FMT_RGB32, |
55 | .depth = 32, | 55 | .depth = 32, |
56 | .color = S5P_FIMC_RGB888, | 56 | .color = S5P_FIMC_RGB888, |
57 | .buff_cnt = 1, | 57 | .buff_cnt = 1, |
@@ -983,6 +983,7 @@ int fimc_vidioc_queryctrl(struct file *file, void *priv, | |||
983 | { | 983 | { |
984 | struct fimc_ctx *ctx = priv; | 984 | struct fimc_ctx *ctx = priv; |
985 | struct v4l2_queryctrl *c; | 985 | struct v4l2_queryctrl *c; |
986 | int ret = -EINVAL; | ||
986 | 987 | ||
987 | c = get_ctrl(qc->id); | 988 | c = get_ctrl(qc->id); |
988 | if (c) { | 989 | if (c) { |
@@ -990,10 +991,14 @@ int fimc_vidioc_queryctrl(struct file *file, void *priv, | |||
990 | return 0; | 991 | return 0; |
991 | } | 992 | } |
992 | 993 | ||
993 | if (ctx->state & FIMC_CTX_CAP) | 994 | if (ctx->state & FIMC_CTX_CAP) { |
994 | return v4l2_subdev_call(ctx->fimc_dev->vid_cap.sd, | 995 | if (mutex_lock_interruptible(&ctx->fimc_dev->lock)) |
996 | return -ERESTARTSYS; | ||
997 | ret = v4l2_subdev_call(ctx->fimc_dev->vid_cap.sd, | ||
995 | core, queryctrl, qc); | 998 | core, queryctrl, qc); |
996 | return -EINVAL; | 999 | mutex_unlock(&ctx->fimc_dev->lock); |
1000 | } | ||
1001 | return ret; | ||
997 | } | 1002 | } |
998 | 1003 | ||
999 | int fimc_vidioc_g_ctrl(struct file *file, void *priv, | 1004 | int fimc_vidioc_g_ctrl(struct file *file, void *priv, |
@@ -1115,7 +1120,7 @@ static int fimc_m2m_s_ctrl(struct file *file, void *priv, | |||
1115 | return 0; | 1120 | return 0; |
1116 | } | 1121 | } |
1117 | 1122 | ||
1118 | int fimc_vidioc_cropcap(struct file *file, void *fh, | 1123 | static int fimc_m2m_cropcap(struct file *file, void *fh, |
1119 | struct v4l2_cropcap *cr) | 1124 | struct v4l2_cropcap *cr) |
1120 | { | 1125 | { |
1121 | struct fimc_frame *frame; | 1126 | struct fimc_frame *frame; |
@@ -1139,7 +1144,7 @@ int fimc_vidioc_cropcap(struct file *file, void *fh, | |||
1139 | return 0; | 1144 | return 0; |
1140 | } | 1145 | } |
1141 | 1146 | ||
1142 | int fimc_vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) | 1147 | static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) |
1143 | { | 1148 | { |
1144 | struct fimc_frame *frame; | 1149 | struct fimc_frame *frame; |
1145 | struct fimc_ctx *ctx = file->private_data; | 1150 | struct fimc_ctx *ctx = file->private_data; |
@@ -1167,22 +1172,22 @@ int fimc_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr) | |||
1167 | struct fimc_frame *f; | 1172 | struct fimc_frame *f; |
1168 | u32 min_size, halign; | 1173 | u32 min_size, halign; |
1169 | 1174 | ||
1170 | f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? | ||
1171 | &ctx->s_frame : &ctx->d_frame; | ||
1172 | |||
1173 | if (cr->c.top < 0 || cr->c.left < 0) { | 1175 | if (cr->c.top < 0 || cr->c.left < 0) { |
1174 | v4l2_err(&fimc->m2m.v4l2_dev, | 1176 | v4l2_err(&fimc->m2m.v4l2_dev, |
1175 | "doesn't support negative values for top & left\n"); | 1177 | "doesn't support negative values for top & left\n"); |
1176 | return -EINVAL; | 1178 | return -EINVAL; |
1177 | } | 1179 | } |
1178 | 1180 | ||
1179 | f = ctx_get_frame(ctx, cr->type); | 1181 | if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1180 | if (IS_ERR(f)) | 1182 | f = (ctx->state & FIMC_CTX_CAP) ? &ctx->s_frame : &ctx->d_frame; |
1181 | return PTR_ERR(f); | 1183 | else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && |
1184 | ctx->state & FIMC_CTX_M2M) | ||
1185 | f = &ctx->s_frame; | ||
1186 | else | ||
1187 | return -EINVAL; | ||
1182 | 1188 | ||
1183 | min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) | 1189 | min_size = (f == &ctx->s_frame) ? |
1184 | ? fimc->variant->min_inp_pixsize | 1190 | fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; |
1185 | : fimc->variant->min_out_pixsize; | ||
1186 | 1191 | ||
1187 | if (ctx->state & FIMC_CTX_M2M) { | 1192 | if (ctx->state & FIMC_CTX_M2M) { |
1188 | if (fimc->id == 1 && fimc->variant->pix_hoff) | 1193 | if (fimc->id == 1 && fimc->variant->pix_hoff) |
@@ -1233,6 +1238,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr) | |||
1233 | f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? | 1238 | f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? |
1234 | &ctx->s_frame : &ctx->d_frame; | 1239 | &ctx->s_frame : &ctx->d_frame; |
1235 | 1240 | ||
1241 | if (mutex_lock_interruptible(&fimc->lock)) | ||
1242 | return -ERESTARTSYS; | ||
1243 | |||
1236 | spin_lock_irqsave(&ctx->slock, flags); | 1244 | spin_lock_irqsave(&ctx->slock, flags); |
1237 | if (~ctx->state & (FIMC_SRC_FMT | FIMC_DST_FMT)) { | 1245 | if (~ctx->state & (FIMC_SRC_FMT | FIMC_DST_FMT)) { |
1238 | /* Check to see if scaling ratio is within supported range */ | 1246 | /* Check to see if scaling ratio is within supported range */ |
@@ -1241,9 +1249,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr) | |||
1241 | else | 1249 | else |
1242 | ret = fimc_check_scaler_ratio(&cr->c, &ctx->s_frame); | 1250 | ret = fimc_check_scaler_ratio(&cr->c, &ctx->s_frame); |
1243 | if (ret) { | 1251 | if (ret) { |
1244 | spin_unlock_irqrestore(&ctx->slock, flags); | ||
1245 | v4l2_err(&fimc->m2m.v4l2_dev, "Out of scaler range"); | 1252 | v4l2_err(&fimc->m2m.v4l2_dev, "Out of scaler range"); |
1246 | return -EINVAL; | 1253 | ret = -EINVAL; |
1254 | goto scr_unlock; | ||
1247 | } | 1255 | } |
1248 | } | 1256 | } |
1249 | ctx->state |= FIMC_PARAMS; | 1257 | ctx->state |= FIMC_PARAMS; |
@@ -1253,7 +1261,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr) | |||
1253 | f->width = cr->c.width; | 1261 | f->width = cr->c.width; |
1254 | f->height = cr->c.height; | 1262 | f->height = cr->c.height; |
1255 | 1263 | ||
1264 | scr_unlock: | ||
1256 | spin_unlock_irqrestore(&ctx->slock, flags); | 1265 | spin_unlock_irqrestore(&ctx->slock, flags); |
1266 | mutex_unlock(&fimc->lock); | ||
1257 | return 0; | 1267 | return 0; |
1258 | } | 1268 | } |
1259 | 1269 | ||
@@ -1285,9 +1295,9 @@ static const struct v4l2_ioctl_ops fimc_m2m_ioctl_ops = { | |||
1285 | .vidioc_g_ctrl = fimc_vidioc_g_ctrl, | 1295 | .vidioc_g_ctrl = fimc_vidioc_g_ctrl, |
1286 | .vidioc_s_ctrl = fimc_m2m_s_ctrl, | 1296 | .vidioc_s_ctrl = fimc_m2m_s_ctrl, |
1287 | 1297 | ||
1288 | .vidioc_g_crop = fimc_vidioc_g_crop, | 1298 | .vidioc_g_crop = fimc_m2m_g_crop, |
1289 | .vidioc_s_crop = fimc_m2m_s_crop, | 1299 | .vidioc_s_crop = fimc_m2m_s_crop, |
1290 | .vidioc_cropcap = fimc_vidioc_cropcap | 1300 | .vidioc_cropcap = fimc_m2m_cropcap |
1291 | 1301 | ||
1292 | }; | 1302 | }; |
1293 | 1303 | ||
@@ -1396,7 +1406,7 @@ static const struct v4l2_file_operations fimc_m2m_fops = { | |||
1396 | .open = fimc_m2m_open, | 1406 | .open = fimc_m2m_open, |
1397 | .release = fimc_m2m_release, | 1407 | .release = fimc_m2m_release, |
1398 | .poll = fimc_m2m_poll, | 1408 | .poll = fimc_m2m_poll, |
1399 | .ioctl = video_ioctl2, | 1409 | .unlocked_ioctl = video_ioctl2, |
1400 | .mmap = fimc_m2m_mmap, | 1410 | .mmap = fimc_m2m_mmap, |
1401 | }; | 1411 | }; |
1402 | 1412 | ||
@@ -1736,6 +1746,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | |||
1736 | .pix_hoff = 1, | 1746 | .pix_hoff = 1, |
1737 | .has_inp_rot = 1, | 1747 | .has_inp_rot = 1, |
1738 | .has_out_rot = 1, | 1748 | .has_out_rot = 1, |
1749 | .has_cistatus2 = 1, | ||
1739 | .min_inp_pixsize = 16, | 1750 | .min_inp_pixsize = 16, |
1740 | .min_out_pixsize = 16, | 1751 | .min_out_pixsize = 16, |
1741 | .hor_offs_align = 1, | 1752 | .hor_offs_align = 1, |
@@ -1745,6 +1756,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | |||
1745 | 1756 | ||
1746 | static struct samsung_fimc_variant fimc2_variant_s5pv310 = { | 1757 | static struct samsung_fimc_variant fimc2_variant_s5pv310 = { |
1747 | .pix_hoff = 1, | 1758 | .pix_hoff = 1, |
1759 | .has_cistatus2 = 1, | ||
1748 | .min_inp_pixsize = 16, | 1760 | .min_inp_pixsize = 16, |
1749 | .min_out_pixsize = 16, | 1761 | .min_out_pixsize = 16, |
1750 | .hor_offs_align = 1, | 1762 | .hor_offs_align = 1, |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index 3e1078516560..4f047d35f8ad 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h | |||
@@ -13,13 +13,15 @@ | |||
13 | 13 | ||
14 | /*#define DEBUG*/ | 14 | /*#define DEBUG*/ |
15 | 15 | ||
16 | #include <linux/sched.h> | ||
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/videodev2.h> | ||
17 | #include <media/videobuf-core.h> | 19 | #include <media/videobuf-core.h> |
18 | #include <media/v4l2-device.h> | 20 | #include <media/v4l2-device.h> |
19 | #include <media/v4l2-mem2mem.h> | 21 | #include <media/v4l2-mem2mem.h> |
20 | #include <media/v4l2-mediabus.h> | 22 | #include <media/v4l2-mediabus.h> |
21 | #include <media/s3c_fimc.h> | 23 | #include <media/s3c_fimc.h> |
22 | #include <linux/videodev2.h> | 24 | |
23 | #include "regs-fimc.h" | 25 | #include "regs-fimc.h" |
24 | 26 | ||
25 | #define err(fmt, args...) \ | 27 | #define err(fmt, args...) \ |
@@ -369,6 +371,7 @@ struct fimc_pix_limit { | |||
369 | * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes | 371 | * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes |
370 | * @has_inp_rot: set if has input rotator | 372 | * @has_inp_rot: set if has input rotator |
371 | * @has_out_rot: set if has output rotator | 373 | * @has_out_rot: set if has output rotator |
374 | * @has_cistatus2: 1 if CISTATUS2 register is present in this IP revision | ||
372 | * @pix_limit: pixel size constraints for the scaler | 375 | * @pix_limit: pixel size constraints for the scaler |
373 | * @min_inp_pixsize: minimum input pixel size | 376 | * @min_inp_pixsize: minimum input pixel size |
374 | * @min_out_pixsize: minimum output pixel size | 377 | * @min_out_pixsize: minimum output pixel size |
@@ -379,6 +382,7 @@ struct samsung_fimc_variant { | |||
379 | unsigned int pix_hoff:1; | 382 | unsigned int pix_hoff:1; |
380 | unsigned int has_inp_rot:1; | 383 | unsigned int has_inp_rot:1; |
381 | unsigned int has_out_rot:1; | 384 | unsigned int has_out_rot:1; |
385 | unsigned int has_cistatus2:1; | ||
382 | struct fimc_pix_limit *pix_limit; | 386 | struct fimc_pix_limit *pix_limit; |
383 | u16 min_inp_pixsize; | 387 | u16 min_inp_pixsize; |
384 | u16 min_out_pixsize; | 388 | u16 min_out_pixsize; |
@@ -554,11 +558,19 @@ static inline struct fimc_frame *ctx_get_frame(struct fimc_ctx *ctx, | |||
554 | return frame; | 558 | return frame; |
555 | } | 559 | } |
556 | 560 | ||
561 | /* Return an index to the buffer actually being written. */ | ||
557 | static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev) | 562 | static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev) |
558 | { | 563 | { |
559 | u32 reg = readl(dev->regs + S5P_CISTATUS); | 564 | u32 reg; |
560 | return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> | 565 | |
561 | S5P_CISTATUS_FRAMECNT_SHIFT; | 566 | if (dev->variant->has_cistatus2) { |
567 | reg = readl(dev->regs + S5P_CISTATUS2) & 0x3F; | ||
568 | return reg > 0 ? --reg : reg; | ||
569 | } else { | ||
570 | reg = readl(dev->regs + S5P_CISTATUS); | ||
571 | return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> | ||
572 | S5P_CISTATUS_FRAMECNT_SHIFT; | ||
573 | } | ||
562 | } | 574 | } |
563 | 575 | ||
564 | /* -----------------------------------------------------*/ | 576 | /* -----------------------------------------------------*/ |
@@ -594,10 +606,6 @@ int fimc_vidioc_g_fmt(struct file *file, void *priv, | |||
594 | struct v4l2_format *f); | 606 | struct v4l2_format *f); |
595 | int fimc_vidioc_try_fmt(struct file *file, void *priv, | 607 | int fimc_vidioc_try_fmt(struct file *file, void *priv, |
596 | struct v4l2_format *f); | 608 | struct v4l2_format *f); |
597 | int fimc_vidioc_g_crop(struct file *file, void *fh, | ||
598 | struct v4l2_crop *cr); | ||
599 | int fimc_vidioc_cropcap(struct file *file, void *fh, | ||
600 | struct v4l2_cropcap *cr); | ||
601 | int fimc_vidioc_queryctrl(struct file *file, void *priv, | 609 | int fimc_vidioc_queryctrl(struct file *file, void *priv, |
602 | struct v4l2_queryctrl *qc); | 610 | struct v4l2_queryctrl *qc); |
603 | int fimc_vidioc_g_ctrl(struct file *file, void *priv, | 611 | int fimc_vidioc_g_ctrl(struct file *file, void *priv, |
diff --git a/drivers/media/video/s5p-fimc/regs-fimc.h b/drivers/media/video/s5p-fimc/regs-fimc.h index a57daedb5b5c..57e33f84fcfa 100644 --- a/drivers/media/video/s5p-fimc/regs-fimc.h +++ b/drivers/media/video/s5p-fimc/regs-fimc.h | |||
@@ -165,6 +165,9 @@ | |||
165 | #define S5P_CISTATUS_VVALID_A (1 << 15) | 165 | #define S5P_CISTATUS_VVALID_A (1 << 15) |
166 | #define S5P_CISTATUS_VVALID_B (1 << 14) | 166 | #define S5P_CISTATUS_VVALID_B (1 << 14) |
167 | 167 | ||
168 | /* Indexes to the last and the currently processed buffer. */ | ||
169 | #define S5P_CISTATUS2 0x68 | ||
170 | |||
168 | /* Image capture control */ | 171 | /* Image capture control */ |
169 | #define S5P_CIIMGCPT 0xc0 | 172 | #define S5P_CIIMGCPT 0xc0 |
170 | #define S5P_CIIMGCPT_IMGCPTEN (1 << 31) | 173 | #define S5P_CIIMGCPT_IMGCPTEN (1 << 31) |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 0911cb580e18..1d4d0a49ea52 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -7551,22 +7551,22 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
7551 | so we do not need to probe for a radio tuner device. */ | 7551 | so we do not need to probe for a radio tuner device. */ |
7552 | if (dev->radio_type != UNSET) | 7552 | if (dev->radio_type != UNSET) |
7553 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7553 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7554 | &dev->i2c_adap, NULL, "tuner", | 7554 | &dev->i2c_adap, "tuner", |
7555 | dev->radio_addr, NULL); | 7555 | dev->radio_addr, NULL); |
7556 | if (has_demod) | 7556 | if (has_demod) |
7557 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7557 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7558 | &dev->i2c_adap, NULL, "tuner", | 7558 | &dev->i2c_adap, "tuner", |
7559 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 7559 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
7560 | if (dev->tuner_addr == ADDR_UNSET) { | 7560 | if (dev->tuner_addr == ADDR_UNSET) { |
7561 | enum v4l2_i2c_tuner_type type = | 7561 | enum v4l2_i2c_tuner_type type = |
7562 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 7562 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
7563 | 7563 | ||
7564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7565 | &dev->i2c_adap, NULL, "tuner", | 7565 | &dev->i2c_adap, "tuner", |
7566 | 0, v4l2_i2c_tuner_addrs(type)); | 7566 | 0, v4l2_i2c_tuner_addrs(type)); |
7567 | } else { | 7567 | } else { |
7568 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7568 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7569 | &dev->i2c_adap, NULL, "tuner", | 7569 | &dev->i2c_adap, "tuner", |
7570 | dev->tuner_addr, NULL); | 7570 | dev->tuner_addr, NULL); |
7571 | } | 7571 | } |
7572 | } | 7572 | } |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 764d7d219fed..756a27812260 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -991,7 +991,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
991 | if (card_is_empress(dev)) { | 991 | if (card_is_empress(dev)) { |
992 | struct v4l2_subdev *sd = | 992 | struct v4l2_subdev *sd = |
993 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 993 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
994 | NULL, "saa6752hs", | 994 | "saa6752hs", |
995 | saa7134_boards[dev->board].empress_addr, NULL); | 995 | saa7134_boards[dev->board].empress_addr, NULL); |
996 | 996 | ||
997 | if (sd) | 997 | if (sd) |
@@ -1002,7 +1002,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1002 | struct v4l2_subdev *sd; | 1002 | struct v4l2_subdev *sd; |
1003 | 1003 | ||
1004 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1004 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1005 | &dev->i2c_adap, NULL, "saa6588", | 1005 | &dev->i2c_adap, "saa6588", |
1006 | 0, I2C_ADDRS(saa7134_boards[dev->board].rds_addr)); | 1006 | 0, I2C_ADDRS(saa7134_boards[dev->board].rds_addr)); |
1007 | if (sd) { | 1007 | if (sd) { |
1008 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); | 1008 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 5c209afb0ac8..2486520582f2 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -1980,7 +1980,7 @@ static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev) | |||
1980 | * we complete the completion. | 1980 | * we complete the completion. |
1981 | */ | 1981 | */ |
1982 | 1982 | ||
1983 | if (!csi2->driver || !csi2->driver->owner) { | 1983 | if (!csi2->driver) { |
1984 | complete(&wait.completion); | 1984 | complete(&wait.completion); |
1985 | /* Either too late, or probing failed */ | 1985 | /* Either too late, or probing failed */ |
1986 | bus_unregister_notifier(&platform_bus_type, &wait.notifier); | 1986 | bus_unregister_notifier(&platform_bus_type, &wait.notifier); |
diff --git a/drivers/media/video/sh_vou.c b/drivers/media/video/sh_vou.c index 0f4906136b8f..07cf0c6c7c1f 100644 --- a/drivers/media/video/sh_vou.c +++ b/drivers/media/video/sh_vou.c | |||
@@ -75,6 +75,7 @@ struct sh_vou_device { | |||
75 | int pix_idx; | 75 | int pix_idx; |
76 | struct videobuf_buffer *active; | 76 | struct videobuf_buffer *active; |
77 | enum sh_vou_status status; | 77 | enum sh_vou_status status; |
78 | struct mutex fop_lock; | ||
78 | }; | 79 | }; |
79 | 80 | ||
80 | struct sh_vou_file { | 81 | struct sh_vou_file { |
@@ -235,7 +236,7 @@ static void free_buffer(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
235 | vb->state = VIDEOBUF_NEEDS_INIT; | 236 | vb->state = VIDEOBUF_NEEDS_INIT; |
236 | } | 237 | } |
237 | 238 | ||
238 | /* Locking: caller holds vq->vb_lock mutex */ | 239 | /* Locking: caller holds fop_lock mutex */ |
239 | static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count, | 240 | static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count, |
240 | unsigned int *size) | 241 | unsigned int *size) |
241 | { | 242 | { |
@@ -257,7 +258,7 @@ static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
257 | return 0; | 258 | return 0; |
258 | } | 259 | } |
259 | 260 | ||
260 | /* Locking: caller holds vq->vb_lock mutex */ | 261 | /* Locking: caller holds fop_lock mutex */ |
261 | static int sh_vou_buf_prepare(struct videobuf_queue *vq, | 262 | static int sh_vou_buf_prepare(struct videobuf_queue *vq, |
262 | struct videobuf_buffer *vb, | 263 | struct videobuf_buffer *vb, |
263 | enum v4l2_field field) | 264 | enum v4l2_field field) |
@@ -306,7 +307,7 @@ static int sh_vou_buf_prepare(struct videobuf_queue *vq, | |||
306 | return 0; | 307 | return 0; |
307 | } | 308 | } |
308 | 309 | ||
309 | /* Locking: caller holds vq->vb_lock mutex and vq->irqlock spinlock */ | 310 | /* Locking: caller holds fop_lock mutex and vq->irqlock spinlock */ |
310 | static void sh_vou_buf_queue(struct videobuf_queue *vq, | 311 | static void sh_vou_buf_queue(struct videobuf_queue *vq, |
311 | struct videobuf_buffer *vb) | 312 | struct videobuf_buffer *vb) |
312 | { | 313 | { |
@@ -1190,7 +1191,7 @@ static int sh_vou_open(struct file *file) | |||
1190 | V4L2_BUF_TYPE_VIDEO_OUTPUT, | 1191 | V4L2_BUF_TYPE_VIDEO_OUTPUT, |
1191 | V4L2_FIELD_NONE, | 1192 | V4L2_FIELD_NONE, |
1192 | sizeof(struct videobuf_buffer), vdev, | 1193 | sizeof(struct videobuf_buffer), vdev, |
1193 | NULL); | 1194 | &vou_dev->fop_lock); |
1194 | 1195 | ||
1195 | return 0; | 1196 | return 0; |
1196 | } | 1197 | } |
@@ -1292,7 +1293,7 @@ static const struct v4l2_file_operations sh_vou_fops = { | |||
1292 | .owner = THIS_MODULE, | 1293 | .owner = THIS_MODULE, |
1293 | .open = sh_vou_open, | 1294 | .open = sh_vou_open, |
1294 | .release = sh_vou_release, | 1295 | .release = sh_vou_release, |
1295 | .ioctl = video_ioctl2, | 1296 | .unlocked_ioctl = video_ioctl2, |
1296 | .mmap = sh_vou_mmap, | 1297 | .mmap = sh_vou_mmap, |
1297 | .poll = sh_vou_poll, | 1298 | .poll = sh_vou_poll, |
1298 | }; | 1299 | }; |
@@ -1331,6 +1332,7 @@ static int __devinit sh_vou_probe(struct platform_device *pdev) | |||
1331 | 1332 | ||
1332 | INIT_LIST_HEAD(&vou_dev->queue); | 1333 | INIT_LIST_HEAD(&vou_dev->queue); |
1333 | spin_lock_init(&vou_dev->lock); | 1334 | spin_lock_init(&vou_dev->lock); |
1335 | mutex_init(&vou_dev->fop_lock); | ||
1334 | atomic_set(&vou_dev->use_count, 0); | 1336 | atomic_set(&vou_dev->use_count, 0); |
1335 | vou_dev->pdata = vou_pdata; | 1337 | vou_dev->pdata = vou_pdata; |
1336 | vou_dev->status = SH_VOU_IDLE; | 1338 | vou_dev->status = SH_VOU_IDLE; |
@@ -1388,6 +1390,7 @@ static int __devinit sh_vou_probe(struct platform_device *pdev) | |||
1388 | vdev->tvnorms |= V4L2_STD_PAL; | 1390 | vdev->tvnorms |= V4L2_STD_PAL; |
1389 | vdev->v4l2_dev = &vou_dev->v4l2_dev; | 1391 | vdev->v4l2_dev = &vou_dev->v4l2_dev; |
1390 | vdev->release = video_device_release; | 1392 | vdev->release = video_device_release; |
1393 | vdev->lock = &vou_dev->fop_lock; | ||
1391 | 1394 | ||
1392 | vou_dev->vdev = vdev; | 1395 | vou_dev->vdev = vdev; |
1393 | video_set_drvdata(vdev, vou_dev); | 1396 | video_set_drvdata(vdev, vou_dev); |
@@ -1406,7 +1409,7 @@ static int __devinit sh_vou_probe(struct platform_device *pdev) | |||
1406 | goto ereset; | 1409 | goto ereset; |
1407 | 1410 | ||
1408 | subdev = v4l2_i2c_new_subdev_board(&vou_dev->v4l2_dev, i2c_adap, | 1411 | subdev = v4l2_i2c_new_subdev_board(&vou_dev->v4l2_dev, i2c_adap, |
1409 | NULL, vou_pdata->board_info, NULL); | 1412 | vou_pdata->board_info, NULL); |
1410 | if (!subdev) { | 1413 | if (!subdev) { |
1411 | ret = -ENOMEM; | 1414 | ret = -ENOMEM; |
1412 | goto ei2cnd; | 1415 | goto ei2cnd; |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 28e19daadec9..f49fbfb7dc13 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -3238,7 +3238,7 @@ static const struct v4l2_file_operations sn9c102_fops = { | |||
3238 | .owner = THIS_MODULE, | 3238 | .owner = THIS_MODULE, |
3239 | .open = sn9c102_open, | 3239 | .open = sn9c102_open, |
3240 | .release = sn9c102_release, | 3240 | .release = sn9c102_release, |
3241 | .ioctl = sn9c102_ioctl, | 3241 | .unlocked_ioctl = sn9c102_ioctl, |
3242 | .read = sn9c102_read, | 3242 | .read = sn9c102_read, |
3243 | .poll = sn9c102_poll, | 3243 | .poll = sn9c102_poll, |
3244 | .mmap = sn9c102_mmap, | 3244 | .mmap = sn9c102_mmap, |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 43848a751d11..052bd6dfa5a7 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -405,13 +405,13 @@ static int soc_camera_open(struct file *file) | |||
405 | ret = soc_camera_set_fmt(icd, &f); | 405 | ret = soc_camera_set_fmt(icd, &f); |
406 | if (ret < 0) | 406 | if (ret < 0) |
407 | goto esfmt; | 407 | goto esfmt; |
408 | |||
409 | ici->ops->init_videobuf(&icd->vb_vidq, icd); | ||
408 | } | 410 | } |
409 | 411 | ||
410 | file->private_data = icd; | 412 | file->private_data = icd; |
411 | dev_dbg(&icd->dev, "camera device open\n"); | 413 | dev_dbg(&icd->dev, "camera device open\n"); |
412 | 414 | ||
413 | ici->ops->init_videobuf(&icd->vb_vidq, icd); | ||
414 | |||
415 | mutex_unlock(&icd->video_lock); | 415 | mutex_unlock(&icd->video_lock); |
416 | 416 | ||
417 | return 0; | 417 | return 0; |
@@ -896,7 +896,7 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd, | |||
896 | icl->board_info->platform_data = icd; | 896 | icl->board_info->platform_data = icd; |
897 | 897 | ||
898 | subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, | 898 | subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, |
899 | NULL, icl->board_info, NULL); | 899 | icl->board_info, NULL); |
900 | if (!subdev) | 900 | if (!subdev) |
901 | goto ei2cnd; | 901 | goto ei2cnd; |
902 | 902 | ||
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index e3bbae26e3ce..81dd53bb5267 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -251,7 +251,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
251 | hit-and-miss. */ | 251 | hit-and-miss. */ |
252 | mdelay(10); | 252 | mdelay(10); |
253 | v4l2_i2c_new_subdev(&usbvision->v4l2_dev, | 253 | v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
254 | &usbvision->i2c_adap, NULL, | 254 | &usbvision->i2c_adap, |
255 | "saa7115_auto", 0, saa711x_addrs); | 255 | "saa7115_auto", 0, saa711x_addrs); |
256 | break; | 256 | break; |
257 | } | 257 | } |
@@ -261,14 +261,14 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
261 | struct tuner_setup tun_setup; | 261 | struct tuner_setup tun_setup; |
262 | 262 | ||
263 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, | 263 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
264 | &usbvision->i2c_adap, NULL, | 264 | &usbvision->i2c_adap, |
265 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 265 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
266 | /* depending on whether we found a demod or not, select | 266 | /* depending on whether we found a demod or not, select |
267 | the tuner type. */ | 267 | the tuner type. */ |
268 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 268 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
269 | 269 | ||
270 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, | 270 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
271 | &usbvision->i2c_adap, NULL, | 271 | &usbvision->i2c_adap, |
272 | "tuner", 0, v4l2_i2c_tuner_addrs(type)); | 272 | "tuner", 0, v4l2_i2c_tuner_addrs(type)); |
273 | 273 | ||
274 | if (sd == NULL) | 274 | if (sd == NULL) |
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index f169f7736677..59f8a9ad3796 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c | |||
@@ -785,7 +785,7 @@ static void __uvc_find_control(struct uvc_entity *entity, __u32 v4l2_id, | |||
785 | } | 785 | } |
786 | } | 786 | } |
787 | 787 | ||
788 | struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, | 788 | static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, |
789 | __u32 v4l2_id, struct uvc_control_mapping **mapping) | 789 | __u32 v4l2_id, struct uvc_control_mapping **mapping) |
790 | { | 790 | { |
791 | struct uvc_control *ctrl = NULL; | 791 | struct uvc_control *ctrl = NULL; |
@@ -944,6 +944,52 @@ done: | |||
944 | return ret; | 944 | return ret; |
945 | } | 945 | } |
946 | 946 | ||
947 | /* | ||
948 | * Mapping V4L2 controls to UVC controls can be straighforward if done well. | ||
949 | * Most of the UVC controls exist in V4L2, and can be mapped directly. Some | ||
950 | * must be grouped (for instance the Red Balance, Blue Balance and Do White | ||
951 | * Balance V4L2 controls use the White Balance Component UVC control) or | ||
952 | * otherwise translated. The approach we take here is to use a translation | ||
953 | * table for the controls that can be mapped directly, and handle the others | ||
954 | * manually. | ||
955 | */ | ||
956 | int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | ||
957 | struct v4l2_querymenu *query_menu) | ||
958 | { | ||
959 | struct uvc_menu_info *menu_info; | ||
960 | struct uvc_control_mapping *mapping; | ||
961 | struct uvc_control *ctrl; | ||
962 | u32 index = query_menu->index; | ||
963 | u32 id = query_menu->id; | ||
964 | int ret; | ||
965 | |||
966 | memset(query_menu, 0, sizeof(*query_menu)); | ||
967 | query_menu->id = id; | ||
968 | query_menu->index = index; | ||
969 | |||
970 | ret = mutex_lock_interruptible(&chain->ctrl_mutex); | ||
971 | if (ret < 0) | ||
972 | return -ERESTARTSYS; | ||
973 | |||
974 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); | ||
975 | if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) { | ||
976 | ret = -EINVAL; | ||
977 | goto done; | ||
978 | } | ||
979 | |||
980 | if (query_menu->index >= mapping->menu_count) { | ||
981 | ret = -EINVAL; | ||
982 | goto done; | ||
983 | } | ||
984 | |||
985 | menu_info = &mapping->menu_info[query_menu->index]; | ||
986 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); | ||
987 | |||
988 | done: | ||
989 | mutex_unlock(&chain->ctrl_mutex); | ||
990 | return ret; | ||
991 | } | ||
992 | |||
947 | 993 | ||
948 | /* -------------------------------------------------------------------------- | 994 | /* -------------------------------------------------------------------------- |
949 | * Control transactions | 995 | * Control transactions |
diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index ed6d5449741c..f14581bd707f 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c | |||
@@ -90,6 +90,39 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, | |||
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Free the video buffers. | ||
94 | * | ||
95 | * This function must be called with the queue lock held. | ||
96 | */ | ||
97 | static int __uvc_free_buffers(struct uvc_video_queue *queue) | ||
98 | { | ||
99 | unsigned int i; | ||
100 | |||
101 | for (i = 0; i < queue->count; ++i) { | ||
102 | if (queue->buffer[i].vma_use_count != 0) | ||
103 | return -EBUSY; | ||
104 | } | ||
105 | |||
106 | if (queue->count) { | ||
107 | vfree(queue->mem); | ||
108 | queue->count = 0; | ||
109 | } | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | int uvc_free_buffers(struct uvc_video_queue *queue) | ||
115 | { | ||
116 | int ret; | ||
117 | |||
118 | mutex_lock(&queue->mutex); | ||
119 | ret = __uvc_free_buffers(queue); | ||
120 | mutex_unlock(&queue->mutex); | ||
121 | |||
122 | return ret; | ||
123 | } | ||
124 | |||
125 | /* | ||
93 | * Allocate the video buffers. | 126 | * Allocate the video buffers. |
94 | * | 127 | * |
95 | * Pages are reserved to make sure they will not be swapped, as they will be | 128 | * Pages are reserved to make sure they will not be swapped, as they will be |
@@ -110,7 +143,7 @@ int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, | |||
110 | 143 | ||
111 | mutex_lock(&queue->mutex); | 144 | mutex_lock(&queue->mutex); |
112 | 145 | ||
113 | if ((ret = uvc_free_buffers(queue)) < 0) | 146 | if ((ret = __uvc_free_buffers(queue)) < 0) |
114 | goto done; | 147 | goto done; |
115 | 148 | ||
116 | /* Bail out if no buffers should be allocated. */ | 149 | /* Bail out if no buffers should be allocated. */ |
@@ -152,28 +185,6 @@ done: | |||
152 | } | 185 | } |
153 | 186 | ||
154 | /* | 187 | /* |
155 | * Free the video buffers. | ||
156 | * | ||
157 | * This function must be called with the queue lock held. | ||
158 | */ | ||
159 | int uvc_free_buffers(struct uvc_video_queue *queue) | ||
160 | { | ||
161 | unsigned int i; | ||
162 | |||
163 | for (i = 0; i < queue->count; ++i) { | ||
164 | if (queue->buffer[i].vma_use_count != 0) | ||
165 | return -EBUSY; | ||
166 | } | ||
167 | |||
168 | if (queue->count) { | ||
169 | vfree(queue->mem); | ||
170 | queue->count = 0; | ||
171 | } | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * Check if buffers have been allocated. | 188 | * Check if buffers have been allocated. |
178 | */ | 189 | */ |
179 | int uvc_queue_allocated(struct uvc_video_queue *queue) | 190 | int uvc_queue_allocated(struct uvc_video_queue *queue) |
@@ -369,6 +380,82 @@ done: | |||
369 | } | 380 | } |
370 | 381 | ||
371 | /* | 382 | /* |
383 | * VMA operations. | ||
384 | */ | ||
385 | static void uvc_vm_open(struct vm_area_struct *vma) | ||
386 | { | ||
387 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
388 | buffer->vma_use_count++; | ||
389 | } | ||
390 | |||
391 | static void uvc_vm_close(struct vm_area_struct *vma) | ||
392 | { | ||
393 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
394 | buffer->vma_use_count--; | ||
395 | } | ||
396 | |||
397 | static const struct vm_operations_struct uvc_vm_ops = { | ||
398 | .open = uvc_vm_open, | ||
399 | .close = uvc_vm_close, | ||
400 | }; | ||
401 | |||
402 | /* | ||
403 | * Memory-map a video buffer. | ||
404 | * | ||
405 | * This function implements video buffers memory mapping and is intended to be | ||
406 | * used by the device mmap handler. | ||
407 | */ | ||
408 | int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) | ||
409 | { | ||
410 | struct uvc_buffer *uninitialized_var(buffer); | ||
411 | struct page *page; | ||
412 | unsigned long addr, start, size; | ||
413 | unsigned int i; | ||
414 | int ret = 0; | ||
415 | |||
416 | start = vma->vm_start; | ||
417 | size = vma->vm_end - vma->vm_start; | ||
418 | |||
419 | mutex_lock(&queue->mutex); | ||
420 | |||
421 | for (i = 0; i < queue->count; ++i) { | ||
422 | buffer = &queue->buffer[i]; | ||
423 | if ((buffer->buf.m.offset >> PAGE_SHIFT) == vma->vm_pgoff) | ||
424 | break; | ||
425 | } | ||
426 | |||
427 | if (i == queue->count || size != queue->buf_size) { | ||
428 | ret = -EINVAL; | ||
429 | goto done; | ||
430 | } | ||
431 | |||
432 | /* | ||
433 | * VM_IO marks the area as being an mmaped region for I/O to a | ||
434 | * device. It also prevents the region from being core dumped. | ||
435 | */ | ||
436 | vma->vm_flags |= VM_IO; | ||
437 | |||
438 | addr = (unsigned long)queue->mem + buffer->buf.m.offset; | ||
439 | while (size > 0) { | ||
440 | page = vmalloc_to_page((void *)addr); | ||
441 | if ((ret = vm_insert_page(vma, start, page)) < 0) | ||
442 | goto done; | ||
443 | |||
444 | start += PAGE_SIZE; | ||
445 | addr += PAGE_SIZE; | ||
446 | size -= PAGE_SIZE; | ||
447 | } | ||
448 | |||
449 | vma->vm_ops = &uvc_vm_ops; | ||
450 | vma->vm_private_data = buffer; | ||
451 | uvc_vm_open(vma); | ||
452 | |||
453 | done: | ||
454 | mutex_unlock(&queue->mutex); | ||
455 | return ret; | ||
456 | } | ||
457 | |||
458 | /* | ||
372 | * Poll the video queue. | 459 | * Poll the video queue. |
373 | * | 460 | * |
374 | * This function implements video queue polling and is intended to be used by | 461 | * This function implements video queue polling and is intended to be used by |
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 6d15de9b5204..8cf61e8a634f 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c | |||
@@ -101,40 +101,6 @@ done: | |||
101 | */ | 101 | */ |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Mapping V4L2 controls to UVC controls can be straighforward if done well. | ||
105 | * Most of the UVC controls exist in V4L2, and can be mapped directly. Some | ||
106 | * must be grouped (for instance the Red Balance, Blue Balance and Do White | ||
107 | * Balance V4L2 controls use the White Balance Component UVC control) or | ||
108 | * otherwise translated. The approach we take here is to use a translation | ||
109 | * table for the controls that can be mapped directly, and handle the others | ||
110 | * manually. | ||
111 | */ | ||
112 | static int uvc_v4l2_query_menu(struct uvc_video_chain *chain, | ||
113 | struct v4l2_querymenu *query_menu) | ||
114 | { | ||
115 | struct uvc_menu_info *menu_info; | ||
116 | struct uvc_control_mapping *mapping; | ||
117 | struct uvc_control *ctrl; | ||
118 | u32 index = query_menu->index; | ||
119 | u32 id = query_menu->id; | ||
120 | |||
121 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); | ||
122 | if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) | ||
123 | return -EINVAL; | ||
124 | |||
125 | if (query_menu->index >= mapping->menu_count) | ||
126 | return -EINVAL; | ||
127 | |||
128 | memset(query_menu, 0, sizeof(*query_menu)); | ||
129 | query_menu->id = id; | ||
130 | query_menu->index = index; | ||
131 | |||
132 | menu_info = &mapping->menu_info[query_menu->index]; | ||
133 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * Find the frame interval closest to the requested frame interval for the | 104 | * Find the frame interval closest to the requested frame interval for the |
139 | * given frame format and size. This should be done by the device as part of | 105 | * given frame format and size. This should be done by the device as part of |
140 | * the Video Probe and Commit negotiation, but some hardware don't implement | 106 | * the Video Probe and Commit negotiation, but some hardware don't implement |
@@ -260,12 +226,14 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, | |||
260 | * developers test their webcams with the Linux driver as well as with | 226 | * developers test their webcams with the Linux driver as well as with |
261 | * the Windows driver). | 227 | * the Windows driver). |
262 | */ | 228 | */ |
229 | mutex_lock(&stream->mutex); | ||
263 | if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) | 230 | if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) |
264 | probe->dwMaxVideoFrameSize = | 231 | probe->dwMaxVideoFrameSize = |
265 | stream->ctrl.dwMaxVideoFrameSize; | 232 | stream->ctrl.dwMaxVideoFrameSize; |
266 | 233 | ||
267 | /* Probe the device. */ | 234 | /* Probe the device. */ |
268 | ret = uvc_probe_video(stream, probe); | 235 | ret = uvc_probe_video(stream, probe); |
236 | mutex_unlock(&stream->mutex); | ||
269 | if (ret < 0) | 237 | if (ret < 0) |
270 | goto done; | 238 | goto done; |
271 | 239 | ||
@@ -289,14 +257,21 @@ done: | |||
289 | static int uvc_v4l2_get_format(struct uvc_streaming *stream, | 257 | static int uvc_v4l2_get_format(struct uvc_streaming *stream, |
290 | struct v4l2_format *fmt) | 258 | struct v4l2_format *fmt) |
291 | { | 259 | { |
292 | struct uvc_format *format = stream->cur_format; | 260 | struct uvc_format *format; |
293 | struct uvc_frame *frame = stream->cur_frame; | 261 | struct uvc_frame *frame; |
262 | int ret = 0; | ||
294 | 263 | ||
295 | if (fmt->type != stream->type) | 264 | if (fmt->type != stream->type) |
296 | return -EINVAL; | 265 | return -EINVAL; |
297 | 266 | ||
298 | if (format == NULL || frame == NULL) | 267 | mutex_lock(&stream->mutex); |
299 | return -EINVAL; | 268 | format = stream->cur_format; |
269 | frame = stream->cur_frame; | ||
270 | |||
271 | if (format == NULL || frame == NULL) { | ||
272 | ret = -EINVAL; | ||
273 | goto done; | ||
274 | } | ||
300 | 275 | ||
301 | fmt->fmt.pix.pixelformat = format->fcc; | 276 | fmt->fmt.pix.pixelformat = format->fcc; |
302 | fmt->fmt.pix.width = frame->wWidth; | 277 | fmt->fmt.pix.width = frame->wWidth; |
@@ -307,7 +282,9 @@ static int uvc_v4l2_get_format(struct uvc_streaming *stream, | |||
307 | fmt->fmt.pix.colorspace = format->colorspace; | 282 | fmt->fmt.pix.colorspace = format->colorspace; |
308 | fmt->fmt.pix.priv = 0; | 283 | fmt->fmt.pix.priv = 0; |
309 | 284 | ||
310 | return 0; | 285 | done: |
286 | mutex_unlock(&stream->mutex); | ||
287 | return ret; | ||
311 | } | 288 | } |
312 | 289 | ||
313 | static int uvc_v4l2_set_format(struct uvc_streaming *stream, | 290 | static int uvc_v4l2_set_format(struct uvc_streaming *stream, |
@@ -321,18 +298,24 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream, | |||
321 | if (fmt->type != stream->type) | 298 | if (fmt->type != stream->type) |
322 | return -EINVAL; | 299 | return -EINVAL; |
323 | 300 | ||
324 | if (uvc_queue_allocated(&stream->queue)) | ||
325 | return -EBUSY; | ||
326 | |||
327 | ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); | 301 | ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); |
328 | if (ret < 0) | 302 | if (ret < 0) |
329 | return ret; | 303 | return ret; |
330 | 304 | ||
305 | mutex_lock(&stream->mutex); | ||
306 | |||
307 | if (uvc_queue_allocated(&stream->queue)) { | ||
308 | ret = -EBUSY; | ||
309 | goto done; | ||
310 | } | ||
311 | |||
331 | memcpy(&stream->ctrl, &probe, sizeof probe); | 312 | memcpy(&stream->ctrl, &probe, sizeof probe); |
332 | stream->cur_format = format; | 313 | stream->cur_format = format; |
333 | stream->cur_frame = frame; | 314 | stream->cur_frame = frame; |
334 | 315 | ||
335 | return 0; | 316 | done: |
317 | mutex_unlock(&stream->mutex); | ||
318 | return ret; | ||
336 | } | 319 | } |
337 | 320 | ||
338 | static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, | 321 | static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, |
@@ -343,7 +326,10 @@ static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, | |||
343 | if (parm->type != stream->type) | 326 | if (parm->type != stream->type) |
344 | return -EINVAL; | 327 | return -EINVAL; |
345 | 328 | ||
329 | mutex_lock(&stream->mutex); | ||
346 | numerator = stream->ctrl.dwFrameInterval; | 330 | numerator = stream->ctrl.dwFrameInterval; |
331 | mutex_unlock(&stream->mutex); | ||
332 | |||
347 | denominator = 10000000; | 333 | denominator = 10000000; |
348 | uvc_simplify_fraction(&numerator, &denominator, 8, 333); | 334 | uvc_simplify_fraction(&numerator, &denominator, 8, 333); |
349 | 335 | ||
@@ -370,7 +356,6 @@ static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, | |||
370 | static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, | 356 | static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, |
371 | struct v4l2_streamparm *parm) | 357 | struct v4l2_streamparm *parm) |
372 | { | 358 | { |
373 | struct uvc_frame *frame = stream->cur_frame; | ||
374 | struct uvc_streaming_control probe; | 359 | struct uvc_streaming_control probe; |
375 | struct v4l2_fract timeperframe; | 360 | struct v4l2_fract timeperframe; |
376 | uint32_t interval; | 361 | uint32_t interval; |
@@ -379,28 +364,36 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, | |||
379 | if (parm->type != stream->type) | 364 | if (parm->type != stream->type) |
380 | return -EINVAL; | 365 | return -EINVAL; |
381 | 366 | ||
382 | if (uvc_queue_streaming(&stream->queue)) | ||
383 | return -EBUSY; | ||
384 | |||
385 | if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | 367 | if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
386 | timeperframe = parm->parm.capture.timeperframe; | 368 | timeperframe = parm->parm.capture.timeperframe; |
387 | else | 369 | else |
388 | timeperframe = parm->parm.output.timeperframe; | 370 | timeperframe = parm->parm.output.timeperframe; |
389 | 371 | ||
390 | memcpy(&probe, &stream->ctrl, sizeof probe); | ||
391 | interval = uvc_fraction_to_interval(timeperframe.numerator, | 372 | interval = uvc_fraction_to_interval(timeperframe.numerator, |
392 | timeperframe.denominator); | 373 | timeperframe.denominator); |
393 | |||
394 | uvc_trace(UVC_TRACE_FORMAT, "Setting frame interval to %u/%u (%u).\n", | 374 | uvc_trace(UVC_TRACE_FORMAT, "Setting frame interval to %u/%u (%u).\n", |
395 | timeperframe.numerator, timeperframe.denominator, interval); | 375 | timeperframe.numerator, timeperframe.denominator, interval); |
396 | probe.dwFrameInterval = uvc_try_frame_interval(frame, interval); | 376 | |
377 | mutex_lock(&stream->mutex); | ||
378 | |||
379 | if (uvc_queue_streaming(&stream->queue)) { | ||
380 | mutex_unlock(&stream->mutex); | ||
381 | return -EBUSY; | ||
382 | } | ||
383 | |||
384 | memcpy(&probe, &stream->ctrl, sizeof probe); | ||
385 | probe.dwFrameInterval = | ||
386 | uvc_try_frame_interval(stream->cur_frame, interval); | ||
397 | 387 | ||
398 | /* Probe the device with the new settings. */ | 388 | /* Probe the device with the new settings. */ |
399 | ret = uvc_probe_video(stream, &probe); | 389 | ret = uvc_probe_video(stream, &probe); |
400 | if (ret < 0) | 390 | if (ret < 0) { |
391 | mutex_unlock(&stream->mutex); | ||
401 | return ret; | 392 | return ret; |
393 | } | ||
402 | 394 | ||
403 | memcpy(&stream->ctrl, &probe, sizeof probe); | 395 | memcpy(&stream->ctrl, &probe, sizeof probe); |
396 | mutex_unlock(&stream->mutex); | ||
404 | 397 | ||
405 | /* Return the actual frame period. */ | 398 | /* Return the actual frame period. */ |
406 | timeperframe.numerator = probe.dwFrameInterval; | 399 | timeperframe.numerator = probe.dwFrameInterval; |
@@ -528,11 +521,9 @@ static int uvc_v4l2_release(struct file *file) | |||
528 | if (uvc_has_privileges(handle)) { | 521 | if (uvc_has_privileges(handle)) { |
529 | uvc_video_enable(stream, 0); | 522 | uvc_video_enable(stream, 0); |
530 | 523 | ||
531 | mutex_lock(&stream->queue.mutex); | ||
532 | if (uvc_free_buffers(&stream->queue) < 0) | 524 | if (uvc_free_buffers(&stream->queue) < 0) |
533 | uvc_printk(KERN_ERR, "uvc_v4l2_release: Unable to " | 525 | uvc_printk(KERN_ERR, "uvc_v4l2_release: Unable to " |
534 | "free buffers.\n"); | 526 | "free buffers.\n"); |
535 | mutex_unlock(&stream->queue.mutex); | ||
536 | } | 527 | } |
537 | 528 | ||
538 | /* Release the file handle. */ | 529 | /* Release the file handle. */ |
@@ -624,7 +615,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
624 | } | 615 | } |
625 | 616 | ||
626 | case VIDIOC_QUERYMENU: | 617 | case VIDIOC_QUERYMENU: |
627 | return uvc_v4l2_query_menu(chain, arg); | 618 | return uvc_query_v4l2_menu(chain, arg); |
628 | 619 | ||
629 | case VIDIOC_G_EXT_CTRLS: | 620 | case VIDIOC_G_EXT_CTRLS: |
630 | { | 621 | { |
@@ -905,15 +896,17 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
905 | case VIDIOC_CROPCAP: | 896 | case VIDIOC_CROPCAP: |
906 | { | 897 | { |
907 | struct v4l2_cropcap *ccap = arg; | 898 | struct v4l2_cropcap *ccap = arg; |
908 | struct uvc_frame *frame = stream->cur_frame; | ||
909 | 899 | ||
910 | if (ccap->type != stream->type) | 900 | if (ccap->type != stream->type) |
911 | return -EINVAL; | 901 | return -EINVAL; |
912 | 902 | ||
913 | ccap->bounds.left = 0; | 903 | ccap->bounds.left = 0; |
914 | ccap->bounds.top = 0; | 904 | ccap->bounds.top = 0; |
915 | ccap->bounds.width = frame->wWidth; | 905 | |
916 | ccap->bounds.height = frame->wHeight; | 906 | mutex_lock(&stream->mutex); |
907 | ccap->bounds.width = stream->cur_frame->wWidth; | ||
908 | ccap->bounds.height = stream->cur_frame->wHeight; | ||
909 | mutex_unlock(&stream->mutex); | ||
917 | 910 | ||
918 | ccap->defrect = ccap->bounds; | 911 | ccap->defrect = ccap->bounds; |
919 | 912 | ||
@@ -930,8 +923,6 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
930 | case VIDIOC_REQBUFS: | 923 | case VIDIOC_REQBUFS: |
931 | { | 924 | { |
932 | struct v4l2_requestbuffers *rb = arg; | 925 | struct v4l2_requestbuffers *rb = arg; |
933 | unsigned int bufsize = | ||
934 | stream->ctrl.dwMaxVideoFrameSize; | ||
935 | 926 | ||
936 | if (rb->type != stream->type || | 927 | if (rb->type != stream->type || |
937 | rb->memory != V4L2_MEMORY_MMAP) | 928 | rb->memory != V4L2_MEMORY_MMAP) |
@@ -940,7 +931,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
940 | if ((ret = uvc_acquire_privileges(handle)) < 0) | 931 | if ((ret = uvc_acquire_privileges(handle)) < 0) |
941 | return ret; | 932 | return ret; |
942 | 933 | ||
943 | ret = uvc_alloc_buffers(&stream->queue, rb->count, bufsize); | 934 | mutex_lock(&stream->mutex); |
935 | ret = uvc_alloc_buffers(&stream->queue, rb->count, | ||
936 | stream->ctrl.dwMaxVideoFrameSize); | ||
937 | mutex_unlock(&stream->mutex); | ||
944 | if (ret < 0) | 938 | if (ret < 0) |
945 | return ret; | 939 | return ret; |
946 | 940 | ||
@@ -988,7 +982,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
988 | if (!uvc_has_privileges(handle)) | 982 | if (!uvc_has_privileges(handle)) |
989 | return -EBUSY; | 983 | return -EBUSY; |
990 | 984 | ||
985 | mutex_lock(&stream->mutex); | ||
991 | ret = uvc_video_enable(stream, 1); | 986 | ret = uvc_video_enable(stream, 1); |
987 | mutex_unlock(&stream->mutex); | ||
992 | if (ret < 0) | 988 | if (ret < 0) |
993 | return ret; | 989 | return ret; |
994 | break; | 990 | break; |
@@ -1068,79 +1064,14 @@ static ssize_t uvc_v4l2_read(struct file *file, char __user *data, | |||
1068 | return -EINVAL; | 1064 | return -EINVAL; |
1069 | } | 1065 | } |
1070 | 1066 | ||
1071 | /* | ||
1072 | * VMA operations. | ||
1073 | */ | ||
1074 | static void uvc_vm_open(struct vm_area_struct *vma) | ||
1075 | { | ||
1076 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
1077 | buffer->vma_use_count++; | ||
1078 | } | ||
1079 | |||
1080 | static void uvc_vm_close(struct vm_area_struct *vma) | ||
1081 | { | ||
1082 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
1083 | buffer->vma_use_count--; | ||
1084 | } | ||
1085 | |||
1086 | static const struct vm_operations_struct uvc_vm_ops = { | ||
1087 | .open = uvc_vm_open, | ||
1088 | .close = uvc_vm_close, | ||
1089 | }; | ||
1090 | |||
1091 | static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | 1067 | static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma) |
1092 | { | 1068 | { |
1093 | struct uvc_fh *handle = file->private_data; | 1069 | struct uvc_fh *handle = file->private_data; |
1094 | struct uvc_streaming *stream = handle->stream; | 1070 | struct uvc_streaming *stream = handle->stream; |
1095 | struct uvc_video_queue *queue = &stream->queue; | ||
1096 | struct uvc_buffer *uninitialized_var(buffer); | ||
1097 | struct page *page; | ||
1098 | unsigned long addr, start, size; | ||
1099 | unsigned int i; | ||
1100 | int ret = 0; | ||
1101 | 1071 | ||
1102 | uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_mmap\n"); | 1072 | uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_mmap\n"); |
1103 | 1073 | ||
1104 | start = vma->vm_start; | 1074 | return uvc_queue_mmap(&stream->queue, vma); |
1105 | size = vma->vm_end - vma->vm_start; | ||
1106 | |||
1107 | mutex_lock(&queue->mutex); | ||
1108 | |||
1109 | for (i = 0; i < queue->count; ++i) { | ||
1110 | buffer = &queue->buffer[i]; | ||
1111 | if ((buffer->buf.m.offset >> PAGE_SHIFT) == vma->vm_pgoff) | ||
1112 | break; | ||
1113 | } | ||
1114 | |||
1115 | if (i == queue->count || size != queue->buf_size) { | ||
1116 | ret = -EINVAL; | ||
1117 | goto done; | ||
1118 | } | ||
1119 | |||
1120 | /* | ||
1121 | * VM_IO marks the area as being an mmaped region for I/O to a | ||
1122 | * device. It also prevents the region from being core dumped. | ||
1123 | */ | ||
1124 | vma->vm_flags |= VM_IO; | ||
1125 | |||
1126 | addr = (unsigned long)queue->mem + buffer->buf.m.offset; | ||
1127 | while (size > 0) { | ||
1128 | page = vmalloc_to_page((void *)addr); | ||
1129 | if ((ret = vm_insert_page(vma, start, page)) < 0) | ||
1130 | goto done; | ||
1131 | |||
1132 | start += PAGE_SIZE; | ||
1133 | addr += PAGE_SIZE; | ||
1134 | size -= PAGE_SIZE; | ||
1135 | } | ||
1136 | |||
1137 | vma->vm_ops = &uvc_vm_ops; | ||
1138 | vma->vm_private_data = buffer; | ||
1139 | uvc_vm_open(vma); | ||
1140 | |||
1141 | done: | ||
1142 | mutex_unlock(&queue->mutex); | ||
1143 | return ret; | ||
1144 | } | 1075 | } |
1145 | 1076 | ||
1146 | static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait) | 1077 | static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait) |
@@ -1157,7 +1088,7 @@ const struct v4l2_file_operations uvc_fops = { | |||
1157 | .owner = THIS_MODULE, | 1088 | .owner = THIS_MODULE, |
1158 | .open = uvc_v4l2_open, | 1089 | .open = uvc_v4l2_open, |
1159 | .release = uvc_v4l2_release, | 1090 | .release = uvc_v4l2_release, |
1160 | .ioctl = uvc_v4l2_ioctl, | 1091 | .unlocked_ioctl = uvc_v4l2_ioctl, |
1161 | .read = uvc_v4l2_read, | 1092 | .read = uvc_v4l2_read, |
1162 | .mmap = uvc_v4l2_mmap, | 1093 | .mmap = uvc_v4l2_mmap, |
1163 | .poll = uvc_v4l2_poll, | 1094 | .poll = uvc_v4l2_poll, |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 5555f0102838..5673d673504b 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -293,8 +293,6 @@ int uvc_probe_video(struct uvc_streaming *stream, | |||
293 | unsigned int i; | 293 | unsigned int i; |
294 | int ret; | 294 | int ret; |
295 | 295 | ||
296 | mutex_lock(&stream->mutex); | ||
297 | |||
298 | /* Perform probing. The device should adjust the requested values | 296 | /* Perform probing. The device should adjust the requested values |
299 | * according to its capabilities. However, some devices, namely the | 297 | * according to its capabilities. However, some devices, namely the |
300 | * first generation UVC Logitech webcams, don't implement the Video | 298 | * first generation UVC Logitech webcams, don't implement the Video |
@@ -346,7 +344,6 @@ int uvc_probe_video(struct uvc_streaming *stream, | |||
346 | } | 344 | } |
347 | 345 | ||
348 | done: | 346 | done: |
349 | mutex_unlock(&stream->mutex); | ||
350 | return ret; | 347 | return ret; |
351 | } | 348 | } |
352 | 349 | ||
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index d97cf6d6a4f9..45f01e7e13d2 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h | |||
@@ -436,7 +436,9 @@ struct uvc_streaming { | |||
436 | struct uvc_streaming_control ctrl; | 436 | struct uvc_streaming_control ctrl; |
437 | struct uvc_format *cur_format; | 437 | struct uvc_format *cur_format; |
438 | struct uvc_frame *cur_frame; | 438 | struct uvc_frame *cur_frame; |
439 | 439 | /* Protect access to ctrl, cur_format, cur_frame and hardware video | |
440 | * probe control. | ||
441 | */ | ||
440 | struct mutex mutex; | 442 | struct mutex mutex; |
441 | 443 | ||
442 | unsigned int frozen : 1; | 444 | unsigned int frozen : 1; |
@@ -574,6 +576,8 @@ extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable); | |||
574 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); | 576 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); |
575 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | 577 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, |
576 | struct uvc_buffer *buf); | 578 | struct uvc_buffer *buf); |
579 | extern int uvc_queue_mmap(struct uvc_video_queue *queue, | ||
580 | struct vm_area_struct *vma); | ||
577 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, | 581 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, |
578 | struct file *file, poll_table *wait); | 582 | struct file *file, poll_table *wait); |
579 | extern int uvc_queue_allocated(struct uvc_video_queue *queue); | 583 | extern int uvc_queue_allocated(struct uvc_video_queue *queue); |
@@ -606,10 +610,10 @@ extern int uvc_status_suspend(struct uvc_device *dev); | |||
606 | extern int uvc_status_resume(struct uvc_device *dev); | 610 | extern int uvc_status_resume(struct uvc_device *dev); |
607 | 611 | ||
608 | /* Controls */ | 612 | /* Controls */ |
609 | extern struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, | ||
610 | __u32 v4l2_id, struct uvc_control_mapping **mapping); | ||
611 | extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, | 613 | extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, |
612 | struct v4l2_queryctrl *v4l2_ctrl); | 614 | struct v4l2_queryctrl *v4l2_ctrl); |
615 | extern int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | ||
616 | struct v4l2_querymenu *query_menu); | ||
613 | 617 | ||
614 | extern int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, | 618 | extern int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, |
615 | const struct uvc_control_mapping *mapping); | 619 | const struct uvc_control_mapping *mapping); |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 9294282b5add..b5eb1f3950b1 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -368,18 +368,15 @@ EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); | |||
368 | 368 | ||
369 | /* Load an i2c sub-device. */ | 369 | /* Load an i2c sub-device. */ |
370 | struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, | 370 | struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, |
371 | struct i2c_adapter *adapter, const char *module_name, | 371 | struct i2c_adapter *adapter, struct i2c_board_info *info, |
372 | struct i2c_board_info *info, const unsigned short *probe_addrs) | 372 | const unsigned short *probe_addrs) |
373 | { | 373 | { |
374 | struct v4l2_subdev *sd = NULL; | 374 | struct v4l2_subdev *sd = NULL; |
375 | struct i2c_client *client; | 375 | struct i2c_client *client; |
376 | 376 | ||
377 | BUG_ON(!v4l2_dev); | 377 | BUG_ON(!v4l2_dev); |
378 | 378 | ||
379 | if (module_name) | 379 | request_module(I2C_MODULE_PREFIX "%s", info->type); |
380 | request_module(module_name); | ||
381 | else | ||
382 | request_module(I2C_MODULE_PREFIX "%s", info->type); | ||
383 | 380 | ||
384 | /* Create the i2c client */ | 381 | /* Create the i2c client */ |
385 | if (info->addr == 0 && probe_addrs) | 382 | if (info->addr == 0 && probe_addrs) |
@@ -432,8 +429,7 @@ error: | |||
432 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); | 429 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); |
433 | 430 | ||
434 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | 431 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, |
435 | struct i2c_adapter *adapter, | 432 | struct i2c_adapter *adapter, const char *client_type, |
436 | const char *module_name, const char *client_type, | ||
437 | int irq, void *platform_data, | 433 | int irq, void *platform_data, |
438 | u8 addr, const unsigned short *probe_addrs) | 434 | u8 addr, const unsigned short *probe_addrs) |
439 | { | 435 | { |
@@ -447,8 +443,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | |||
447 | info.irq = irq; | 443 | info.irq = irq; |
448 | info.platform_data = platform_data; | 444 | info.platform_data = platform_data; |
449 | 445 | ||
450 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, module_name, | 446 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); |
451 | &info, probe_addrs); | ||
452 | } | 447 | } |
453 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); | 448 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); |
454 | 449 | ||
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 03f7f4670e9b..359e23290a7e 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -186,12 +186,12 @@ static ssize_t v4l2_read(struct file *filp, char __user *buf, | |||
186 | size_t sz, loff_t *off) | 186 | size_t sz, loff_t *off) |
187 | { | 187 | { |
188 | struct video_device *vdev = video_devdata(filp); | 188 | struct video_device *vdev = video_devdata(filp); |
189 | int ret = -EIO; | 189 | int ret = -ENODEV; |
190 | 190 | ||
191 | if (!vdev->fops->read) | 191 | if (!vdev->fops->read) |
192 | return -EINVAL; | 192 | return -EINVAL; |
193 | if (vdev->lock) | 193 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
194 | mutex_lock(vdev->lock); | 194 | return -ERESTARTSYS; |
195 | if (video_is_registered(vdev)) | 195 | if (video_is_registered(vdev)) |
196 | ret = vdev->fops->read(filp, buf, sz, off); | 196 | ret = vdev->fops->read(filp, buf, sz, off); |
197 | if (vdev->lock) | 197 | if (vdev->lock) |
@@ -203,12 +203,12 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf, | |||
203 | size_t sz, loff_t *off) | 203 | size_t sz, loff_t *off) |
204 | { | 204 | { |
205 | struct video_device *vdev = video_devdata(filp); | 205 | struct video_device *vdev = video_devdata(filp); |
206 | int ret = -EIO; | 206 | int ret = -ENODEV; |
207 | 207 | ||
208 | if (!vdev->fops->write) | 208 | if (!vdev->fops->write) |
209 | return -EINVAL; | 209 | return -EINVAL; |
210 | if (vdev->lock) | 210 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
211 | mutex_lock(vdev->lock); | 211 | return -ERESTARTSYS; |
212 | if (video_is_registered(vdev)) | 212 | if (video_is_registered(vdev)) |
213 | ret = vdev->fops->write(filp, buf, sz, off); | 213 | ret = vdev->fops->write(filp, buf, sz, off); |
214 | if (vdev->lock) | 214 | if (vdev->lock) |
@@ -219,10 +219,10 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf, | |||
219 | static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) | 219 | static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) |
220 | { | 220 | { |
221 | struct video_device *vdev = video_devdata(filp); | 221 | struct video_device *vdev = video_devdata(filp); |
222 | int ret = DEFAULT_POLLMASK; | 222 | int ret = POLLERR | POLLHUP; |
223 | 223 | ||
224 | if (!vdev->fops->poll) | 224 | if (!vdev->fops->poll) |
225 | return ret; | 225 | return DEFAULT_POLLMASK; |
226 | if (vdev->lock) | 226 | if (vdev->lock) |
227 | mutex_lock(vdev->lock); | 227 | mutex_lock(vdev->lock); |
228 | if (video_is_registered(vdev)) | 228 | if (video_is_registered(vdev)) |
@@ -238,20 +238,45 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
238 | int ret = -ENODEV; | 238 | int ret = -ENODEV; |
239 | 239 | ||
240 | if (vdev->fops->unlocked_ioctl) { | 240 | if (vdev->fops->unlocked_ioctl) { |
241 | if (vdev->lock) | 241 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
242 | mutex_lock(vdev->lock); | 242 | return -ERESTARTSYS; |
243 | if (video_is_registered(vdev)) | 243 | if (video_is_registered(vdev)) |
244 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); | 244 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); |
245 | if (vdev->lock) | 245 | if (vdev->lock) |
246 | mutex_unlock(vdev->lock); | 246 | mutex_unlock(vdev->lock); |
247 | } else if (vdev->fops->ioctl) { | 247 | } else if (vdev->fops->ioctl) { |
248 | /* TODO: convert all drivers to unlocked_ioctl */ | 248 | /* This code path is a replacement for the BKL. It is a major |
249 | * hack but it will have to do for those drivers that are not | ||
250 | * yet converted to use unlocked_ioctl. | ||
251 | * | ||
252 | * There are two options: if the driver implements struct | ||
253 | * v4l2_device, then the lock defined there is used to | ||
254 | * serialize the ioctls. Otherwise the v4l2 core lock defined | ||
255 | * below is used. This lock is really bad since it serializes | ||
256 | * completely independent devices. | ||
257 | * | ||
258 | * Both variants suffer from the same problem: if the driver | ||
259 | * sleeps, then it blocks all ioctls since the lock is still | ||
260 | * held. This is very common for VIDIOC_DQBUF since that | ||
261 | * normally waits for a frame to arrive. As a result any other | ||
262 | * ioctl calls will proceed very, very slowly since each call | ||
263 | * will have to wait for the VIDIOC_QBUF to finish. Things that | ||
264 | * should take 0.01s may now take 10-20 seconds. | ||
265 | * | ||
266 | * The workaround is to *not* take the lock for VIDIOC_DQBUF. | ||
267 | * This actually works OK for videobuf-based drivers, since | ||
268 | * videobuf will take its own internal lock. | ||
269 | */ | ||
249 | static DEFINE_MUTEX(v4l2_ioctl_mutex); | 270 | static DEFINE_MUTEX(v4l2_ioctl_mutex); |
271 | struct mutex *m = vdev->v4l2_dev ? | ||
272 | &vdev->v4l2_dev->ioctl_lock : &v4l2_ioctl_mutex; | ||
250 | 273 | ||
251 | mutex_lock(&v4l2_ioctl_mutex); | 274 | if (cmd != VIDIOC_DQBUF && mutex_lock_interruptible(m)) |
275 | return -ERESTARTSYS; | ||
252 | if (video_is_registered(vdev)) | 276 | if (video_is_registered(vdev)) |
253 | ret = vdev->fops->ioctl(filp, cmd, arg); | 277 | ret = vdev->fops->ioctl(filp, cmd, arg); |
254 | mutex_unlock(&v4l2_ioctl_mutex); | 278 | if (cmd != VIDIOC_DQBUF) |
279 | mutex_unlock(m); | ||
255 | } else | 280 | } else |
256 | ret = -ENOTTY; | 281 | ret = -ENOTTY; |
257 | 282 | ||
@@ -265,8 +290,8 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) | |||
265 | 290 | ||
266 | if (!vdev->fops->mmap) | 291 | if (!vdev->fops->mmap) |
267 | return ret; | 292 | return ret; |
268 | if (vdev->lock) | 293 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
269 | mutex_lock(vdev->lock); | 294 | return -ERESTARTSYS; |
270 | if (video_is_registered(vdev)) | 295 | if (video_is_registered(vdev)) |
271 | ret = vdev->fops->mmap(filp, vm); | 296 | ret = vdev->fops->mmap(filp, vm); |
272 | if (vdev->lock) | 297 | if (vdev->lock) |
@@ -284,7 +309,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
284 | mutex_lock(&videodev_lock); | 309 | mutex_lock(&videodev_lock); |
285 | vdev = video_devdata(filp); | 310 | vdev = video_devdata(filp); |
286 | /* return ENODEV if the video device has already been removed. */ | 311 | /* return ENODEV if the video device has already been removed. */ |
287 | if (vdev == NULL) { | 312 | if (vdev == NULL || !video_is_registered(vdev)) { |
288 | mutex_unlock(&videodev_lock); | 313 | mutex_unlock(&videodev_lock); |
289 | return -ENODEV; | 314 | return -ENODEV; |
290 | } | 315 | } |
@@ -292,8 +317,10 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
292 | video_get(vdev); | 317 | video_get(vdev); |
293 | mutex_unlock(&videodev_lock); | 318 | mutex_unlock(&videodev_lock); |
294 | if (vdev->fops->open) { | 319 | if (vdev->fops->open) { |
295 | if (vdev->lock) | 320 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) { |
296 | mutex_lock(vdev->lock); | 321 | ret = -ERESTARTSYS; |
322 | goto err; | ||
323 | } | ||
297 | if (video_is_registered(vdev)) | 324 | if (video_is_registered(vdev)) |
298 | ret = vdev->fops->open(filp); | 325 | ret = vdev->fops->open(filp); |
299 | else | 326 | else |
@@ -302,6 +329,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
302 | mutex_unlock(vdev->lock); | 329 | mutex_unlock(vdev->lock); |
303 | } | 330 | } |
304 | 331 | ||
332 | err: | ||
305 | /* decrease the refcount in case of an error */ | 333 | /* decrease the refcount in case of an error */ |
306 | if (ret) | 334 | if (ret) |
307 | video_put(vdev); | 335 | video_put(vdev); |
@@ -596,7 +624,12 @@ void video_unregister_device(struct video_device *vdev) | |||
596 | if (!vdev || !video_is_registered(vdev)) | 624 | if (!vdev || !video_is_registered(vdev)) |
597 | return; | 625 | return; |
598 | 626 | ||
627 | mutex_lock(&videodev_lock); | ||
628 | /* This must be in a critical section to prevent a race with v4l2_open. | ||
629 | * Once this bit has been cleared video_get may never be called again. | ||
630 | */ | ||
599 | clear_bit(V4L2_FL_REGISTERED, &vdev->flags); | 631 | clear_bit(V4L2_FL_REGISTERED, &vdev->flags); |
632 | mutex_unlock(&videodev_lock); | ||
600 | device_unregister(&vdev->dev); | 633 | device_unregister(&vdev->dev); |
601 | } | 634 | } |
602 | EXPORT_SYMBOL(video_unregister_device); | 635 | EXPORT_SYMBOL(video_unregister_device); |
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 0b08f96b74a5..7fe6f92af480 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
@@ -35,6 +35,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev) | |||
35 | 35 | ||
36 | INIT_LIST_HEAD(&v4l2_dev->subdevs); | 36 | INIT_LIST_HEAD(&v4l2_dev->subdevs); |
37 | spin_lock_init(&v4l2_dev->lock); | 37 | spin_lock_init(&v4l2_dev->lock); |
38 | mutex_init(&v4l2_dev->ioctl_lock); | ||
38 | v4l2_dev->dev = dev; | 39 | v4l2_dev->dev = dev; |
39 | if (dev == NULL) { | 40 | if (dev == NULL) { |
40 | /* If dev == NULL, then name must be filled in by the caller */ | 41 | /* If dev == NULL, then name must be filled in by the caller */ |
diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 02a21bccae18..9eda7cc03121 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c | |||
@@ -1360,7 +1360,7 @@ static __devinit int viacam_probe(struct platform_device *pdev) | |||
1360 | */ | 1360 | */ |
1361 | sensor_adapter = viafb_find_i2c_adapter(VIA_PORT_31); | 1361 | sensor_adapter = viafb_find_i2c_adapter(VIA_PORT_31); |
1362 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, sensor_adapter, | 1362 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, sensor_adapter, |
1363 | "ov7670", "ov7670", 0x42 >> 1, NULL); | 1363 | "ov7670", 0x42 >> 1, NULL); |
1364 | if (cam->sensor == NULL) { | 1364 | if (cam->sensor == NULL) { |
1365 | dev_err(&pdev->dev, "Unable to find the sensor!\n"); | 1365 | dev_err(&pdev->dev, "Unable to find the sensor!\n"); |
1366 | ret = -ENODEV; | 1366 | ret = -ENODEV; |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index e5e005dc1554..7e7eec48f8b1 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -4334,10 +4334,10 @@ static int __init vino_module_init(void) | |||
4334 | 4334 | ||
4335 | vino_drvdata->decoder = | 4335 | vino_drvdata->decoder = |
4336 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, | 4336 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, |
4337 | NULL, "saa7191", 0, I2C_ADDRS(0x45)); | 4337 | "saa7191", 0, I2C_ADDRS(0x45)); |
4338 | vino_drvdata->camera = | 4338 | vino_drvdata->camera = |
4339 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, | 4339 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, |
4340 | NULL, "indycam", 0, I2C_ADDRS(0x2b)); | 4340 | "indycam", 0, I2C_ADDRS(0x2b)); |
4341 | 4341 | ||
4342 | dprintk("init complete!\n"); | 4342 | dprintk("init complete!\n"); |
4343 | 4343 | ||
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 635420d8d84a..019ee206cbee 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -815,7 +815,7 @@ out: | |||
815 | 815 | ||
816 | static const struct v4l2_file_operations w9966_fops = { | 816 | static const struct v4l2_file_operations w9966_fops = { |
817 | .owner = THIS_MODULE, | 817 | .owner = THIS_MODULE, |
818 | .ioctl = video_ioctl2, | 818 | .unlocked_ioctl = video_ioctl2, |
819 | .read = w9966_v4l_read, | 819 | .read = w9966_v4l_read, |
820 | }; | 820 | }; |
821 | 821 | ||
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 7e6d62467eaa..e520abf9f4c3 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -1343,13 +1343,12 @@ static int __devinit zoran_probe(struct pci_dev *pdev, | |||
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, | 1345 | zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, |
1346 | &zr->i2c_adapter, NULL, zr->card.i2c_decoder, | 1346 | &zr->i2c_adapter, zr->card.i2c_decoder, |
1347 | 0, zr->card.addrs_decoder); | 1347 | 0, zr->card.addrs_decoder); |
1348 | 1348 | ||
1349 | if (zr->card.i2c_encoder) | 1349 | if (zr->card.i2c_encoder) |
1350 | zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, | 1350 | zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, |
1351 | &zr->i2c_adapter, | 1351 | &zr->i2c_adapter, zr->card.i2c_encoder, |
1352 | NULL, zr->card.i2c_encoder, | ||
1353 | 0, zr->card.addrs_encoder); | 1352 | 0, zr->card.addrs_encoder); |
1354 | 1353 | ||
1355 | dprintk(2, | 1354 | dprintk(2, |
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index dbe1c93c1af3..d9640a623ff4 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -303,7 +303,7 @@ static irqreturn_t ab8500_irq(int irq, void *dev) | |||
303 | continue; | 303 | continue; |
304 | 304 | ||
305 | do { | 305 | do { |
306 | int bit = __ffs(status); | 306 | int bit = __ffs(value); |
307 | int line = i * 8 + bit; | 307 | int line = i * 8 + bit; |
308 | 308 | ||
309 | handle_nested_irq(ab8500->irq_base + line); | 309 | handle_nested_irq(ab8500->irq_base + line); |
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 7d2563fc15c6..76cadcf3b1fe 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c | |||
@@ -1455,7 +1455,11 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1455 | dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret); | 1455 | dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret); |
1456 | goto err; | 1456 | goto err; |
1457 | } | 1457 | } |
1458 | if (ret != 0x6204) { | 1458 | switch (ret) { |
1459 | case 0x6204: | ||
1460 | case 0x6246: | ||
1461 | break; | ||
1462 | default: | ||
1459 | dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret); | 1463 | dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret); |
1460 | ret = -EINVAL; | 1464 | ret = -EINVAL; |
1461 | goto err; | 1465 | goto err; |
@@ -1620,7 +1624,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1620 | case WM8325: | 1624 | case WM8325: |
1621 | ret = mfd_add_devices(wm831x->dev, -1, | 1625 | ret = mfd_add_devices(wm831x->dev, -1, |
1622 | wm8320_devs, ARRAY_SIZE(wm8320_devs), | 1626 | wm8320_devs, ARRAY_SIZE(wm8320_devs), |
1623 | NULL, 0); | 1627 | NULL, wm831x->irq_base); |
1624 | break; | 1628 | break; |
1625 | 1629 | ||
1626 | default: | 1630 | default: |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 31ae07a36576..57dcf8fa774a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1773,6 +1773,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, | |||
1773 | 1773 | ||
1774 | case PM_POST_SUSPEND: | 1774 | case PM_POST_SUSPEND: |
1775 | case PM_POST_HIBERNATION: | 1775 | case PM_POST_HIBERNATION: |
1776 | case PM_POST_RESTORE: | ||
1776 | 1777 | ||
1777 | spin_lock_irqsave(&host->lock, flags); | 1778 | spin_lock_irqsave(&host->lock, flags); |
1778 | host->rescan_disable = 0; | 1779 | host->rescan_disable = 0; |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 591ab540b407..d3e6a962f423 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/highmem.h> | 69 | #include <linux/highmem.h> |
70 | 70 | ||
71 | #include <linux/mmc/host.h> | 71 | #include <linux/mmc/host.h> |
72 | #include <linux/mmc/sdio.h> | ||
72 | 73 | ||
73 | #include <asm/io.h> | 74 | #include <asm/io.h> |
74 | #include <asm/irq.h> | 75 | #include <asm/irq.h> |
@@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
493 | else if (data->flags & MMC_DATA_WRITE) | 494 | else if (data->flags & MMC_DATA_WRITE) |
494 | cmdr |= AT91_MCI_TRCMD_START; | 495 | cmdr |= AT91_MCI_TRCMD_START; |
495 | 496 | ||
496 | if (data->flags & MMC_DATA_STREAM) | 497 | if (cmd->opcode == SD_IO_RW_EXTENDED) { |
497 | cmdr |= AT91_MCI_TRTYP_STREAM; | 498 | cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK; |
498 | if (data->blocks > 1) | 499 | } else { |
499 | cmdr |= AT91_MCI_TRTYP_MULTIPLE; | 500 | if (data->flags & MMC_DATA_STREAM) |
501 | cmdr |= AT91_MCI_TRTYP_STREAM; | ||
502 | if (data->blocks > 1) | ||
503 | cmdr |= AT91_MCI_TRTYP_MULTIPLE; | ||
504 | } | ||
500 | } | 505 | } |
501 | else { | 506 | else { |
502 | block_length = 0; | 507 | block_length = 0; |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 301351a5d838..ad2a7a032cdf 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/stat.h> | 26 | #include <linux/stat.h> |
27 | 27 | ||
28 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
29 | #include <linux/mmc/sdio.h> | ||
29 | 30 | ||
30 | #include <mach/atmel-mci.h> | 31 | #include <mach/atmel-mci.h> |
31 | #include <linux/atmel-mci.h> | 32 | #include <linux/atmel-mci.h> |
@@ -532,12 +533,17 @@ static u32 atmci_prepare_command(struct mmc_host *mmc, | |||
532 | data = cmd->data; | 533 | data = cmd->data; |
533 | if (data) { | 534 | if (data) { |
534 | cmdr |= MCI_CMDR_START_XFER; | 535 | cmdr |= MCI_CMDR_START_XFER; |
535 | if (data->flags & MMC_DATA_STREAM) | 536 | |
536 | cmdr |= MCI_CMDR_STREAM; | 537 | if (cmd->opcode == SD_IO_RW_EXTENDED) { |
537 | else if (data->blocks > 1) | 538 | cmdr |= MCI_CMDR_SDIO_BLOCK; |
538 | cmdr |= MCI_CMDR_MULTI_BLOCK; | 539 | } else { |
539 | else | 540 | if (data->flags & MMC_DATA_STREAM) |
540 | cmdr |= MCI_CMDR_BLOCK; | 541 | cmdr |= MCI_CMDR_STREAM; |
542 | else if (data->blocks > 1) | ||
543 | cmdr |= MCI_CMDR_MULTI_BLOCK; | ||
544 | else | ||
545 | cmdr |= MCI_CMDR_BLOCK; | ||
546 | } | ||
541 | 547 | ||
542 | if (data->flags & MMC_DATA_READ) | 548 | if (data->flags & MMC_DATA_READ) |
543 | cmdr |= MCI_CMDR_TRDIR_READ; | 549 | cmdr |= MCI_CMDR_TRDIR_READ; |
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index dd90880048cf..d8ae634d347e 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
@@ -51,7 +51,7 @@ struct pxa2xx_flash_info { | |||
51 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 51 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
52 | 52 | ||
53 | 53 | ||
54 | static int __init pxa2xx_flash_probe(struct platform_device *pdev) | 54 | static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) |
55 | { | 55 | { |
56 | struct flash_platform_data *flash = pdev->dev.platform_data; | 56 | struct flash_platform_data *flash = pdev->dev.platform_data; |
57 | struct pxa2xx_flash_info *info; | 57 | struct pxa2xx_flash_info *info; |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index cd41c58b5bbd..15682ec8530e 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | #define CONFIG_MTD_NAND_OMAP_HWECC | ||
11 | 10 | ||
12 | #include <linux/platform_device.h> | 11 | #include <linux/platform_device.h> |
13 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index c2960ac9f39c..811775aa8ee8 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -482,10 +482,17 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum) | |||
482 | uint32_t data = 0; | 482 | uint32_t data = 0; |
483 | struct ubi_vid_hdr vid_hdr; | 483 | struct ubi_vid_hdr vid_hdr; |
484 | 484 | ||
485 | addr = (loff_t)pnum * ubi->peb_size + ubi->vid_hdr_aloffset; | 485 | /* |
486 | * It is important to first invalidate the EC header, and then the VID | ||
487 | * header. Otherwise a power cut may lead to valid EC header and | ||
488 | * invalid VID header, in which case UBI will treat this PEB as | ||
489 | * corrupted and will try to preserve it, and print scary warnings (see | ||
490 | * the header comment in scan.c for more information). | ||
491 | */ | ||
492 | addr = (loff_t)pnum * ubi->peb_size; | ||
486 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); | 493 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); |
487 | if (!err) { | 494 | if (!err) { |
488 | addr -= ubi->vid_hdr_aloffset; | 495 | addr += ubi->vid_hdr_aloffset; |
489 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, | 496 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, |
490 | (void *)&data); | 497 | (void *)&data); |
491 | if (!err) | 498 | if (!err) |
@@ -494,18 +501,24 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum) | |||
494 | 501 | ||
495 | /* | 502 | /* |
496 | * We failed to write to the media. This was observed with Spansion | 503 | * We failed to write to the media. This was observed with Spansion |
497 | * S29GL512N NOR flash. Most probably the eraseblock erasure was | 504 | * S29GL512N NOR flash. Most probably the previously eraseblock erasure |
498 | * interrupted at a very inappropriate moment, so it became unwritable. | 505 | * was interrupted at a very inappropriate moment, so it became |
499 | * In this case we probably anyway have garbage in this PEB. | 506 | * unwritable. In this case we probably anyway have garbage in this |
507 | * PEB. | ||
500 | */ | 508 | */ |
501 | err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); | 509 | err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); |
502 | if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) | 510 | if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) { |
503 | /* | 511 | struct ubi_ec_hdr ec_hdr; |
504 | * The VID header is corrupted, so we can safely erase this | 512 | |
505 | * PEB and not afraid that it will be treated as a valid PEB in | 513 | err1 = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0); |
506 | * case of an unclean reboot. | 514 | if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) |
507 | */ | 515 | /* |
508 | return 0; | 516 | * Both VID and EC headers are corrupted, so we can |
517 | * safely erase this PEB and not afraid that it will be | ||
518 | * treated as a valid PEB in case of an unclean reboot. | ||
519 | */ | ||
520 | return 0; | ||
521 | } | ||
509 | 522 | ||
510 | /* | 523 | /* |
511 | * The PEB contains a valid VID header, but we cannot invalidate it. | 524 | * The PEB contains a valid VID header, but we cannot invalidate it. |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 204345be8e62..79ca304fc4db 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -953,6 +953,10 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
953 | * impossible to distinguish it from a PEB which just | 953 | * impossible to distinguish it from a PEB which just |
954 | * contains garbage because of a power cut during erase | 954 | * contains garbage because of a power cut during erase |
955 | * operation. So we just schedule this PEB for erasure. | 955 | * operation. So we just schedule this PEB for erasure. |
956 | * | ||
957 | * Besides, in case of NOR flash, we deliberatly | ||
958 | * corrupt both headers because NOR flash erasure is | ||
959 | * slow and can start from the end. | ||
956 | */ | 960 | */ |
957 | err = 0; | 961 | err = 0; |
958 | else | 962 | else |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 43db398437b7..4f1755bddf6b 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2543,10 +2543,10 @@ config PCH_GBE | |||
2543 | depends on PCI | 2543 | depends on PCI |
2544 | select MII | 2544 | select MII |
2545 | ---help--- | 2545 | ---help--- |
2546 | This is a gigabit ethernet driver for Topcliff PCH. | 2546 | This is a gigabit ethernet driver for EG20T PCH. |
2547 | Topcliff PCH is the platform controller hub that is used in Intel's | 2547 | EG20T PCH is the platform controller hub that is used in Intel's |
2548 | general embedded platform. | 2548 | general embedded platform. |
2549 | Topcliff PCH has Gigabit Ethernet interface. | 2549 | EG20T PCH has Gigabit Ethernet interface. |
2550 | Using this interface, it is able to access system devices connected | 2550 | Using this interface, it is able to access system devices connected |
2551 | to Gigabit Ethernet. | 2551 | to Gigabit Ethernet. |
2552 | This driver enables Gigabit Ethernet function. | 2552 | This driver enables Gigabit Ethernet function. |
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c index 09b099bfab2b..bdf11d89a499 100644 --- a/drivers/net/atl1c/atl1c_main.c +++ b/drivers/net/atl1c/atl1c_main.c | |||
@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter) | |||
702 | 702 | ||
703 | 703 | ||
704 | adapter->wol = 0; | 704 | adapter->wol = 0; |
705 | device_set_wakeup_enable(&pdev->dev, false); | ||
705 | adapter->link_speed = SPEED_0; | 706 | adapter->link_speed = SPEED_0; |
706 | adapter->link_duplex = FULL_DUPLEX; | 707 | adapter->link_duplex = FULL_DUPLEX; |
707 | adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; | 708 | adapter->num_rx_queues = AT_DEF_RECEIVE_QUEUE; |
@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_device *netdev) | |||
2444 | return 0; | 2445 | return 0; |
2445 | } | 2446 | } |
2446 | 2447 | ||
2447 | static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | 2448 | static int atl1c_suspend(struct device *dev) |
2448 | { | 2449 | { |
2450 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2449 | struct net_device *netdev = pci_get_drvdata(pdev); | 2451 | struct net_device *netdev = pci_get_drvdata(pdev); |
2450 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 2452 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
2451 | struct atl1c_hw *hw = &adapter->hw; | 2453 | struct atl1c_hw *hw = &adapter->hw; |
@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2454 | u32 wol_ctrl_data = 0; | 2456 | u32 wol_ctrl_data = 0; |
2455 | u16 mii_intr_status_data = 0; | 2457 | u16 mii_intr_status_data = 0; |
2456 | u32 wufc = adapter->wol; | 2458 | u32 wufc = adapter->wol; |
2457 | int retval = 0; | ||
2458 | 2459 | ||
2459 | atl1c_disable_l0s_l1(hw); | 2460 | atl1c_disable_l0s_l1(hw); |
2460 | if (netif_running(netdev)) { | 2461 | if (netif_running(netdev)) { |
@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2462 | atl1c_down(adapter); | 2463 | atl1c_down(adapter); |
2463 | } | 2464 | } |
2464 | netif_device_detach(netdev); | 2465 | netif_device_detach(netdev); |
2465 | retval = pci_save_state(pdev); | ||
2466 | if (retval) | ||
2467 | return retval; | ||
2468 | 2466 | ||
2469 | if (wufc) | 2467 | if (wufc) |
2470 | if (atl1c_phy_power_saving(hw) != 0) | 2468 | if (atl1c_phy_power_saving(hw) != 0) |
@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2525 | AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); | 2523 | AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); |
2526 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); | 2524 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); |
2527 | 2525 | ||
2528 | /* pcie patch */ | ||
2529 | device_set_wakeup_enable(&pdev->dev, 1); | ||
2530 | |||
2531 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | | 2526 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_DEFAULT | |
2532 | GPHY_CTRL_EXT_RESET); | 2527 | GPHY_CTRL_EXT_RESET); |
2533 | pci_prepare_to_sleep(pdev); | ||
2534 | } else { | 2528 | } else { |
2535 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); | 2529 | AT_WRITE_REG(hw, REG_GPHY_CTRL, GPHY_CTRL_POWER_SAVING); |
2536 | master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; | 2530 | master_ctrl_data |= MASTER_CTRL_CLK_SEL_DIS; |
@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2540 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); | 2534 | AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); |
2541 | AT_WRITE_REG(hw, REG_WOL_CTRL, 0); | 2535 | AT_WRITE_REG(hw, REG_WOL_CTRL, 0); |
2542 | hw->phy_configured = false; /* re-init PHY when resume */ | 2536 | hw->phy_configured = false; /* re-init PHY when resume */ |
2543 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | ||
2544 | } | 2537 | } |
2545 | 2538 | ||
2546 | pci_disable_device(pdev); | ||
2547 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
2548 | |||
2549 | return 0; | 2539 | return 0; |
2550 | } | 2540 | } |
2551 | 2541 | ||
2552 | static int atl1c_resume(struct pci_dev *pdev) | 2542 | static int atl1c_resume(struct device *dev) |
2553 | { | 2543 | { |
2544 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2554 | struct net_device *netdev = pci_get_drvdata(pdev); | 2545 | struct net_device *netdev = pci_get_drvdata(pdev); |
2555 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 2546 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
2556 | 2547 | ||
2557 | pci_set_power_state(pdev, PCI_D0); | ||
2558 | pci_restore_state(pdev); | ||
2559 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
2560 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2561 | |||
2562 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); | 2548 | AT_WRITE_REG(&adapter->hw, REG_WOL_CTRL, 0); |
2563 | atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | | 2549 | atl1c_reset_pcie(&adapter->hw, ATL1C_PCIE_L0S_L1_DISABLE | |
2564 | ATL1C_PCIE_PHY_RESET); | 2550 | ATL1C_PCIE_PHY_RESET); |
@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *pdev) | |||
2582 | 2568 | ||
2583 | static void atl1c_shutdown(struct pci_dev *pdev) | 2569 | static void atl1c_shutdown(struct pci_dev *pdev) |
2584 | { | 2570 | { |
2585 | atl1c_suspend(pdev, PMSG_SUSPEND); | 2571 | struct net_device *netdev = pci_get_drvdata(pdev); |
2572 | struct atl1c_adapter *adapter = netdev_priv(netdev); | ||
2573 | |||
2574 | atl1c_suspend(&pdev->dev); | ||
2575 | pci_wake_from_d3(pdev, adapter->wol); | ||
2576 | pci_set_power_state(pdev, PCI_D3hot); | ||
2586 | } | 2577 | } |
2587 | 2578 | ||
2588 | static const struct net_device_ops atl1c_netdev_ops = { | 2579 | static const struct net_device_ops atl1c_netdev_ops = { |
@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_err_handler = { | |||
2886 | .resume = atl1c_io_resume, | 2877 | .resume = atl1c_io_resume, |
2887 | }; | 2878 | }; |
2888 | 2879 | ||
2880 | static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); | ||
2881 | |||
2889 | static struct pci_driver atl1c_driver = { | 2882 | static struct pci_driver atl1c_driver = { |
2890 | .name = atl1c_driver_name, | 2883 | .name = atl1c_driver_name, |
2891 | .id_table = atl1c_pci_tbl, | 2884 | .id_table = atl1c_pci_tbl, |
2892 | .probe = atl1c_probe, | 2885 | .probe = atl1c_probe, |
2893 | .remove = __devexit_p(atl1c_remove), | 2886 | .remove = __devexit_p(atl1c_remove), |
2894 | /* Power Managment Hooks */ | ||
2895 | .suspend = atl1c_suspend, | ||
2896 | .resume = atl1c_resume, | ||
2897 | .shutdown = atl1c_shutdown, | 2887 | .shutdown = atl1c_shutdown, |
2898 | .err_handler = &atl1c_err_handler | 2888 | .err_handler = &atl1c_err_handler, |
2889 | .driver.pm = &atl1c_pm_ops, | ||
2899 | }; | 2890 | }; |
2900 | 2891 | ||
2901 | /* | 2892 | /* |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 43489f89c142..53eff9ba6e95 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -155,10 +155,10 @@ static void au1000_enable_mac(struct net_device *dev, int force_reset) | |||
155 | spin_lock_irqsave(&aup->lock, flags); | 155 | spin_lock_irqsave(&aup->lock, flags); |
156 | 156 | ||
157 | if (force_reset || (!aup->mac_enabled)) { | 157 | if (force_reset || (!aup->mac_enabled)) { |
158 | writel(MAC_EN_CLOCK_ENABLE, &aup->enable); | 158 | writel(MAC_EN_CLOCK_ENABLE, aup->enable); |
159 | au_sync_delay(2); | 159 | au_sync_delay(2); |
160 | writel((MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2 | 160 | writel((MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2 |
161 | | MAC_EN_CLOCK_ENABLE), &aup->enable); | 161 | | MAC_EN_CLOCK_ENABLE), aup->enable); |
162 | au_sync_delay(2); | 162 | au_sync_delay(2); |
163 | 163 | ||
164 | aup->mac_enabled = 1; | 164 | aup->mac_enabled = 1; |
@@ -503,9 +503,9 @@ static void au1000_reset_mac_unlocked(struct net_device *dev) | |||
503 | 503 | ||
504 | au1000_hard_stop(dev); | 504 | au1000_hard_stop(dev); |
505 | 505 | ||
506 | writel(MAC_EN_CLOCK_ENABLE, &aup->enable); | 506 | writel(MAC_EN_CLOCK_ENABLE, aup->enable); |
507 | au_sync_delay(2); | 507 | au_sync_delay(2); |
508 | writel(0, &aup->enable); | 508 | writel(0, aup->enable); |
509 | au_sync_delay(2); | 509 | au_sync_delay(2); |
510 | 510 | ||
511 | aup->tx_full = 0; | 511 | aup->tx_full = 0; |
@@ -1119,7 +1119,7 @@ static int __devinit au1000_probe(struct platform_device *pdev) | |||
1119 | /* set a random MAC now in case platform_data doesn't provide one */ | 1119 | /* set a random MAC now in case platform_data doesn't provide one */ |
1120 | random_ether_addr(dev->dev_addr); | 1120 | random_ether_addr(dev->dev_addr); |
1121 | 1121 | ||
1122 | writel(0, &aup->enable); | 1122 | writel(0, aup->enable); |
1123 | aup->mac_enabled = 0; | 1123 | aup->mac_enabled = 0; |
1124 | 1124 | ||
1125 | pd = pdev->dev.platform_data; | 1125 | pd = pdev->dev.platform_data; |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index c6e86315b3f8..2e2b76258ab4 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -381,11 +381,11 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) | |||
381 | __b44_set_flow_ctrl(bp, pause_enab); | 381 | __b44_set_flow_ctrl(bp, pause_enab); |
382 | } | 382 | } |
383 | 383 | ||
384 | #ifdef SSB_DRIVER_MIPS | 384 | #ifdef CONFIG_BCM47XX |
385 | extern char *nvram_get(char *name); | 385 | #include <asm/mach-bcm47xx/nvram.h> |
386 | static void b44_wap54g10_workaround(struct b44 *bp) | 386 | static void b44_wap54g10_workaround(struct b44 *bp) |
387 | { | 387 | { |
388 | const char *str; | 388 | char buf[20]; |
389 | u32 val; | 389 | u32 val; |
390 | int err; | 390 | int err; |
391 | 391 | ||
@@ -394,10 +394,9 @@ static void b44_wap54g10_workaround(struct b44 *bp) | |||
394 | * see https://dev.openwrt.org/ticket/146 | 394 | * see https://dev.openwrt.org/ticket/146 |
395 | * check and reset bit "isolate" | 395 | * check and reset bit "isolate" |
396 | */ | 396 | */ |
397 | str = nvram_get("boardnum"); | 397 | if (nvram_getenv("boardnum", buf, sizeof(buf)) < 0) |
398 | if (!str) | ||
399 | return; | 398 | return; |
400 | if (simple_strtoul(str, NULL, 0) == 2) { | 399 | if (simple_strtoul(buf, NULL, 0) == 2) { |
401 | err = __b44_readphy(bp, 0, MII_BMCR, &val); | 400 | err = __b44_readphy(bp, 0, MII_BMCR, &val); |
402 | if (err) | 401 | if (err) |
403 | goto error; | 402 | goto error; |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 4594a28b1f66..d64313b7090e 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -234,7 +234,7 @@ struct be_adapter { | |||
234 | u8 __iomem *db; /* Door Bell */ | 234 | u8 __iomem *db; /* Door Bell */ |
235 | u8 __iomem *pcicfg; /* PCI config space */ | 235 | u8 __iomem *pcicfg; /* PCI config space */ |
236 | 236 | ||
237 | spinlock_t mbox_lock; /* For serializing mbox cmds to BE card */ | 237 | struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ |
238 | struct be_dma_mem mbox_mem; | 238 | struct be_dma_mem mbox_mem; |
239 | /* Mbox mem is adjusted to align to 16 bytes. The allocated addr | 239 | /* Mbox mem is adjusted to align to 16 bytes. The allocated addr |
240 | * is stored for freeing purpose */ | 240 | * is stored for freeing purpose */ |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 36eca1ce75d4..1c8c79c9d214 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -462,7 +462,8 @@ int be_cmd_fw_init(struct be_adapter *adapter) | |||
462 | u8 *wrb; | 462 | u8 *wrb; |
463 | int status; | 463 | int status; |
464 | 464 | ||
465 | spin_lock(&adapter->mbox_lock); | 465 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
466 | return -1; | ||
466 | 467 | ||
467 | wrb = (u8 *)wrb_from_mbox(adapter); | 468 | wrb = (u8 *)wrb_from_mbox(adapter); |
468 | *wrb++ = 0xFF; | 469 | *wrb++ = 0xFF; |
@@ -476,7 +477,7 @@ int be_cmd_fw_init(struct be_adapter *adapter) | |||
476 | 477 | ||
477 | status = be_mbox_notify_wait(adapter); | 478 | status = be_mbox_notify_wait(adapter); |
478 | 479 | ||
479 | spin_unlock(&adapter->mbox_lock); | 480 | mutex_unlock(&adapter->mbox_lock); |
480 | return status; | 481 | return status; |
481 | } | 482 | } |
482 | 483 | ||
@@ -491,7 +492,8 @@ int be_cmd_fw_clean(struct be_adapter *adapter) | |||
491 | if (adapter->eeh_err) | 492 | if (adapter->eeh_err) |
492 | return -EIO; | 493 | return -EIO; |
493 | 494 | ||
494 | spin_lock(&adapter->mbox_lock); | 495 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
496 | return -1; | ||
495 | 497 | ||
496 | wrb = (u8 *)wrb_from_mbox(adapter); | 498 | wrb = (u8 *)wrb_from_mbox(adapter); |
497 | *wrb++ = 0xFF; | 499 | *wrb++ = 0xFF; |
@@ -505,7 +507,7 @@ int be_cmd_fw_clean(struct be_adapter *adapter) | |||
505 | 507 | ||
506 | status = be_mbox_notify_wait(adapter); | 508 | status = be_mbox_notify_wait(adapter); |
507 | 509 | ||
508 | spin_unlock(&adapter->mbox_lock); | 510 | mutex_unlock(&adapter->mbox_lock); |
509 | return status; | 511 | return status; |
510 | } | 512 | } |
511 | int be_cmd_eq_create(struct be_adapter *adapter, | 513 | int be_cmd_eq_create(struct be_adapter *adapter, |
@@ -516,7 +518,8 @@ int be_cmd_eq_create(struct be_adapter *adapter, | |||
516 | struct be_dma_mem *q_mem = &eq->dma_mem; | 518 | struct be_dma_mem *q_mem = &eq->dma_mem; |
517 | int status; | 519 | int status; |
518 | 520 | ||
519 | spin_lock(&adapter->mbox_lock); | 521 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
522 | return -1; | ||
520 | 523 | ||
521 | wrb = wrb_from_mbox(adapter); | 524 | wrb = wrb_from_mbox(adapter); |
522 | req = embedded_payload(wrb); | 525 | req = embedded_payload(wrb); |
@@ -546,7 +549,7 @@ int be_cmd_eq_create(struct be_adapter *adapter, | |||
546 | eq->created = true; | 549 | eq->created = true; |
547 | } | 550 | } |
548 | 551 | ||
549 | spin_unlock(&adapter->mbox_lock); | 552 | mutex_unlock(&adapter->mbox_lock); |
550 | return status; | 553 | return status; |
551 | } | 554 | } |
552 | 555 | ||
@@ -558,7 +561,8 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | |||
558 | struct be_cmd_req_mac_query *req; | 561 | struct be_cmd_req_mac_query *req; |
559 | int status; | 562 | int status; |
560 | 563 | ||
561 | spin_lock(&adapter->mbox_lock); | 564 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
565 | return -1; | ||
562 | 566 | ||
563 | wrb = wrb_from_mbox(adapter); | 567 | wrb = wrb_from_mbox(adapter); |
564 | req = embedded_payload(wrb); | 568 | req = embedded_payload(wrb); |
@@ -583,7 +587,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, | |||
583 | memcpy(mac_addr, resp->mac.addr, ETH_ALEN); | 587 | memcpy(mac_addr, resp->mac.addr, ETH_ALEN); |
584 | } | 588 | } |
585 | 589 | ||
586 | spin_unlock(&adapter->mbox_lock); | 590 | mutex_unlock(&adapter->mbox_lock); |
587 | return status; | 591 | return status; |
588 | } | 592 | } |
589 | 593 | ||
@@ -667,7 +671,8 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
667 | void *ctxt; | 671 | void *ctxt; |
668 | int status; | 672 | int status; |
669 | 673 | ||
670 | spin_lock(&adapter->mbox_lock); | 674 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
675 | return -1; | ||
671 | 676 | ||
672 | wrb = wrb_from_mbox(adapter); | 677 | wrb = wrb_from_mbox(adapter); |
673 | req = embedded_payload(wrb); | 678 | req = embedded_payload(wrb); |
@@ -701,7 +706,7 @@ int be_cmd_cq_create(struct be_adapter *adapter, | |||
701 | cq->created = true; | 706 | cq->created = true; |
702 | } | 707 | } |
703 | 708 | ||
704 | spin_unlock(&adapter->mbox_lock); | 709 | mutex_unlock(&adapter->mbox_lock); |
705 | 710 | ||
706 | return status; | 711 | return status; |
707 | } | 712 | } |
@@ -724,7 +729,8 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
724 | void *ctxt; | 729 | void *ctxt; |
725 | int status; | 730 | int status; |
726 | 731 | ||
727 | spin_lock(&adapter->mbox_lock); | 732 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
733 | return -1; | ||
728 | 734 | ||
729 | wrb = wrb_from_mbox(adapter); | 735 | wrb = wrb_from_mbox(adapter); |
730 | req = embedded_payload(wrb); | 736 | req = embedded_payload(wrb); |
@@ -754,7 +760,7 @@ int be_cmd_mccq_create(struct be_adapter *adapter, | |||
754 | mccq->id = le16_to_cpu(resp->id); | 760 | mccq->id = le16_to_cpu(resp->id); |
755 | mccq->created = true; | 761 | mccq->created = true; |
756 | } | 762 | } |
757 | spin_unlock(&adapter->mbox_lock); | 763 | mutex_unlock(&adapter->mbox_lock); |
758 | 764 | ||
759 | return status; | 765 | return status; |
760 | } | 766 | } |
@@ -769,7 +775,8 @@ int be_cmd_txq_create(struct be_adapter *adapter, | |||
769 | void *ctxt; | 775 | void *ctxt; |
770 | int status; | 776 | int status; |
771 | 777 | ||
772 | spin_lock(&adapter->mbox_lock); | 778 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
779 | return -1; | ||
773 | 780 | ||
774 | wrb = wrb_from_mbox(adapter); | 781 | wrb = wrb_from_mbox(adapter); |
775 | req = embedded_payload(wrb); | 782 | req = embedded_payload(wrb); |
@@ -801,7 +808,7 @@ int be_cmd_txq_create(struct be_adapter *adapter, | |||
801 | txq->created = true; | 808 | txq->created = true; |
802 | } | 809 | } |
803 | 810 | ||
804 | spin_unlock(&adapter->mbox_lock); | 811 | mutex_unlock(&adapter->mbox_lock); |
805 | 812 | ||
806 | return status; | 813 | return status; |
807 | } | 814 | } |
@@ -816,7 +823,8 @@ int be_cmd_rxq_create(struct be_adapter *adapter, | |||
816 | struct be_dma_mem *q_mem = &rxq->dma_mem; | 823 | struct be_dma_mem *q_mem = &rxq->dma_mem; |
817 | int status; | 824 | int status; |
818 | 825 | ||
819 | spin_lock(&adapter->mbox_lock); | 826 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
827 | return -1; | ||
820 | 828 | ||
821 | wrb = wrb_from_mbox(adapter); | 829 | wrb = wrb_from_mbox(adapter); |
822 | req = embedded_payload(wrb); | 830 | req = embedded_payload(wrb); |
@@ -843,7 +851,7 @@ int be_cmd_rxq_create(struct be_adapter *adapter, | |||
843 | *rss_id = resp->rss_id; | 851 | *rss_id = resp->rss_id; |
844 | } | 852 | } |
845 | 853 | ||
846 | spin_unlock(&adapter->mbox_lock); | 854 | mutex_unlock(&adapter->mbox_lock); |
847 | 855 | ||
848 | return status; | 856 | return status; |
849 | } | 857 | } |
@@ -862,7 +870,8 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, | |||
862 | if (adapter->eeh_err) | 870 | if (adapter->eeh_err) |
863 | return -EIO; | 871 | return -EIO; |
864 | 872 | ||
865 | spin_lock(&adapter->mbox_lock); | 873 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
874 | return -1; | ||
866 | 875 | ||
867 | wrb = wrb_from_mbox(adapter); | 876 | wrb = wrb_from_mbox(adapter); |
868 | req = embedded_payload(wrb); | 877 | req = embedded_payload(wrb); |
@@ -899,7 +908,7 @@ int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, | |||
899 | 908 | ||
900 | status = be_mbox_notify_wait(adapter); | 909 | status = be_mbox_notify_wait(adapter); |
901 | 910 | ||
902 | spin_unlock(&adapter->mbox_lock); | 911 | mutex_unlock(&adapter->mbox_lock); |
903 | 912 | ||
904 | return status; | 913 | return status; |
905 | } | 914 | } |
@@ -915,7 +924,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, | |||
915 | struct be_cmd_req_if_create *req; | 924 | struct be_cmd_req_if_create *req; |
916 | int status; | 925 | int status; |
917 | 926 | ||
918 | spin_lock(&adapter->mbox_lock); | 927 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
928 | return -1; | ||
919 | 929 | ||
920 | wrb = wrb_from_mbox(adapter); | 930 | wrb = wrb_from_mbox(adapter); |
921 | req = embedded_payload(wrb); | 931 | req = embedded_payload(wrb); |
@@ -941,7 +951,7 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, | |||
941 | *pmac_id = le32_to_cpu(resp->pmac_id); | 951 | *pmac_id = le32_to_cpu(resp->pmac_id); |
942 | } | 952 | } |
943 | 953 | ||
944 | spin_unlock(&adapter->mbox_lock); | 954 | mutex_unlock(&adapter->mbox_lock); |
945 | return status; | 955 | return status; |
946 | } | 956 | } |
947 | 957 | ||
@@ -955,7 +965,8 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id) | |||
955 | if (adapter->eeh_err) | 965 | if (adapter->eeh_err) |
956 | return -EIO; | 966 | return -EIO; |
957 | 967 | ||
958 | spin_lock(&adapter->mbox_lock); | 968 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
969 | return -1; | ||
959 | 970 | ||
960 | wrb = wrb_from_mbox(adapter); | 971 | wrb = wrb_from_mbox(adapter); |
961 | req = embedded_payload(wrb); | 972 | req = embedded_payload(wrb); |
@@ -970,7 +981,7 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id) | |||
970 | 981 | ||
971 | status = be_mbox_notify_wait(adapter); | 982 | status = be_mbox_notify_wait(adapter); |
972 | 983 | ||
973 | spin_unlock(&adapter->mbox_lock); | 984 | mutex_unlock(&adapter->mbox_lock); |
974 | 985 | ||
975 | return status; | 986 | return status; |
976 | } | 987 | } |
@@ -1060,7 +1071,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver) | |||
1060 | struct be_cmd_req_get_fw_version *req; | 1071 | struct be_cmd_req_get_fw_version *req; |
1061 | int status; | 1072 | int status; |
1062 | 1073 | ||
1063 | spin_lock(&adapter->mbox_lock); | 1074 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1075 | return -1; | ||
1064 | 1076 | ||
1065 | wrb = wrb_from_mbox(adapter); | 1077 | wrb = wrb_from_mbox(adapter); |
1066 | req = embedded_payload(wrb); | 1078 | req = embedded_payload(wrb); |
@@ -1077,7 +1089,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver) | |||
1077 | strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN); | 1089 | strncpy(fw_ver, resp->firmware_version_string, FW_VER_LEN); |
1078 | } | 1090 | } |
1079 | 1091 | ||
1080 | spin_unlock(&adapter->mbox_lock); | 1092 | mutex_unlock(&adapter->mbox_lock); |
1081 | return status; | 1093 | return status; |
1082 | } | 1094 | } |
1083 | 1095 | ||
@@ -1235,7 +1247,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, | |||
1235 | 1247 | ||
1236 | i = 0; | 1248 | i = 0; |
1237 | netdev_for_each_mc_addr(ha, netdev) | 1249 | netdev_for_each_mc_addr(ha, netdev) |
1238 | memcpy(req->mac[i].byte, ha->addr, ETH_ALEN); | 1250 | memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN); |
1239 | } else { | 1251 | } else { |
1240 | req->promiscuous = 1; | 1252 | req->promiscuous = 1; |
1241 | } | 1253 | } |
@@ -1322,7 +1334,8 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, | |||
1322 | struct be_cmd_req_query_fw_cfg *req; | 1334 | struct be_cmd_req_query_fw_cfg *req; |
1323 | int status; | 1335 | int status; |
1324 | 1336 | ||
1325 | spin_lock(&adapter->mbox_lock); | 1337 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1338 | return -1; | ||
1326 | 1339 | ||
1327 | wrb = wrb_from_mbox(adapter); | 1340 | wrb = wrb_from_mbox(adapter); |
1328 | req = embedded_payload(wrb); | 1341 | req = embedded_payload(wrb); |
@@ -1341,7 +1354,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, | |||
1341 | *caps = le32_to_cpu(resp->function_caps); | 1354 | *caps = le32_to_cpu(resp->function_caps); |
1342 | } | 1355 | } |
1343 | 1356 | ||
1344 | spin_unlock(&adapter->mbox_lock); | 1357 | mutex_unlock(&adapter->mbox_lock); |
1345 | return status; | 1358 | return status; |
1346 | } | 1359 | } |
1347 | 1360 | ||
@@ -1352,7 +1365,8 @@ int be_cmd_reset_function(struct be_adapter *adapter) | |||
1352 | struct be_cmd_req_hdr *req; | 1365 | struct be_cmd_req_hdr *req; |
1353 | int status; | 1366 | int status; |
1354 | 1367 | ||
1355 | spin_lock(&adapter->mbox_lock); | 1368 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1369 | return -1; | ||
1356 | 1370 | ||
1357 | wrb = wrb_from_mbox(adapter); | 1371 | wrb = wrb_from_mbox(adapter); |
1358 | req = embedded_payload(wrb); | 1372 | req = embedded_payload(wrb); |
@@ -1365,7 +1379,7 @@ int be_cmd_reset_function(struct be_adapter *adapter) | |||
1365 | 1379 | ||
1366 | status = be_mbox_notify_wait(adapter); | 1380 | status = be_mbox_notify_wait(adapter); |
1367 | 1381 | ||
1368 | spin_unlock(&adapter->mbox_lock); | 1382 | mutex_unlock(&adapter->mbox_lock); |
1369 | return status; | 1383 | return status; |
1370 | } | 1384 | } |
1371 | 1385 | ||
@@ -1376,7 +1390,8 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size) | |||
1376 | u32 myhash[10]; | 1390 | u32 myhash[10]; |
1377 | int status; | 1391 | int status; |
1378 | 1392 | ||
1379 | spin_lock(&adapter->mbox_lock); | 1393 | if (mutex_lock_interruptible(&adapter->mbox_lock)) |
1394 | return -1; | ||
1380 | 1395 | ||
1381 | wrb = wrb_from_mbox(adapter); | 1396 | wrb = wrb_from_mbox(adapter); |
1382 | req = embedded_payload(wrb); | 1397 | req = embedded_payload(wrb); |
@@ -1396,7 +1411,7 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, u16 table_size) | |||
1396 | 1411 | ||
1397 | status = be_mbox_notify_wait(adapter); | 1412 | status = be_mbox_notify_wait(adapter); |
1398 | 1413 | ||
1399 | spin_unlock(&adapter->mbox_lock); | 1414 | mutex_unlock(&adapter->mbox_lock); |
1400 | return status; | 1415 | return status; |
1401 | } | 1416 | } |
1402 | 1417 | ||
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 93354eee2cfd..fd251b59b7f9 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -2677,7 +2677,7 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
2677 | } | 2677 | } |
2678 | memset(mc_cmd_mem->va, 0, mc_cmd_mem->size); | 2678 | memset(mc_cmd_mem->va, 0, mc_cmd_mem->size); |
2679 | 2679 | ||
2680 | spin_lock_init(&adapter->mbox_lock); | 2680 | mutex_init(&adapter->mbox_lock); |
2681 | spin_lock_init(&adapter->mcc_lock); | 2681 | spin_lock_init(&adapter->mcc_lock); |
2682 | spin_lock_init(&adapter->mcc_cq_lock); | 2682 | spin_lock_init(&adapter->mcc_cq_lock); |
2683 | 2683 | ||
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 863e73a85fbe..d255428122fc 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -20,8 +20,8 @@ | |||
20 | * (you will need to reboot afterwards) */ | 20 | * (you will need to reboot afterwards) */ |
21 | /* #define BNX2X_STOP_ON_ERROR */ | 21 | /* #define BNX2X_STOP_ON_ERROR */ |
22 | 22 | ||
23 | #define DRV_MODULE_VERSION "1.60.00-4" | 23 | #define DRV_MODULE_VERSION "1.60.01-0" |
24 | #define DRV_MODULE_RELDATE "2010/11/01" | 24 | #define DRV_MODULE_RELDATE "2010/11/12" |
25 | #define BNX2X_BC_VER 0x040200 | 25 | #define BNX2X_BC_VER 0x040200 |
26 | 26 | ||
27 | #define BNX2X_MULTI_QUEUE | 27 | #define BNX2X_MULTI_QUEUE |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 94d5f59d5a6f..0af361e4e3d1 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -1782,15 +1782,15 @@ exit_lbl: | |||
1782 | } | 1782 | } |
1783 | #endif | 1783 | #endif |
1784 | 1784 | ||
1785 | static inline void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, | 1785 | static inline void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data, |
1786 | struct eth_tx_parse_bd_e2 *pbd, | 1786 | u32 xmit_type) |
1787 | u32 xmit_type) | ||
1788 | { | 1787 | { |
1789 | pbd->parsing_data |= cpu_to_le16(skb_shinfo(skb)->gso_size) << | 1788 | *parsing_data |= (skb_shinfo(skb)->gso_size << |
1790 | ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT; | 1789 | ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT) & |
1790 | ETH_TX_PARSE_BD_E2_LSO_MSS; | ||
1791 | if ((xmit_type & XMIT_GSO_V6) && | 1791 | if ((xmit_type & XMIT_GSO_V6) && |
1792 | (ipv6_hdr(skb)->nexthdr == NEXTHDR_IPV6)) | 1792 | (ipv6_hdr(skb)->nexthdr == NEXTHDR_IPV6)) |
1793 | pbd->parsing_data |= ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR; | 1793 | *parsing_data |= ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR; |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | /** | 1796 | /** |
@@ -1835,15 +1835,15 @@ static inline void bnx2x_set_pbd_gso(struct sk_buff *skb, | |||
1835 | * @return header len | 1835 | * @return header len |
1836 | */ | 1836 | */ |
1837 | static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb, | 1837 | static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb, |
1838 | struct eth_tx_parse_bd_e2 *pbd, | 1838 | u32 *parsing_data, u32 xmit_type) |
1839 | u32 xmit_type) | ||
1840 | { | 1839 | { |
1841 | pbd->parsing_data |= cpu_to_le16(tcp_hdrlen(skb)/4) << | 1840 | *parsing_data |= ((tcp_hdrlen(skb)/4) << |
1842 | ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT; | 1841 | ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) & |
1842 | ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW; | ||
1843 | 1843 | ||
1844 | pbd->parsing_data |= cpu_to_le16(((unsigned char *)tcp_hdr(skb) - | 1844 | *parsing_data |= ((((u8 *)tcp_hdr(skb) - skb->data) / 2) << |
1845 | skb->data) / 2) << | 1845 | ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) & |
1846 | ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT; | 1846 | ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W; |
1847 | 1847 | ||
1848 | return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data; | 1848 | return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data; |
1849 | } | 1849 | } |
@@ -1912,6 +1912,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1912 | struct eth_tx_bd *tx_data_bd, *total_pkt_bd = NULL; | 1912 | struct eth_tx_bd *tx_data_bd, *total_pkt_bd = NULL; |
1913 | struct eth_tx_parse_bd_e1x *pbd_e1x = NULL; | 1913 | struct eth_tx_parse_bd_e1x *pbd_e1x = NULL; |
1914 | struct eth_tx_parse_bd_e2 *pbd_e2 = NULL; | 1914 | struct eth_tx_parse_bd_e2 *pbd_e2 = NULL; |
1915 | u32 pbd_e2_parsing_data = 0; | ||
1915 | u16 pkt_prod, bd_prod; | 1916 | u16 pkt_prod, bd_prod; |
1916 | int nbd, fp_index; | 1917 | int nbd, fp_index; |
1917 | dma_addr_t mapping; | 1918 | dma_addr_t mapping; |
@@ -2033,8 +2034,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2033 | memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2)); | 2034 | memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2)); |
2034 | /* Set PBD in checksum offload case */ | 2035 | /* Set PBD in checksum offload case */ |
2035 | if (xmit_type & XMIT_CSUM) | 2036 | if (xmit_type & XMIT_CSUM) |
2036 | hlen = bnx2x_set_pbd_csum_e2(bp, | 2037 | hlen = bnx2x_set_pbd_csum_e2(bp, skb, |
2037 | skb, pbd_e2, xmit_type); | 2038 | &pbd_e2_parsing_data, |
2039 | xmit_type); | ||
2038 | } else { | 2040 | } else { |
2039 | pbd_e1x = &fp->tx_desc_ring[bd_prod].parse_bd_e1x; | 2041 | pbd_e1x = &fp->tx_desc_ring[bd_prod].parse_bd_e1x; |
2040 | memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x)); | 2042 | memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x)); |
@@ -2076,10 +2078,18 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2076 | bd_prod = bnx2x_tx_split(bp, fp, tx_buf, &tx_start_bd, | 2078 | bd_prod = bnx2x_tx_split(bp, fp, tx_buf, &tx_start_bd, |
2077 | hlen, bd_prod, ++nbd); | 2079 | hlen, bd_prod, ++nbd); |
2078 | if (CHIP_IS_E2(bp)) | 2080 | if (CHIP_IS_E2(bp)) |
2079 | bnx2x_set_pbd_gso_e2(skb, pbd_e2, xmit_type); | 2081 | bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, |
2082 | xmit_type); | ||
2080 | else | 2083 | else |
2081 | bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); | 2084 | bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); |
2082 | } | 2085 | } |
2086 | |||
2087 | /* Set the PBD's parsing_data field if not zero | ||
2088 | * (for the chips newer than 57711). | ||
2089 | */ | ||
2090 | if (pbd_e2_parsing_data) | ||
2091 | pbd_e2->parsing_data = cpu_to_le32(pbd_e2_parsing_data); | ||
2092 | |||
2083 | tx_data_bd = (struct eth_tx_bd *)tx_start_bd; | 2093 | tx_data_bd = (struct eth_tx_bd *)tx_start_bd; |
2084 | 2094 | ||
2085 | /* Handle fragmented skb */ | 2095 | /* Handle fragmented skb */ |
diff --git a/drivers/net/bnx2x/bnx2x_init_ops.h b/drivers/net/bnx2x/bnx2x_init_ops.h index a306b0e46b61..66df29fcf751 100644 --- a/drivers/net/bnx2x/bnx2x_init_ops.h +++ b/drivers/net/bnx2x/bnx2x_init_ops.h | |||
@@ -838,7 +838,7 @@ static void bnx2x_qm_init_ptr_table(struct bnx2x *bp, int qm_cid_count, | |||
838 | /**************************************************************************** | 838 | /**************************************************************************** |
839 | * SRC initializations | 839 | * SRC initializations |
840 | ****************************************************************************/ | 840 | ****************************************************************************/ |
841 | 841 | #ifdef BCM_CNIC | |
842 | /* called during init func stage */ | 842 | /* called during init func stage */ |
843 | static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, | 843 | static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, |
844 | dma_addr_t t2_mapping, int src_cid_count) | 844 | dma_addr_t t2_mapping, int src_cid_count) |
@@ -862,5 +862,5 @@ static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, | |||
862 | U64_HI((u64)t2_mapping + | 862 | U64_HI((u64)t2_mapping + |
863 | (src_cid_count-1) * sizeof(struct src_ent))); | 863 | (src_cid_count-1) * sizeof(struct src_ent))); |
864 | } | 864 | } |
865 | 865 | #endif | |
866 | #endif /* BNX2X_INIT_OPS_H */ | 866 | #endif /* BNX2X_INIT_OPS_H */ |
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c index 121b073a6c3f..84fbd4ebd778 100644 --- a/drivers/net/bonding/bond_ipv6.c +++ b/drivers/net/bonding/bond_ipv6.c | |||
@@ -88,7 +88,12 @@ static void bond_na_send(struct net_device *slave_dev, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | if (vlan_id) { | 90 | if (vlan_id) { |
91 | skb = vlan_put_tag(skb, vlan_id); | 91 | /* The Ethernet header is not present yet, so it is |
92 | * too early to insert a VLAN tag. Force use of an | ||
93 | * out-of-line tag here and let dev_hard_start_xmit() | ||
94 | * insert it if the slave hardware can't. | ||
95 | */ | ||
96 | skb = __vlan_hwaccel_put_tag(skb, vlan_id); | ||
92 | if (!skb) { | 97 | if (!skb) { |
93 | pr_err("failed to insert VLAN tag\n"); | 98 | pr_err("failed to insert VLAN tag\n"); |
94 | return; | 99 | return; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 71a169740d05..3b16c34ed86e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -171,7 +171,7 @@ MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link | |||
171 | /*----------------------------- Global variables ----------------------------*/ | 171 | /*----------------------------- Global variables ----------------------------*/ |
172 | 172 | ||
173 | #ifdef CONFIG_NET_POLL_CONTROLLER | 173 | #ifdef CONFIG_NET_POLL_CONTROLLER |
174 | cpumask_var_t netpoll_block_tx; | 174 | atomic_t netpoll_block_tx = ATOMIC_INIT(0); |
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | static const char * const version = | 177 | static const char * const version = |
@@ -418,36 +418,11 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | |||
418 | * @bond: bond device that got this skb for tx. | 418 | * @bond: bond device that got this skb for tx. |
419 | * @skb: hw accel VLAN tagged skb to transmit | 419 | * @skb: hw accel VLAN tagged skb to transmit |
420 | * @slave_dev: slave that is supposed to xmit this skbuff | 420 | * @slave_dev: slave that is supposed to xmit this skbuff |
421 | * | ||
422 | * When the bond gets an skb to transmit that is | ||
423 | * already hardware accelerated VLAN tagged, and it | ||
424 | * needs to relay this skb to a slave that is not | ||
425 | * hw accel capable, the skb needs to be "unaccelerated", | ||
426 | * i.e. strip the hwaccel tag and re-insert it as part | ||
427 | * of the payload. | ||
428 | */ | 421 | */ |
429 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, | 422 | int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, |
430 | struct net_device *slave_dev) | 423 | struct net_device *slave_dev) |
431 | { | 424 | { |
432 | unsigned short uninitialized_var(vlan_id); | 425 | skb->dev = slave_dev; |
433 | |||
434 | /* Test vlan_list not vlgrp to catch and handle 802.1p tags */ | ||
435 | if (!list_empty(&bond->vlan_list) && | ||
436 | !(slave_dev->features & NETIF_F_HW_VLAN_TX) && | ||
437 | vlan_get_tag(skb, &vlan_id) == 0) { | ||
438 | skb->dev = slave_dev; | ||
439 | skb = vlan_put_tag(skb, vlan_id); | ||
440 | if (!skb) { | ||
441 | /* vlan_put_tag() frees the skb in case of error, | ||
442 | * so return success here so the calling functions | ||
443 | * won't attempt to free is again. | ||
444 | */ | ||
445 | return 0; | ||
446 | } | ||
447 | } else { | ||
448 | skb->dev = slave_dev; | ||
449 | } | ||
450 | |||
451 | skb->priority = 1; | 426 | skb->priority = 1; |
452 | #ifdef CONFIG_NET_POLL_CONTROLLER | 427 | #ifdef CONFIG_NET_POLL_CONTROLLER |
453 | if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) { | 428 | if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) { |
@@ -1203,11 +1178,13 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1203 | bond_do_fail_over_mac(bond, new_active, | 1178 | bond_do_fail_over_mac(bond, new_active, |
1204 | old_active); | 1179 | old_active); |
1205 | 1180 | ||
1206 | bond->send_grat_arp = bond->params.num_grat_arp; | 1181 | if (netif_running(bond->dev)) { |
1207 | bond_send_gratuitous_arp(bond); | 1182 | bond->send_grat_arp = bond->params.num_grat_arp; |
1183 | bond_send_gratuitous_arp(bond); | ||
1208 | 1184 | ||
1209 | bond->send_unsol_na = bond->params.num_unsol_na; | 1185 | bond->send_unsol_na = bond->params.num_unsol_na; |
1210 | bond_send_unsolicited_na(bond); | 1186 | bond_send_unsolicited_na(bond); |
1187 | } | ||
1211 | 1188 | ||
1212 | write_unlock_bh(&bond->curr_slave_lock); | 1189 | write_unlock_bh(&bond->curr_slave_lock); |
1213 | read_unlock(&bond->lock); | 1190 | read_unlock(&bond->lock); |
@@ -1221,8 +1198,9 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
1221 | 1198 | ||
1222 | /* resend IGMP joins since active slave has changed or | 1199 | /* resend IGMP joins since active slave has changed or |
1223 | * all were sent on curr_active_slave */ | 1200 | * all were sent on curr_active_slave */ |
1224 | if ((USES_PRIMARY(bond->params.mode) && new_active) || | 1201 | if (((USES_PRIMARY(bond->params.mode) && new_active) || |
1225 | bond->params.mode == BOND_MODE_ROUNDROBIN) { | 1202 | bond->params.mode == BOND_MODE_ROUNDROBIN) && |
1203 | netif_running(bond->dev)) { | ||
1226 | bond->igmp_retrans = bond->params.resend_igmp; | 1204 | bond->igmp_retrans = bond->params.resend_igmp; |
1227 | queue_delayed_work(bond->wq, &bond->mcast_work, 0); | 1205 | queue_delayed_work(bond->wq, &bond->mcast_work, 0); |
1228 | } | 1206 | } |
@@ -1576,7 +1554,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1576 | 1554 | ||
1577 | /* If this is the first slave, then we need to set the master's hardware | 1555 | /* If this is the first slave, then we need to set the master's hardware |
1578 | * address to be the same as the slave's. */ | 1556 | * address to be the same as the slave's. */ |
1579 | if (bond->slave_cnt == 0) | 1557 | if (is_zero_ether_addr(bond->dev->dev_addr)) |
1580 | memcpy(bond->dev->dev_addr, slave_dev->dev_addr, | 1558 | memcpy(bond->dev->dev_addr, slave_dev->dev_addr, |
1581 | slave_dev->addr_len); | 1559 | slave_dev->addr_len); |
1582 | 1560 | ||
@@ -5299,13 +5277,6 @@ static int __init bonding_init(void) | |||
5299 | if (res) | 5277 | if (res) |
5300 | goto out; | 5278 | goto out; |
5301 | 5279 | ||
5302 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
5303 | if (!alloc_cpumask_var(&netpoll_block_tx, GFP_KERNEL)) { | ||
5304 | res = -ENOMEM; | ||
5305 | goto out; | ||
5306 | } | ||
5307 | #endif | ||
5308 | |||
5309 | res = register_pernet_subsys(&bond_net_ops); | 5280 | res = register_pernet_subsys(&bond_net_ops); |
5310 | if (res) | 5281 | if (res) |
5311 | goto out; | 5282 | goto out; |
@@ -5334,9 +5305,6 @@ err: | |||
5334 | rtnl_link_unregister(&bond_link_ops); | 5305 | rtnl_link_unregister(&bond_link_ops); |
5335 | err_link: | 5306 | err_link: |
5336 | unregister_pernet_subsys(&bond_net_ops); | 5307 | unregister_pernet_subsys(&bond_net_ops); |
5337 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
5338 | free_cpumask_var(netpoll_block_tx); | ||
5339 | #endif | ||
5340 | goto out; | 5308 | goto out; |
5341 | 5309 | ||
5342 | } | 5310 | } |
@@ -5353,7 +5321,10 @@ static void __exit bonding_exit(void) | |||
5353 | unregister_pernet_subsys(&bond_net_ops); | 5321 | unregister_pernet_subsys(&bond_net_ops); |
5354 | 5322 | ||
5355 | #ifdef CONFIG_NET_POLL_CONTROLLER | 5323 | #ifdef CONFIG_NET_POLL_CONTROLLER |
5356 | free_cpumask_var(netpoll_block_tx); | 5324 | /* |
5325 | * Make sure we don't have an imbalance on our netpoll blocking | ||
5326 | */ | ||
5327 | WARN_ON(atomic_read(&netpoll_block_tx)); | ||
5357 | #endif | 5328 | #endif |
5358 | } | 5329 | } |
5359 | 5330 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 4eedb12df6ca..4feeb2d650a4 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -119,26 +119,22 @@ | |||
119 | 119 | ||
120 | 120 | ||
121 | #ifdef CONFIG_NET_POLL_CONTROLLER | 121 | #ifdef CONFIG_NET_POLL_CONTROLLER |
122 | extern cpumask_var_t netpoll_block_tx; | 122 | extern atomic_t netpoll_block_tx; |
123 | 123 | ||
124 | static inline void block_netpoll_tx(void) | 124 | static inline void block_netpoll_tx(void) |
125 | { | 125 | { |
126 | preempt_disable(); | 126 | atomic_inc(&netpoll_block_tx); |
127 | BUG_ON(cpumask_test_and_set_cpu(smp_processor_id(), | ||
128 | netpoll_block_tx)); | ||
129 | } | 127 | } |
130 | 128 | ||
131 | static inline void unblock_netpoll_tx(void) | 129 | static inline void unblock_netpoll_tx(void) |
132 | { | 130 | { |
133 | BUG_ON(!cpumask_test_and_clear_cpu(smp_processor_id(), | 131 | atomic_dec(&netpoll_block_tx); |
134 | netpoll_block_tx)); | ||
135 | preempt_enable(); | ||
136 | } | 132 | } |
137 | 133 | ||
138 | static inline int is_netpoll_tx_blocked(struct net_device *dev) | 134 | static inline int is_netpoll_tx_blocked(struct net_device *dev) |
139 | { | 135 | { |
140 | if (unlikely(dev->priv_flags & IFF_IN_NETPOLL)) | 136 | if (unlikely(dev->priv_flags & IFF_IN_NETPOLL)) |
141 | return cpumask_test_cpu(smp_processor_id(), netpoll_block_tx); | 137 | return atomic_read(&netpoll_block_tx); |
142 | return 0; | 138 | return 0; |
143 | } | 139 | } |
144 | #else | 140 | #else |
@@ -273,11 +269,11 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n | |||
273 | 269 | ||
274 | bond_for_each_slave(bond, slave, i) { | 270 | bond_for_each_slave(bond, slave, i) { |
275 | if (slave->dev == slave_dev) { | 271 | if (slave->dev == slave_dev) { |
276 | break; | 272 | return slave; |
277 | } | 273 | } |
278 | } | 274 | } |
279 | 275 | ||
280 | return slave; | 276 | return 0; |
281 | } | 277 | } |
282 | 278 | ||
283 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | 279 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) |
diff --git a/drivers/net/caif/caif_shm_u5500.c b/drivers/net/caif/caif_shm_u5500.c index 1cd90da86f13..32b1c6fb2de1 100644 --- a/drivers/net/caif/caif_shm_u5500.c +++ b/drivers/net/caif/caif_shm_u5500.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * License terms: GNU General Public License (GPL) version 2 | 5 | * License terms: GNU General Public License (GPL) version 2 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ":" fmt |
9 | 9 | ||
10 | #include <linux/version.h> | 10 | #include <linux/version.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
diff --git a/drivers/net/caif/caif_shmcore.c b/drivers/net/caif/caif_shmcore.c index 19f9c0656667..80511167f35b 100644 --- a/drivers/net/caif/caif_shmcore.c +++ b/drivers/net/caif/caif_shmcore.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * License terms: GNU General Public License (GPL) version 2 | 6 | * License terms: GNU General Public License (GPL) version 2 |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt | 9 | #define pr_fmt(fmt) KBUILD_MODNAME ":" fmt |
10 | 10 | ||
11 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c index bb813d94aea8..e97521c801ea 100644 --- a/drivers/net/cxgb4/t4_hw.c +++ b/drivers/net/cxgb4/t4_hw.c | |||
@@ -2408,7 +2408,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, | |||
2408 | if (index < NEXACT_MAC) | 2408 | if (index < NEXACT_MAC) |
2409 | ret++; | 2409 | ret++; |
2410 | else if (hash) | 2410 | else if (hash) |
2411 | *hash |= (1 << hash_mac_addr(addr[i])); | 2411 | *hash |= (1ULL << hash_mac_addr(addr[i])); |
2412 | } | 2412 | } |
2413 | return ret; | 2413 | return ret; |
2414 | } | 2414 | } |
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c index c3449bbc585a..6bf464afa90e 100644 --- a/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c | |||
@@ -816,40 +816,48 @@ static struct net_device_stats *cxgb4vf_get_stats(struct net_device *dev) | |||
816 | } | 816 | } |
817 | 817 | ||
818 | /* | 818 | /* |
819 | * Collect up to maxaddrs worth of a netdevice's unicast addresses into an | 819 | * Collect up to maxaddrs worth of a netdevice's unicast addresses, starting |
820 | * array of addrss pointers and return the number collected. | 820 | * at a specified offset within the list, into an array of addrss pointers and |
821 | * return the number collected. | ||
821 | */ | 822 | */ |
822 | static inline int collect_netdev_uc_list_addrs(const struct net_device *dev, | 823 | static inline unsigned int collect_netdev_uc_list_addrs(const struct net_device *dev, |
823 | const u8 **addr, | 824 | const u8 **addr, |
824 | unsigned int maxaddrs) | 825 | unsigned int offset, |
826 | unsigned int maxaddrs) | ||
825 | { | 827 | { |
828 | unsigned int index = 0; | ||
826 | unsigned int naddr = 0; | 829 | unsigned int naddr = 0; |
827 | const struct netdev_hw_addr *ha; | 830 | const struct netdev_hw_addr *ha; |
828 | 831 | ||
829 | for_each_dev_addr(dev, ha) { | 832 | for_each_dev_addr(dev, ha) |
830 | addr[naddr++] = ha->addr; | 833 | if (index++ >= offset) { |
831 | if (naddr >= maxaddrs) | 834 | addr[naddr++] = ha->addr; |
832 | break; | 835 | if (naddr >= maxaddrs) |
833 | } | 836 | break; |
837 | } | ||
834 | return naddr; | 838 | return naddr; |
835 | } | 839 | } |
836 | 840 | ||
837 | /* | 841 | /* |
838 | * Collect up to maxaddrs worth of a netdevice's multicast addresses into an | 842 | * Collect up to maxaddrs worth of a netdevice's multicast addresses, starting |
839 | * array of addrss pointers and return the number collected. | 843 | * at a specified offset within the list, into an array of addrss pointers and |
844 | * return the number collected. | ||
840 | */ | 845 | */ |
841 | static inline int collect_netdev_mc_list_addrs(const struct net_device *dev, | 846 | static inline unsigned int collect_netdev_mc_list_addrs(const struct net_device *dev, |
842 | const u8 **addr, | 847 | const u8 **addr, |
843 | unsigned int maxaddrs) | 848 | unsigned int offset, |
849 | unsigned int maxaddrs) | ||
844 | { | 850 | { |
851 | unsigned int index = 0; | ||
845 | unsigned int naddr = 0; | 852 | unsigned int naddr = 0; |
846 | const struct netdev_hw_addr *ha; | 853 | const struct netdev_hw_addr *ha; |
847 | 854 | ||
848 | netdev_for_each_mc_addr(ha, dev) { | 855 | netdev_for_each_mc_addr(ha, dev) |
849 | addr[naddr++] = ha->addr; | 856 | if (index++ >= offset) { |
850 | if (naddr >= maxaddrs) | 857 | addr[naddr++] = ha->addr; |
851 | break; | 858 | if (naddr >= maxaddrs) |
852 | } | 859 | break; |
860 | } | ||
853 | return naddr; | 861 | return naddr; |
854 | } | 862 | } |
855 | 863 | ||
@@ -862,16 +870,20 @@ static int set_addr_filters(const struct net_device *dev, bool sleep) | |||
862 | u64 mhash = 0; | 870 | u64 mhash = 0; |
863 | u64 uhash = 0; | 871 | u64 uhash = 0; |
864 | bool free = true; | 872 | bool free = true; |
865 | u16 filt_idx[7]; | 873 | unsigned int offset, naddr; |
866 | const u8 *addr[7]; | 874 | const u8 *addr[7]; |
867 | int ret, naddr = 0; | 875 | int ret; |
868 | const struct port_info *pi = netdev_priv(dev); | 876 | const struct port_info *pi = netdev_priv(dev); |
869 | 877 | ||
870 | /* first do the secondary unicast addresses */ | 878 | /* first do the secondary unicast addresses */ |
871 | naddr = collect_netdev_uc_list_addrs(dev, addr, ARRAY_SIZE(addr)); | 879 | for (offset = 0; ; offset += naddr) { |
872 | if (naddr > 0) { | 880 | naddr = collect_netdev_uc_list_addrs(dev, addr, offset, |
881 | ARRAY_SIZE(addr)); | ||
882 | if (naddr == 0) | ||
883 | break; | ||
884 | |||
873 | ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, | 885 | ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, |
874 | naddr, addr, filt_idx, &uhash, sleep); | 886 | naddr, addr, NULL, &uhash, sleep); |
875 | if (ret < 0) | 887 | if (ret < 0) |
876 | return ret; | 888 | return ret; |
877 | 889 | ||
@@ -879,12 +891,17 @@ static int set_addr_filters(const struct net_device *dev, bool sleep) | |||
879 | } | 891 | } |
880 | 892 | ||
881 | /* next set up the multicast addresses */ | 893 | /* next set up the multicast addresses */ |
882 | naddr = collect_netdev_mc_list_addrs(dev, addr, ARRAY_SIZE(addr)); | 894 | for (offset = 0; ; offset += naddr) { |
883 | if (naddr > 0) { | 895 | naddr = collect_netdev_mc_list_addrs(dev, addr, offset, |
896 | ARRAY_SIZE(addr)); | ||
897 | if (naddr == 0) | ||
898 | break; | ||
899 | |||
884 | ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, | 900 | ret = t4vf_alloc_mac_filt(pi->adapter, pi->viid, free, |
885 | naddr, addr, filt_idx, &mhash, sleep); | 901 | naddr, addr, NULL, &mhash, sleep); |
886 | if (ret < 0) | 902 | if (ret < 0) |
887 | return ret; | 903 | return ret; |
904 | free = false; | ||
888 | } | 905 | } |
889 | 906 | ||
890 | return t4vf_set_addr_hash(pi->adapter, pi->viid, uhash != 0, | 907 | return t4vf_set_addr_hash(pi->adapter, pi->viid, uhash != 0, |
@@ -2252,6 +2269,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2252 | { | 2269 | { |
2253 | struct sge *s = &adapter->sge; | 2270 | struct sge *s = &adapter->sge; |
2254 | int q10g, n10g, qidx, pidx, qs; | 2271 | int q10g, n10g, qidx, pidx, qs; |
2272 | size_t iqe_size; | ||
2255 | 2273 | ||
2256 | /* | 2274 | /* |
2257 | * We should not be called till we know how many Queue Sets we can | 2275 | * We should not be called till we know how many Queue Sets we can |
@@ -2296,6 +2314,13 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2296 | s->ethqsets = qidx; | 2314 | s->ethqsets = qidx; |
2297 | 2315 | ||
2298 | /* | 2316 | /* |
2317 | * The Ingress Queue Entry Size for our various Response Queues needs | ||
2318 | * to be big enough to accommodate the largest message we can receive | ||
2319 | * from the chip/firmware; which is 64 bytes ... | ||
2320 | */ | ||
2321 | iqe_size = 64; | ||
2322 | |||
2323 | /* | ||
2299 | * Set up default Queue Set parameters ... Start off with the | 2324 | * Set up default Queue Set parameters ... Start off with the |
2300 | * shortest interrupt holdoff timer. | 2325 | * shortest interrupt holdoff timer. |
2301 | */ | 2326 | */ |
@@ -2303,7 +2328,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2303 | struct sge_eth_rxq *rxq = &s->ethrxq[qs]; | 2328 | struct sge_eth_rxq *rxq = &s->ethrxq[qs]; |
2304 | struct sge_eth_txq *txq = &s->ethtxq[qs]; | 2329 | struct sge_eth_txq *txq = &s->ethtxq[qs]; |
2305 | 2330 | ||
2306 | init_rspq(&rxq->rspq, 0, 0, 1024, L1_CACHE_BYTES); | 2331 | init_rspq(&rxq->rspq, 0, 0, 1024, iqe_size); |
2307 | rxq->fl.size = 72; | 2332 | rxq->fl.size = 72; |
2308 | txq->q.size = 1024; | 2333 | txq->q.size = 1024; |
2309 | } | 2334 | } |
@@ -2312,8 +2337,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2312 | * The firmware event queue is used for link state changes and | 2337 | * The firmware event queue is used for link state changes and |
2313 | * notifications of TX DMA completions. | 2338 | * notifications of TX DMA completions. |
2314 | */ | 2339 | */ |
2315 | init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, | 2340 | init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, iqe_size); |
2316 | L1_CACHE_BYTES); | ||
2317 | 2341 | ||
2318 | /* | 2342 | /* |
2319 | * The forwarded interrupt queue is used when we're in MSI interrupt | 2343 | * The forwarded interrupt queue is used when we're in MSI interrupt |
@@ -2329,7 +2353,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2329 | * any time ... | 2353 | * any time ... |
2330 | */ | 2354 | */ |
2331 | init_rspq(&s->intrq, SGE_TIMER_RSTRT_CNTR, 0, MSIX_ENTRIES + 1, | 2355 | init_rspq(&s->intrq, SGE_TIMER_RSTRT_CNTR, 0, MSIX_ENTRIES + 1, |
2332 | L1_CACHE_BYTES); | 2356 | iqe_size); |
2333 | } | 2357 | } |
2334 | 2358 | ||
2335 | /* | 2359 | /* |
diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c index e306c20dfaee..19520afe1a12 100644 --- a/drivers/net/cxgb4vf/t4vf_hw.c +++ b/drivers/net/cxgb4vf/t4vf_hw.c | |||
@@ -1014,48 +1014,72 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free, | |||
1014 | unsigned int naddr, const u8 **addr, u16 *idx, | 1014 | unsigned int naddr, const u8 **addr, u16 *idx, |
1015 | u64 *hash, bool sleep_ok) | 1015 | u64 *hash, bool sleep_ok) |
1016 | { | 1016 | { |
1017 | int i, ret; | 1017 | int offset, ret = 0; |
1018 | unsigned nfilters = 0; | ||
1019 | unsigned int rem = naddr; | ||
1018 | struct fw_vi_mac_cmd cmd, rpl; | 1020 | struct fw_vi_mac_cmd cmd, rpl; |
1019 | struct fw_vi_mac_exact *p; | ||
1020 | size_t len16; | ||
1021 | 1021 | ||
1022 | if (naddr > ARRAY_SIZE(cmd.u.exact)) | 1022 | if (naddr > FW_CLS_TCAM_NUM_ENTRIES) |
1023 | return -EINVAL; | 1023 | return -EINVAL; |
1024 | len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd, | ||
1025 | u.exact[naddr]), 16); | ||
1026 | 1024 | ||
1027 | memset(&cmd, 0, sizeof(cmd)); | 1025 | for (offset = 0; offset < naddr; /**/) { |
1028 | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP(FW_VI_MAC_CMD) | | 1026 | unsigned int fw_naddr = (rem < ARRAY_SIZE(cmd.u.exact) |
1029 | FW_CMD_REQUEST | | 1027 | ? rem |
1030 | FW_CMD_WRITE | | 1028 | : ARRAY_SIZE(cmd.u.exact)); |
1031 | (free ? FW_CMD_EXEC : 0) | | 1029 | size_t len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd, |
1032 | FW_VI_MAC_CMD_VIID(viid)); | 1030 | u.exact[fw_naddr]), 16); |
1033 | cmd.freemacs_to_len16 = cpu_to_be32(FW_VI_MAC_CMD_FREEMACS(free) | | 1031 | struct fw_vi_mac_exact *p; |
1034 | FW_CMD_LEN16(len16)); | 1032 | int i; |
1035 | 1033 | ||
1036 | for (i = 0, p = cmd.u.exact; i < naddr; i++, p++) { | 1034 | memset(&cmd, 0, sizeof(cmd)); |
1037 | p->valid_to_idx = | 1035 | cmd.op_to_viid = cpu_to_be32(FW_CMD_OP(FW_VI_MAC_CMD) | |
1038 | cpu_to_be16(FW_VI_MAC_CMD_VALID | | 1036 | FW_CMD_REQUEST | |
1039 | FW_VI_MAC_CMD_IDX(FW_VI_MAC_ADD_MAC)); | 1037 | FW_CMD_WRITE | |
1040 | memcpy(p->macaddr, addr[i], sizeof(p->macaddr)); | 1038 | (free ? FW_CMD_EXEC : 0) | |
1041 | } | 1039 | FW_VI_MAC_CMD_VIID(viid)); |
1040 | cmd.freemacs_to_len16 = | ||
1041 | cpu_to_be32(FW_VI_MAC_CMD_FREEMACS(free) | | ||
1042 | FW_CMD_LEN16(len16)); | ||
1043 | |||
1044 | for (i = 0, p = cmd.u.exact; i < fw_naddr; i++, p++) { | ||
1045 | p->valid_to_idx = cpu_to_be16( | ||
1046 | FW_VI_MAC_CMD_VALID | | ||
1047 | FW_VI_MAC_CMD_IDX(FW_VI_MAC_ADD_MAC)); | ||
1048 | memcpy(p->macaddr, addr[offset+i], sizeof(p->macaddr)); | ||
1049 | } | ||
1050 | |||
1051 | |||
1052 | ret = t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), &rpl, | ||
1053 | sleep_ok); | ||
1054 | if (ret && ret != -ENOMEM) | ||
1055 | break; | ||
1042 | 1056 | ||
1043 | ret = t4vf_wr_mbox_core(adapter, &cmd, sizeof(cmd), &rpl, sleep_ok); | 1057 | for (i = 0, p = rpl.u.exact; i < fw_naddr; i++, p++) { |
1044 | if (ret) | 1058 | u16 index = FW_VI_MAC_CMD_IDX_GET( |
1045 | return ret; | 1059 | be16_to_cpu(p->valid_to_idx)); |
1046 | 1060 | ||
1047 | for (i = 0, p = rpl.u.exact; i < naddr; i++, p++) { | 1061 | if (idx) |
1048 | u16 index = FW_VI_MAC_CMD_IDX_GET(be16_to_cpu(p->valid_to_idx)); | 1062 | idx[offset+i] = |
1049 | 1063 | (index >= FW_CLS_TCAM_NUM_ENTRIES | |
1050 | if (idx) | 1064 | ? 0xffff |
1051 | idx[i] = (index >= FW_CLS_TCAM_NUM_ENTRIES | 1065 | : index); |
1052 | ? 0xffff | 1066 | if (index < FW_CLS_TCAM_NUM_ENTRIES) |
1053 | : index); | 1067 | nfilters++; |
1054 | if (index < FW_CLS_TCAM_NUM_ENTRIES) | 1068 | else if (hash) |
1055 | ret++; | 1069 | *hash |= (1ULL << hash_mac_addr(addr[offset+i])); |
1056 | else if (hash) | 1070 | } |
1057 | *hash |= (1 << hash_mac_addr(addr[i])); | 1071 | |
1072 | free = false; | ||
1073 | offset += fw_naddr; | ||
1074 | rem -= fw_naddr; | ||
1058 | } | 1075 | } |
1076 | |||
1077 | /* | ||
1078 | * If there were no errors or we merely ran out of room in our MAC | ||
1079 | * address arena, return the number of filters actually written. | ||
1080 | */ | ||
1081 | if (ret == 0 || ret == -ENOMEM) | ||
1082 | ret = nfilters; | ||
1059 | return ret; | 1083 | return ret; |
1060 | } | 1084 | } |
1061 | 1085 | ||
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c index 75b099ce49c9..1f37ee6b2a26 100644 --- a/drivers/net/ehea/ehea_ethtool.c +++ b/drivers/net/ehea/ehea_ethtool.c | |||
@@ -261,6 +261,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev, | |||
261 | 261 | ||
262 | } | 262 | } |
263 | 263 | ||
264 | static int ehea_set_flags(struct net_device *dev, u32 data) | ||
265 | { | ||
266 | return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO | ||
267 | | ETH_FLAG_TXVLAN | ||
268 | | ETH_FLAG_RXVLAN); | ||
269 | } | ||
270 | |||
264 | const struct ethtool_ops ehea_ethtool_ops = { | 271 | const struct ethtool_ops ehea_ethtool_ops = { |
265 | .get_settings = ehea_get_settings, | 272 | .get_settings = ehea_get_settings, |
266 | .get_drvinfo = ehea_get_drvinfo, | 273 | .get_drvinfo = ehea_get_drvinfo, |
@@ -273,6 +280,8 @@ const struct ethtool_ops ehea_ethtool_ops = { | |||
273 | .get_ethtool_stats = ehea_get_ethtool_stats, | 280 | .get_ethtool_stats = ehea_get_ethtool_stats, |
274 | .get_rx_csum = ehea_get_rx_csum, | 281 | .get_rx_csum = ehea_get_rx_csum, |
275 | .set_settings = ehea_set_settings, | 282 | .set_settings = ehea_set_settings, |
283 | .get_flags = ethtool_op_get_flags, | ||
284 | .set_flags = ehea_set_flags, | ||
276 | .nway_reset = ehea_nway_reset, /* Restart autonegotiation */ | 285 | .nway_reset = ehea_nway_reset, /* Restart autonegotiation */ |
277 | }; | 286 | }; |
278 | 287 | ||
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 182b2a7be8dc..b95f087cd5a9 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -400,6 +400,7 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) | |||
400 | skb_arr_rq1[index] = netdev_alloc_skb(dev, | 400 | skb_arr_rq1[index] = netdev_alloc_skb(dev, |
401 | EHEA_L_PKT_SIZE); | 401 | EHEA_L_PKT_SIZE); |
402 | if (!skb_arr_rq1[index]) { | 402 | if (!skb_arr_rq1[index]) { |
403 | ehea_info("Unable to allocate enough skb in the array\n"); | ||
403 | pr->rq1_skba.os_skbs = fill_wqes - i; | 404 | pr->rq1_skba.os_skbs = fill_wqes - i; |
404 | break; | 405 | break; |
405 | } | 406 | } |
@@ -422,13 +423,20 @@ static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a) | |||
422 | struct net_device *dev = pr->port->netdev; | 423 | struct net_device *dev = pr->port->netdev; |
423 | int i; | 424 | int i; |
424 | 425 | ||
425 | for (i = 0; i < pr->rq1_skba.len; i++) { | 426 | if (nr_rq1a > pr->rq1_skba.len) { |
427 | ehea_error("NR_RQ1A bigger than skb array len\n"); | ||
428 | return; | ||
429 | } | ||
430 | |||
431 | for (i = 0; i < nr_rq1a; i++) { | ||
426 | skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); | 432 | skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE); |
427 | if (!skb_arr_rq1[i]) | 433 | if (!skb_arr_rq1[i]) { |
434 | ehea_info("No enough memory to allocate skb array\n"); | ||
428 | break; | 435 | break; |
436 | } | ||
429 | } | 437 | } |
430 | /* Ring doorbell */ | 438 | /* Ring doorbell */ |
431 | ehea_update_rq1a(pr->qp, nr_rq1a); | 439 | ehea_update_rq1a(pr->qp, i); |
432 | } | 440 | } |
433 | 441 | ||
434 | static int ehea_refill_rq_def(struct ehea_port_res *pr, | 442 | static int ehea_refill_rq_def(struct ehea_port_res *pr, |
@@ -675,7 +683,7 @@ static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe, | |||
675 | int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && | 683 | int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && |
676 | pr->port->vgrp); | 684 | pr->port->vgrp); |
677 | 685 | ||
678 | if (use_lro) { | 686 | if (skb->dev->features & NETIF_F_LRO) { |
679 | if (vlan_extracted) | 687 | if (vlan_extracted) |
680 | lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, | 688 | lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, |
681 | pr->port->vgrp, | 689 | pr->port->vgrp, |
@@ -735,8 +743,10 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
735 | 743 | ||
736 | skb = netdev_alloc_skb(dev, | 744 | skb = netdev_alloc_skb(dev, |
737 | EHEA_L_PKT_SIZE); | 745 | EHEA_L_PKT_SIZE); |
738 | if (!skb) | 746 | if (!skb) { |
747 | ehea_info("Not enough memory to allocate skb\n"); | ||
739 | break; | 748 | break; |
749 | } | ||
740 | } | 750 | } |
741 | skb_copy_to_linear_data(skb, ((char *)cqe) + 64, | 751 | skb_copy_to_linear_data(skb, ((char *)cqe) + 64, |
742 | cqe->num_bytes_transfered - 4); | 752 | cqe->num_bytes_transfered - 4); |
@@ -777,7 +787,7 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
777 | } | 787 | } |
778 | cqe = ehea_poll_rq1(qp, &wqe_index); | 788 | cqe = ehea_poll_rq1(qp, &wqe_index); |
779 | } | 789 | } |
780 | if (use_lro) | 790 | if (dev->features & NETIF_F_LRO) |
781 | lro_flush_all(&pr->lro_mgr); | 791 | lro_flush_all(&pr->lro_mgr); |
782 | 792 | ||
783 | pr->rx_packets += processed; | 793 | pr->rx_packets += processed; |
@@ -3268,6 +3278,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
3268 | | NETIF_F_LLTX; | 3278 | | NETIF_F_LLTX; |
3269 | dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; | 3279 | dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; |
3270 | 3280 | ||
3281 | if (use_lro) | ||
3282 | dev->features |= NETIF_F_LRO; | ||
3283 | |||
3271 | INIT_WORK(&port->reset_task, ehea_reset_port); | 3284 | INIT_WORK(&port->reset_task, ehea_reset_port); |
3272 | 3285 | ||
3273 | ret = register_netdev(dev); | 3286 | ret = register_netdev(dev); |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index a466ef91dd43..aa28b270c045 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -1962,7 +1962,8 @@ static void enic_poll_controller(struct net_device *netdev) | |||
1962 | case VNIC_DEV_INTR_MODE_MSIX: | 1962 | case VNIC_DEV_INTR_MODE_MSIX: |
1963 | for (i = 0; i < enic->rq_count; i++) { | 1963 | for (i = 0; i < enic->rq_count; i++) { |
1964 | intr = enic_msix_rq_intr(enic, i); | 1964 | intr = enic_msix_rq_intr(enic, i); |
1965 | enic_isr_msix_rq(enic->msix_entry[intr].vector, enic); | 1965 | enic_isr_msix_rq(enic->msix_entry[intr].vector, |
1966 | &enic->napi[i]); | ||
1966 | } | 1967 | } |
1967 | intr = enic_msix_wq_intr(enic, i); | 1968 | intr = enic_msix_wq_intr(enic, i); |
1968 | enic_isr_msix_wq(enic->msix_entry[intr].vector, enic); | 1969 | enic_isr_msix_wq(enic->msix_entry[intr].vector, enic); |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index aa56963ad558..c353bf3113cc 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -935,7 +935,7 @@ static void epic_init_ring(struct net_device *dev) | |||
935 | 935 | ||
936 | /* Fill in the Rx buffers. Handle allocation failure gracefully. */ | 936 | /* Fill in the Rx buffers. Handle allocation failure gracefully. */ |
937 | for (i = 0; i < RX_RING_SIZE; i++) { | 937 | for (i = 0; i < RX_RING_SIZE; i++) { |
938 | struct sk_buff *skb = dev_alloc_skb(ep->rx_buf_sz); | 938 | struct sk_buff *skb = dev_alloc_skb(ep->rx_buf_sz + 2); |
939 | ep->rx_skbuff[i] = skb; | 939 | ep->rx_skbuff[i] = skb; |
940 | if (skb == NULL) | 940 | if (skb == NULL) |
941 | break; | 941 | break; |
@@ -1233,7 +1233,7 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1233 | entry = ep->dirty_rx % RX_RING_SIZE; | 1233 | entry = ep->dirty_rx % RX_RING_SIZE; |
1234 | if (ep->rx_skbuff[entry] == NULL) { | 1234 | if (ep->rx_skbuff[entry] == NULL) { |
1235 | struct sk_buff *skb; | 1235 | struct sk_buff *skb; |
1236 | skb = ep->rx_skbuff[entry] = dev_alloc_skb(ep->rx_buf_sz); | 1236 | skb = ep->rx_skbuff[entry] = dev_alloc_skb(ep->rx_buf_sz + 2); |
1237 | if (skb == NULL) | 1237 | if (skb == NULL) |
1238 | break; | 1238 | break; |
1239 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ | 1239 | skb_reserve(skb, 2); /* Align IP on 16 byte boundaries */ |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 9a6485892b3d..80d25ed53344 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -1202,7 +1202,7 @@ static void hamachi_init_ring(struct net_device *dev) | |||
1202 | } | 1202 | } |
1203 | /* Fill in the Rx buffers. Handle allocation failure gracefully. */ | 1203 | /* Fill in the Rx buffers. Handle allocation failure gracefully. */ |
1204 | for (i = 0; i < RX_RING_SIZE; i++) { | 1204 | for (i = 0; i < RX_RING_SIZE; i++) { |
1205 | struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); | 1205 | struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz + 2); |
1206 | hmp->rx_skbuff[i] = skb; | 1206 | hmp->rx_skbuff[i] = skb; |
1207 | if (skb == NULL) | 1207 | if (skb == NULL) |
1208 | break; | 1208 | break; |
@@ -1669,7 +1669,7 @@ static int hamachi_rx(struct net_device *dev) | |||
1669 | entry = hmp->dirty_rx % RX_RING_SIZE; | 1669 | entry = hmp->dirty_rx % RX_RING_SIZE; |
1670 | desc = &(hmp->rx_ring[entry]); | 1670 | desc = &(hmp->rx_ring[entry]); |
1671 | if (hmp->rx_skbuff[entry] == NULL) { | 1671 | if (hmp->rx_skbuff[entry] == NULL) { |
1672 | struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz); | 1672 | struct sk_buff *skb = dev_alloc_skb(hmp->rx_buf_sz + 2); |
1673 | 1673 | ||
1674 | hmp->rx_skbuff[entry] = skb; | 1674 | hmp->rx_skbuff[entry] = skb; |
1675 | if (skb == NULL) | 1675 | if (skb == NULL) |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index ab9f675c5b8b..fe337bd121aa 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -104,6 +104,8 @@ static void ri_tasklet(unsigned long dev) | |||
104 | rcu_read_unlock(); | 104 | rcu_read_unlock(); |
105 | dev_kfree_skb(skb); | 105 | dev_kfree_skb(skb); |
106 | stats->tx_dropped++; | 106 | stats->tx_dropped++; |
107 | if (skb_queue_len(&dp->tq) != 0) | ||
108 | goto resched; | ||
107 | break; | 109 | break; |
108 | } | 110 | } |
109 | rcu_read_unlock(); | 111 | rcu_read_unlock(); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index fbad4d819608..eee0b298bd36 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -4771,6 +4771,9 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter) | |||
4771 | adapter->rx_ring[i] = NULL; | 4771 | adapter->rx_ring[i] = NULL; |
4772 | } | 4772 | } |
4773 | 4773 | ||
4774 | adapter->num_tx_queues = 0; | ||
4775 | adapter->num_rx_queues = 0; | ||
4776 | |||
4774 | ixgbe_free_q_vectors(adapter); | 4777 | ixgbe_free_q_vectors(adapter); |
4775 | ixgbe_reset_interrupt_capability(adapter); | 4778 | ixgbe_reset_interrupt_capability(adapter); |
4776 | } | 4779 | } |
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index b68eee2414c2..7a7e18ba278a 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c | |||
@@ -289,6 +289,10 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
289 | MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET); | 289 | MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET); |
290 | dev_cap->bf_reg_size = 1 << (field & 0x1f); | 290 | dev_cap->bf_reg_size = 1 << (field & 0x1f); |
291 | MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET); | 291 | MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET); |
292 | if ((1 << (field & 0x3f)) > (PAGE_SIZE / dev_cap->bf_reg_size)) { | ||
293 | mlx4_warn(dev, "firmware bug: log2 # of blue flame regs is invalid (%d), forcing 3\n", field & 0x1f); | ||
294 | field = 3; | ||
295 | } | ||
292 | dev_cap->bf_regs_per_page = 1 << (field & 0x3f); | 296 | dev_cap->bf_regs_per_page = 1 << (field & 0x3f); |
293 | mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n", | 297 | mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n", |
294 | dev_cap->bf_reg_size, dev_cap->bf_regs_per_page); | 298 | dev_cap->bf_reg_size, dev_cap->bf_regs_per_page); |
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c index 472056b47440..03a1d280105f 100644 --- a/drivers/net/pch_gbe/pch_gbe_main.c +++ b/drivers/net/pch_gbe/pch_gbe_main.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1999 - 2010 Intel Corporation. | 2 | * Copyright (C) 1999 - 2010 Intel Corporation. |
3 | * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. | 3 | * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. |
4 | * | 4 | * |
5 | * This code was derived from the Intel e1000e Linux driver. | 5 | * This code was derived from the Intel e1000e Linux driver. |
6 | * | 6 | * |
@@ -2464,8 +2464,8 @@ static void __exit pch_gbe_exit_module(void) | |||
2464 | module_init(pch_gbe_init_module); | 2464 | module_init(pch_gbe_init_module); |
2465 | module_exit(pch_gbe_exit_module); | 2465 | module_exit(pch_gbe_exit_module); |
2466 | 2466 | ||
2467 | MODULE_DESCRIPTION("OKI semiconductor PCH Gigabit ethernet Driver"); | 2467 | MODULE_DESCRIPTION("EG20T PCH Gigabit ethernet Driver"); |
2468 | MODULE_AUTHOR("OKI semiconductor, <masa-korg@dsn.okisemi.com>"); | 2468 | MODULE_AUTHOR("OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>"); |
2469 | MODULE_LICENSE("GPL"); | 2469 | MODULE_LICENSE("GPL"); |
2470 | MODULE_VERSION(DRV_VERSION); | 2470 | MODULE_VERSION(DRV_VERSION); |
2471 | MODULE_DEVICE_TABLE(pci, pch_gbe_pcidev_id); | 2471 | MODULE_DEVICE_TABLE(pci, pch_gbe_pcidev_id); |
diff --git a/drivers/net/pch_gbe/pch_gbe_param.c b/drivers/net/pch_gbe/pch_gbe_param.c index 2510146fc560..ef0996a0eaaa 100644 --- a/drivers/net/pch_gbe/pch_gbe_param.c +++ b/drivers/net/pch_gbe/pch_gbe_param.c | |||
@@ -434,8 +434,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) | |||
434 | .err = "using default of " | 434 | .err = "using default of " |
435 | __MODULE_STRING(PCH_GBE_DEFAULT_TXD), | 435 | __MODULE_STRING(PCH_GBE_DEFAULT_TXD), |
436 | .def = PCH_GBE_DEFAULT_TXD, | 436 | .def = PCH_GBE_DEFAULT_TXD, |
437 | .arg = { .r = { .min = PCH_GBE_MIN_TXD } }, | 437 | .arg = { .r = { .min = PCH_GBE_MIN_TXD, |
438 | .arg = { .r = { .max = PCH_GBE_MAX_TXD } } | 438 | .max = PCH_GBE_MAX_TXD } } |
439 | }; | 439 | }; |
440 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; | 440 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; |
441 | tx_ring->count = TxDescriptors; | 441 | tx_ring->count = TxDescriptors; |
@@ -450,8 +450,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) | |||
450 | .err = "using default of " | 450 | .err = "using default of " |
451 | __MODULE_STRING(PCH_GBE_DEFAULT_RXD), | 451 | __MODULE_STRING(PCH_GBE_DEFAULT_RXD), |
452 | .def = PCH_GBE_DEFAULT_RXD, | 452 | .def = PCH_GBE_DEFAULT_RXD, |
453 | .arg = { .r = { .min = PCH_GBE_MIN_RXD } }, | 453 | .arg = { .r = { .min = PCH_GBE_MIN_RXD, |
454 | .arg = { .r = { .max = PCH_GBE_MAX_RXD } } | 454 | .max = PCH_GBE_MAX_RXD } } |
455 | }; | 455 | }; |
456 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; | 456 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; |
457 | rx_ring->count = RxDescriptors; | 457 | rx_ring->count = RxDescriptors; |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 8a4d19e5de06..f1047dd8a526 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -690,6 +690,7 @@ static void block_output(struct net_device *dev, int count, | |||
690 | static struct pcmcia_device_id axnet_ids[] = { | 690 | static struct pcmcia_device_id axnet_ids[] = { |
691 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081), | 691 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081), |
692 | PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301), | 692 | PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301), |
693 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328), | ||
693 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301), | 694 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301), |
694 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303), | 695 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303), |
695 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), | 696 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index d05c44692f08..2c158910f7ea 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1493,7 +1493,6 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1493 | PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530), | 1493 | PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530), |
1494 | PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab), | 1494 | PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab), |
1495 | PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110), | 1495 | PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110), |
1496 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328), | ||
1497 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041), | 1496 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041), |
1498 | PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), | 1497 | PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), |
1499 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300), | 1498 | PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300), |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index cb3d13e4e074..35fda5ac8120 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -64,7 +64,7 @@ config BCM63XX_PHY | |||
64 | config ICPLUS_PHY | 64 | config ICPLUS_PHY |
65 | tristate "Drivers for ICPlus PHYs" | 65 | tristate "Drivers for ICPlus PHYs" |
66 | ---help--- | 66 | ---help--- |
67 | Currently supports the IP175C PHY. | 67 | Currently supports the IP175C and IP1001 PHYs. |
68 | 68 | ||
69 | config REALTEK_PHY | 69 | config REALTEK_PHY |
70 | tristate "Drivers for Realtek PHYs" | 70 | tristate "Drivers for Realtek PHYs" |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index c1d2d251fe8b..9a09e24c30bc 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
32 | 32 | ||
33 | MODULE_DESCRIPTION("ICPlus IP175C PHY driver"); | 33 | MODULE_DESCRIPTION("ICPlus IP175C/IC1001 PHY drivers"); |
34 | MODULE_AUTHOR("Michael Barkowski"); | 34 | MODULE_AUTHOR("Michael Barkowski"); |
35 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
36 | 36 | ||
@@ -89,6 +89,33 @@ static int ip175c_config_init(struct phy_device *phydev) | |||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | static int ip1001_config_init(struct phy_device *phydev) | ||
93 | { | ||
94 | int err, value; | ||
95 | |||
96 | /* Software Reset PHY */ | ||
97 | value = phy_read(phydev, MII_BMCR); | ||
98 | value |= BMCR_RESET; | ||
99 | err = phy_write(phydev, MII_BMCR, value); | ||
100 | if (err < 0) | ||
101 | return err; | ||
102 | |||
103 | do { | ||
104 | value = phy_read(phydev, MII_BMCR); | ||
105 | } while (value & BMCR_RESET); | ||
106 | |||
107 | /* Additional delay (2ns) used to adjust RX clock phase | ||
108 | * at GMII/ RGMII interface */ | ||
109 | value = phy_read(phydev, 16); | ||
110 | value |= 0x3; | ||
111 | |||
112 | err = phy_write(phydev, 16, value); | ||
113 | if (err < 0) | ||
114 | return err; | ||
115 | |||
116 | return err; | ||
117 | } | ||
118 | |||
92 | static int ip175c_read_status(struct phy_device *phydev) | 119 | static int ip175c_read_status(struct phy_device *phydev) |
93 | { | 120 | { |
94 | if (phydev->addr == 4) /* WAN port */ | 121 | if (phydev->addr == 4) /* WAN port */ |
@@ -121,21 +148,43 @@ static struct phy_driver ip175c_driver = { | |||
121 | .driver = { .owner = THIS_MODULE,}, | 148 | .driver = { .owner = THIS_MODULE,}, |
122 | }; | 149 | }; |
123 | 150 | ||
124 | static int __init ip175c_init(void) | 151 | static struct phy_driver ip1001_driver = { |
152 | .phy_id = 0x02430d90, | ||
153 | .name = "ICPlus IP1001", | ||
154 | .phy_id_mask = 0x0ffffff0, | ||
155 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | | ||
156 | SUPPORTED_Asym_Pause, | ||
157 | .config_init = &ip1001_config_init, | ||
158 | .config_aneg = &genphy_config_aneg, | ||
159 | .read_status = &genphy_read_status, | ||
160 | .suspend = genphy_suspend, | ||
161 | .resume = genphy_resume, | ||
162 | .driver = { .owner = THIS_MODULE,}, | ||
163 | }; | ||
164 | |||
165 | static int __init icplus_init(void) | ||
125 | { | 166 | { |
167 | int ret = 0; | ||
168 | |||
169 | ret = phy_driver_register(&ip1001_driver); | ||
170 | if (ret < 0) | ||
171 | return -ENODEV; | ||
172 | |||
126 | return phy_driver_register(&ip175c_driver); | 173 | return phy_driver_register(&ip175c_driver); |
127 | } | 174 | } |
128 | 175 | ||
129 | static void __exit ip175c_exit(void) | 176 | static void __exit icplus_exit(void) |
130 | { | 177 | { |
178 | phy_driver_unregister(&ip1001_driver); | ||
131 | phy_driver_unregister(&ip175c_driver); | 179 | phy_driver_unregister(&ip175c_driver); |
132 | } | 180 | } |
133 | 181 | ||
134 | module_init(ip175c_init); | 182 | module_init(icplus_init); |
135 | module_exit(ip175c_exit); | 183 | module_exit(icplus_exit); |
136 | 184 | ||
137 | static struct mdio_device_id __maybe_unused icplus_tbl[] = { | 185 | static struct mdio_device_id __maybe_unused icplus_tbl[] = { |
138 | { 0x02430d80, 0x0ffffff0 }, | 186 | { 0x02430d80, 0x0ffffff0 }, |
187 | { 0x02430d90, 0x0ffffff0 }, | ||
139 | { } | 188 | { } |
140 | }; | 189 | }; |
141 | 190 | ||
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 09cf56d0416a..39659976a1ac 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -2584,16 +2584,16 @@ ppp_create_interface(struct net *net, int unit, int *retp) | |||
2584 | */ | 2584 | */ |
2585 | dev_net_set(dev, net); | 2585 | dev_net_set(dev, net); |
2586 | 2586 | ||
2587 | ret = -EEXIST; | ||
2588 | mutex_lock(&pn->all_ppp_mutex); | 2587 | mutex_lock(&pn->all_ppp_mutex); |
2589 | 2588 | ||
2590 | if (unit < 0) { | 2589 | if (unit < 0) { |
2591 | unit = unit_get(&pn->units_idr, ppp); | 2590 | unit = unit_get(&pn->units_idr, ppp); |
2592 | if (unit < 0) { | 2591 | if (unit < 0) { |
2593 | *retp = unit; | 2592 | ret = unit; |
2594 | goto out2; | 2593 | goto out2; |
2595 | } | 2594 | } |
2596 | } else { | 2595 | } else { |
2596 | ret = -EEXIST; | ||
2597 | if (unit_find(&pn->units_idr, unit)) | 2597 | if (unit_find(&pn->units_idr, unit)) |
2598 | goto out2; /* unit already exists */ | 2598 | goto out2; /* unit already exists */ |
2599 | /* | 2599 | /* |
@@ -2668,10 +2668,10 @@ static void ppp_shutdown_interface(struct ppp *ppp) | |||
2668 | ppp->closing = 1; | 2668 | ppp->closing = 1; |
2669 | ppp_unlock(ppp); | 2669 | ppp_unlock(ppp); |
2670 | unregister_netdev(ppp->dev); | 2670 | unregister_netdev(ppp->dev); |
2671 | unit_put(&pn->units_idr, ppp->file.index); | ||
2671 | } else | 2672 | } else |
2672 | ppp_unlock(ppp); | 2673 | ppp_unlock(ppp); |
2673 | 2674 | ||
2674 | unit_put(&pn->units_idr, ppp->file.index); | ||
2675 | ppp->file.dead = 1; | 2675 | ppp->file.dead = 1; |
2676 | ppp->owner = NULL; | 2676 | ppp->owner = NULL; |
2677 | wake_up_interruptible(&ppp->file.rwait); | 2677 | wake_up_interruptible(&ppp->file.rwait); |
@@ -2859,8 +2859,7 @@ static void __exit ppp_cleanup(void) | |||
2859 | * by holding all_ppp_mutex | 2859 | * by holding all_ppp_mutex |
2860 | */ | 2860 | */ |
2861 | 2861 | ||
2862 | /* associate pointer with specified number */ | 2862 | static int __unit_alloc(struct idr *p, void *ptr, int n) |
2863 | static int unit_set(struct idr *p, void *ptr, int n) | ||
2864 | { | 2863 | { |
2865 | int unit, err; | 2864 | int unit, err; |
2866 | 2865 | ||
@@ -2871,10 +2870,24 @@ again: | |||
2871 | } | 2870 | } |
2872 | 2871 | ||
2873 | err = idr_get_new_above(p, ptr, n, &unit); | 2872 | err = idr_get_new_above(p, ptr, n, &unit); |
2874 | if (err == -EAGAIN) | 2873 | if (err < 0) { |
2875 | goto again; | 2874 | if (err == -EAGAIN) |
2875 | goto again; | ||
2876 | return err; | ||
2877 | } | ||
2878 | |||
2879 | return unit; | ||
2880 | } | ||
2881 | |||
2882 | /* associate pointer with specified number */ | ||
2883 | static int unit_set(struct idr *p, void *ptr, int n) | ||
2884 | { | ||
2885 | int unit; | ||
2876 | 2886 | ||
2877 | if (unit != n) { | 2887 | unit = __unit_alloc(p, ptr, n); |
2888 | if (unit < 0) | ||
2889 | return unit; | ||
2890 | else if (unit != n) { | ||
2878 | idr_remove(p, unit); | 2891 | idr_remove(p, unit); |
2879 | return -EINVAL; | 2892 | return -EINVAL; |
2880 | } | 2893 | } |
@@ -2885,19 +2898,7 @@ again: | |||
2885 | /* get new free unit number and associate pointer with it */ | 2898 | /* get new free unit number and associate pointer with it */ |
2886 | static int unit_get(struct idr *p, void *ptr) | 2899 | static int unit_get(struct idr *p, void *ptr) |
2887 | { | 2900 | { |
2888 | int unit, err; | 2901 | return __unit_alloc(p, ptr, 0); |
2889 | |||
2890 | again: | ||
2891 | if (!idr_pre_get(p, GFP_KERNEL)) { | ||
2892 | printk(KERN_ERR "PPP: No free memory for idr\n"); | ||
2893 | return -ENOMEM; | ||
2894 | } | ||
2895 | |||
2896 | err = idr_get_new_above(p, ptr, 0, &unit); | ||
2897 | if (err == -EAGAIN) | ||
2898 | goto again; | ||
2899 | |||
2900 | return unit; | ||
2901 | } | 2902 | } |
2902 | 2903 | ||
2903 | /* put unit number back to a pool */ | 2904 | /* put unit number back to a pool */ |
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index d72fb0519a2a..78c0e3c9b2b5 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -948,7 +948,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
948 | 948 | ||
949 | abort: | 949 | abort: |
950 | kfree_skb(skb); | 950 | kfree_skb(skb); |
951 | return 0; | 951 | return 1; |
952 | } | 952 | } |
953 | 953 | ||
954 | /************************************************************************ | 954 | /************************************************************************ |
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 22821398fc63..9787dff90d3f 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -2083,6 +2083,7 @@ struct ql_adapter { | |||
2083 | u32 mailbox_in; | 2083 | u32 mailbox_in; |
2084 | u32 mailbox_out; | 2084 | u32 mailbox_out; |
2085 | struct mbox_params idc_mbc; | 2085 | struct mbox_params idc_mbc; |
2086 | struct mutex mpi_mutex; | ||
2086 | 2087 | ||
2087 | int tx_ring_size; | 2088 | int tx_ring_size; |
2088 | int rx_ring_size; | 2089 | int rx_ring_size; |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 528eaef5308f..2555b1d34f34 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -4629,6 +4629,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
4629 | INIT_DELAYED_WORK(&qdev->mpi_idc_work, ql_mpi_idc_work); | 4629 | INIT_DELAYED_WORK(&qdev->mpi_idc_work, ql_mpi_idc_work); |
4630 | INIT_DELAYED_WORK(&qdev->mpi_core_to_log, ql_mpi_core_to_log); | 4630 | INIT_DELAYED_WORK(&qdev->mpi_core_to_log, ql_mpi_core_to_log); |
4631 | init_completion(&qdev->ide_completion); | 4631 | init_completion(&qdev->ide_completion); |
4632 | mutex_init(&qdev->mpi_mutex); | ||
4632 | 4633 | ||
4633 | if (!cards_found) { | 4634 | if (!cards_found) { |
4634 | dev_info(&pdev->dev, "%s\n", DRV_STRING); | 4635 | dev_info(&pdev->dev, "%s\n", DRV_STRING); |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 0e7c7c7ee164..a2e919bcb3c6 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -534,6 +534,7 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
534 | int status; | 534 | int status; |
535 | unsigned long count; | 535 | unsigned long count; |
536 | 536 | ||
537 | mutex_lock(&qdev->mpi_mutex); | ||
537 | 538 | ||
538 | /* Begin polled mode for MPI */ | 539 | /* Begin polled mode for MPI */ |
539 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); | 540 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); |
@@ -603,6 +604,7 @@ done: | |||
603 | end: | 604 | end: |
604 | /* End polled mode for MPI */ | 605 | /* End polled mode for MPI */ |
605 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); | 606 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); |
607 | mutex_unlock(&qdev->mpi_mutex); | ||
606 | return status; | 608 | return status; |
607 | } | 609 | } |
608 | 610 | ||
@@ -1099,9 +1101,7 @@ int ql_wait_fifo_empty(struct ql_adapter *qdev) | |||
1099 | static int ql_set_port_cfg(struct ql_adapter *qdev) | 1101 | static int ql_set_port_cfg(struct ql_adapter *qdev) |
1100 | { | 1102 | { |
1101 | int status; | 1103 | int status; |
1102 | rtnl_lock(); | ||
1103 | status = ql_mb_set_port_cfg(qdev); | 1104 | status = ql_mb_set_port_cfg(qdev); |
1104 | rtnl_unlock(); | ||
1105 | if (status) | 1105 | if (status) |
1106 | return status; | 1106 | return status; |
1107 | status = ql_idc_wait(qdev); | 1107 | status = ql_idc_wait(qdev); |
@@ -1122,9 +1122,7 @@ void ql_mpi_port_cfg_work(struct work_struct *work) | |||
1122 | container_of(work, struct ql_adapter, mpi_port_cfg_work.work); | 1122 | container_of(work, struct ql_adapter, mpi_port_cfg_work.work); |
1123 | int status; | 1123 | int status; |
1124 | 1124 | ||
1125 | rtnl_lock(); | ||
1126 | status = ql_mb_get_port_cfg(qdev); | 1125 | status = ql_mb_get_port_cfg(qdev); |
1127 | rtnl_unlock(); | ||
1128 | if (status) { | 1126 | if (status) { |
1129 | netif_err(qdev, drv, qdev->ndev, | 1127 | netif_err(qdev, drv, qdev->ndev, |
1130 | "Bug: Failed to get port config data.\n"); | 1128 | "Bug: Failed to get port config data.\n"); |
@@ -1167,7 +1165,6 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
1167 | u32 aen; | 1165 | u32 aen; |
1168 | int timeout; | 1166 | int timeout; |
1169 | 1167 | ||
1170 | rtnl_lock(); | ||
1171 | aen = mbcp->mbox_out[1] >> 16; | 1168 | aen = mbcp->mbox_out[1] >> 16; |
1172 | timeout = (mbcp->mbox_out[1] >> 8) & 0xf; | 1169 | timeout = (mbcp->mbox_out[1] >> 8) & 0xf; |
1173 | 1170 | ||
@@ -1231,7 +1228,6 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
1231 | } | 1228 | } |
1232 | break; | 1229 | break; |
1233 | } | 1230 | } |
1234 | rtnl_unlock(); | ||
1235 | } | 1231 | } |
1236 | 1232 | ||
1237 | void ql_mpi_work(struct work_struct *work) | 1233 | void ql_mpi_work(struct work_struct *work) |
@@ -1242,7 +1238,7 @@ void ql_mpi_work(struct work_struct *work) | |||
1242 | struct mbox_params *mbcp = &mbc; | 1238 | struct mbox_params *mbcp = &mbc; |
1243 | int err = 0; | 1239 | int err = 0; |
1244 | 1240 | ||
1245 | rtnl_lock(); | 1241 | mutex_lock(&qdev->mpi_mutex); |
1246 | /* Begin polled mode for MPI */ | 1242 | /* Begin polled mode for MPI */ |
1247 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); | 1243 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); |
1248 | 1244 | ||
@@ -1259,7 +1255,7 @@ void ql_mpi_work(struct work_struct *work) | |||
1259 | 1255 | ||
1260 | /* End polled mode for MPI */ | 1256 | /* End polled mode for MPI */ |
1261 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); | 1257 | ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); |
1262 | rtnl_unlock(); | 1258 | mutex_unlock(&qdev->mpi_mutex); |
1263 | ql_enable_completion_interrupt(qdev, 0); | 1259 | ql_enable_completion_interrupt(qdev, 0); |
1264 | } | 1260 | } |
1265 | 1261 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 7d33ef4bcb4a..53b13deade95 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -744,26 +744,36 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr) | |||
744 | mdio_write(ioaddr, MII_BMCR, val & 0xffff); | 744 | mdio_write(ioaddr, MII_BMCR, val & 0xffff); |
745 | } | 745 | } |
746 | 746 | ||
747 | static void rtl8169_check_link_status(struct net_device *dev, | 747 | static void __rtl8169_check_link_status(struct net_device *dev, |
748 | struct rtl8169_private *tp, | 748 | struct rtl8169_private *tp, |
749 | void __iomem *ioaddr) | 749 | void __iomem *ioaddr, |
750 | bool pm) | ||
750 | { | 751 | { |
751 | unsigned long flags; | 752 | unsigned long flags; |
752 | 753 | ||
753 | spin_lock_irqsave(&tp->lock, flags); | 754 | spin_lock_irqsave(&tp->lock, flags); |
754 | if (tp->link_ok(ioaddr)) { | 755 | if (tp->link_ok(ioaddr)) { |
755 | /* This is to cancel a scheduled suspend if there's one. */ | 756 | /* This is to cancel a scheduled suspend if there's one. */ |
756 | pm_request_resume(&tp->pci_dev->dev); | 757 | if (pm) |
758 | pm_request_resume(&tp->pci_dev->dev); | ||
757 | netif_carrier_on(dev); | 759 | netif_carrier_on(dev); |
758 | netif_info(tp, ifup, dev, "link up\n"); | 760 | netif_info(tp, ifup, dev, "link up\n"); |
759 | } else { | 761 | } else { |
760 | netif_carrier_off(dev); | 762 | netif_carrier_off(dev); |
761 | netif_info(tp, ifdown, dev, "link down\n"); | 763 | netif_info(tp, ifdown, dev, "link down\n"); |
762 | pm_schedule_suspend(&tp->pci_dev->dev, 100); | 764 | if (pm) |
765 | pm_schedule_suspend(&tp->pci_dev->dev, 100); | ||
763 | } | 766 | } |
764 | spin_unlock_irqrestore(&tp->lock, flags); | 767 | spin_unlock_irqrestore(&tp->lock, flags); |
765 | } | 768 | } |
766 | 769 | ||
770 | static void rtl8169_check_link_status(struct net_device *dev, | ||
771 | struct rtl8169_private *tp, | ||
772 | void __iomem *ioaddr) | ||
773 | { | ||
774 | __rtl8169_check_link_status(dev, tp, ioaddr, false); | ||
775 | } | ||
776 | |||
767 | #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) | 777 | #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) |
768 | 778 | ||
769 | static u32 __rtl8169_get_wol(struct rtl8169_private *tp) | 779 | static u32 __rtl8169_get_wol(struct rtl8169_private *tp) |
@@ -4600,7 +4610,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
4600 | } | 4610 | } |
4601 | 4611 | ||
4602 | if (status & LinkChg) | 4612 | if (status & LinkChg) |
4603 | rtl8169_check_link_status(dev, tp, ioaddr); | 4613 | __rtl8169_check_link_status(dev, tp, ioaddr, true); |
4604 | 4614 | ||
4605 | /* We need to see the lastest version of tp->intr_mask to | 4615 | /* We need to see the lastest version of tp->intr_mask to |
4606 | * avoid ignoring an MSI interrupt and having to wait for | 4616 | * avoid ignoring an MSI interrupt and having to wait for |
@@ -4890,11 +4900,7 @@ static int rtl8169_runtime_idle(struct device *device) | |||
4890 | struct net_device *dev = pci_get_drvdata(pdev); | 4900 | struct net_device *dev = pci_get_drvdata(pdev); |
4891 | struct rtl8169_private *tp = netdev_priv(dev); | 4901 | struct rtl8169_private *tp = netdev_priv(dev); |
4892 | 4902 | ||
4893 | if (!tp->TxDescArray) | 4903 | return tp->TxDescArray ? -EBUSY : 0; |
4894 | return 0; | ||
4895 | |||
4896 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); | ||
4897 | return -EBUSY; | ||
4898 | } | 4904 | } |
4899 | 4905 | ||
4900 | static const struct dev_pm_ops rtl8169_pm_ops = { | 4906 | static const struct dev_pm_ops rtl8169_pm_ops = { |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 05df20e47976..fb83cdd94643 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -197,7 +197,9 @@ MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value"); | |||
197 | 197 | ||
198 | static void efx_remove_channels(struct efx_nic *efx); | 198 | static void efx_remove_channels(struct efx_nic *efx); |
199 | static void efx_remove_port(struct efx_nic *efx); | 199 | static void efx_remove_port(struct efx_nic *efx); |
200 | static void efx_init_napi(struct efx_nic *efx); | ||
200 | static void efx_fini_napi(struct efx_nic *efx); | 201 | static void efx_fini_napi(struct efx_nic *efx); |
202 | static void efx_fini_napi_channel(struct efx_channel *channel); | ||
201 | static void efx_fini_struct(struct efx_nic *efx); | 203 | static void efx_fini_struct(struct efx_nic *efx); |
202 | static void efx_start_all(struct efx_nic *efx); | 204 | static void efx_start_all(struct efx_nic *efx); |
203 | static void efx_stop_all(struct efx_nic *efx); | 205 | static void efx_stop_all(struct efx_nic *efx); |
@@ -335,8 +337,10 @@ void efx_process_channel_now(struct efx_channel *channel) | |||
335 | 337 | ||
336 | /* Disable interrupts and wait for ISRs to complete */ | 338 | /* Disable interrupts and wait for ISRs to complete */ |
337 | efx_nic_disable_interrupts(efx); | 339 | efx_nic_disable_interrupts(efx); |
338 | if (efx->legacy_irq) | 340 | if (efx->legacy_irq) { |
339 | synchronize_irq(efx->legacy_irq); | 341 | synchronize_irq(efx->legacy_irq); |
342 | efx->legacy_irq_enabled = false; | ||
343 | } | ||
340 | if (channel->irq) | 344 | if (channel->irq) |
341 | synchronize_irq(channel->irq); | 345 | synchronize_irq(channel->irq); |
342 | 346 | ||
@@ -351,6 +355,8 @@ void efx_process_channel_now(struct efx_channel *channel) | |||
351 | efx_channel_processed(channel); | 355 | efx_channel_processed(channel); |
352 | 356 | ||
353 | napi_enable(&channel->napi_str); | 357 | napi_enable(&channel->napi_str); |
358 | if (efx->legacy_irq) | ||
359 | efx->legacy_irq_enabled = true; | ||
354 | efx_nic_enable_interrupts(efx); | 360 | efx_nic_enable_interrupts(efx); |
355 | } | 361 | } |
356 | 362 | ||
@@ -426,6 +432,7 @@ efx_alloc_channel(struct efx_nic *efx, int i, struct efx_channel *old_channel) | |||
426 | 432 | ||
427 | *channel = *old_channel; | 433 | *channel = *old_channel; |
428 | 434 | ||
435 | channel->napi_dev = NULL; | ||
429 | memset(&channel->eventq, 0, sizeof(channel->eventq)); | 436 | memset(&channel->eventq, 0, sizeof(channel->eventq)); |
430 | 437 | ||
431 | rx_queue = &channel->rx_queue; | 438 | rx_queue = &channel->rx_queue; |
@@ -736,9 +743,13 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) | |||
736 | if (rc) | 743 | if (rc) |
737 | goto rollback; | 744 | goto rollback; |
738 | 745 | ||
746 | efx_init_napi(efx); | ||
747 | |||
739 | /* Destroy old channels */ | 748 | /* Destroy old channels */ |
740 | for (i = 0; i < efx->n_channels; i++) | 749 | for (i = 0; i < efx->n_channels; i++) { |
750 | efx_fini_napi_channel(other_channel[i]); | ||
741 | efx_remove_channel(other_channel[i]); | 751 | efx_remove_channel(other_channel[i]); |
752 | } | ||
742 | out: | 753 | out: |
743 | /* Free unused channel structures */ | 754 | /* Free unused channel structures */ |
744 | for (i = 0; i < efx->n_channels; i++) | 755 | for (i = 0; i < efx->n_channels; i++) |
@@ -1400,6 +1411,8 @@ static void efx_start_all(struct efx_nic *efx) | |||
1400 | efx_start_channel(channel); | 1411 | efx_start_channel(channel); |
1401 | } | 1412 | } |
1402 | 1413 | ||
1414 | if (efx->legacy_irq) | ||
1415 | efx->legacy_irq_enabled = true; | ||
1403 | efx_nic_enable_interrupts(efx); | 1416 | efx_nic_enable_interrupts(efx); |
1404 | 1417 | ||
1405 | /* Switch to event based MCDI completions after enabling interrupts. | 1418 | /* Switch to event based MCDI completions after enabling interrupts. |
@@ -1460,8 +1473,10 @@ static void efx_stop_all(struct efx_nic *efx) | |||
1460 | 1473 | ||
1461 | /* Disable interrupts and wait for ISR to complete */ | 1474 | /* Disable interrupts and wait for ISR to complete */ |
1462 | efx_nic_disable_interrupts(efx); | 1475 | efx_nic_disable_interrupts(efx); |
1463 | if (efx->legacy_irq) | 1476 | if (efx->legacy_irq) { |
1464 | synchronize_irq(efx->legacy_irq); | 1477 | synchronize_irq(efx->legacy_irq); |
1478 | efx->legacy_irq_enabled = false; | ||
1479 | } | ||
1465 | efx_for_each_channel(channel, efx) { | 1480 | efx_for_each_channel(channel, efx) { |
1466 | if (channel->irq) | 1481 | if (channel->irq) |
1467 | synchronize_irq(channel->irq); | 1482 | synchronize_irq(channel->irq); |
@@ -1593,7 +1608,7 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) | |||
1593 | * | 1608 | * |
1594 | **************************************************************************/ | 1609 | **************************************************************************/ |
1595 | 1610 | ||
1596 | static int efx_init_napi(struct efx_nic *efx) | 1611 | static void efx_init_napi(struct efx_nic *efx) |
1597 | { | 1612 | { |
1598 | struct efx_channel *channel; | 1613 | struct efx_channel *channel; |
1599 | 1614 | ||
@@ -1602,18 +1617,21 @@ static int efx_init_napi(struct efx_nic *efx) | |||
1602 | netif_napi_add(channel->napi_dev, &channel->napi_str, | 1617 | netif_napi_add(channel->napi_dev, &channel->napi_str, |
1603 | efx_poll, napi_weight); | 1618 | efx_poll, napi_weight); |
1604 | } | 1619 | } |
1605 | return 0; | 1620 | } |
1621 | |||
1622 | static void efx_fini_napi_channel(struct efx_channel *channel) | ||
1623 | { | ||
1624 | if (channel->napi_dev) | ||
1625 | netif_napi_del(&channel->napi_str); | ||
1626 | channel->napi_dev = NULL; | ||
1606 | } | 1627 | } |
1607 | 1628 | ||
1608 | static void efx_fini_napi(struct efx_nic *efx) | 1629 | static void efx_fini_napi(struct efx_nic *efx) |
1609 | { | 1630 | { |
1610 | struct efx_channel *channel; | 1631 | struct efx_channel *channel; |
1611 | 1632 | ||
1612 | efx_for_each_channel(channel, efx) { | 1633 | efx_for_each_channel(channel, efx) |
1613 | if (channel->napi_dev) | 1634 | efx_fini_napi_channel(channel); |
1614 | netif_napi_del(&channel->napi_str); | ||
1615 | channel->napi_dev = NULL; | ||
1616 | } | ||
1617 | } | 1635 | } |
1618 | 1636 | ||
1619 | /************************************************************************** | 1637 | /************************************************************************** |
@@ -2335,9 +2353,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) | |||
2335 | if (rc) | 2353 | if (rc) |
2336 | goto fail1; | 2354 | goto fail1; |
2337 | 2355 | ||
2338 | rc = efx_init_napi(efx); | 2356 | efx_init_napi(efx); |
2339 | if (rc) | ||
2340 | goto fail2; | ||
2341 | 2357 | ||
2342 | rc = efx->type->init(efx); | 2358 | rc = efx->type->init(efx); |
2343 | if (rc) { | 2359 | if (rc) { |
@@ -2368,7 +2384,6 @@ static int efx_pci_probe_main(struct efx_nic *efx) | |||
2368 | efx->type->fini(efx); | 2384 | efx->type->fini(efx); |
2369 | fail3: | 2385 | fail3: |
2370 | efx_fini_napi(efx); | 2386 | efx_fini_napi(efx); |
2371 | fail2: | ||
2372 | efx_remove_all(efx); | 2387 | efx_remove_all(efx); |
2373 | fail1: | 2388 | fail1: |
2374 | return rc; | 2389 | return rc; |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 0a7e26d73b52..b137c889152b 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -621,6 +621,7 @@ struct efx_filter_state; | |||
621 | * @pci_dev: The PCI device | 621 | * @pci_dev: The PCI device |
622 | * @type: Controller type attributes | 622 | * @type: Controller type attributes |
623 | * @legacy_irq: IRQ number | 623 | * @legacy_irq: IRQ number |
624 | * @legacy_irq_enabled: Are IRQs enabled on NIC (INT_EN_KER register)? | ||
624 | * @workqueue: Workqueue for port reconfigures and the HW monitor. | 625 | * @workqueue: Workqueue for port reconfigures and the HW monitor. |
625 | * Work items do not hold and must not acquire RTNL. | 626 | * Work items do not hold and must not acquire RTNL. |
626 | * @workqueue_name: Name of workqueue | 627 | * @workqueue_name: Name of workqueue |
@@ -709,6 +710,7 @@ struct efx_nic { | |||
709 | struct pci_dev *pci_dev; | 710 | struct pci_dev *pci_dev; |
710 | const struct efx_nic_type *type; | 711 | const struct efx_nic_type *type; |
711 | int legacy_irq; | 712 | int legacy_irq; |
713 | bool legacy_irq_enabled; | ||
712 | struct workqueue_struct *workqueue; | 714 | struct workqueue_struct *workqueue; |
713 | char workqueue_name[16]; | 715 | char workqueue_name[16]; |
714 | struct work_struct reset_work; | 716 | struct work_struct reset_work; |
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index 41c36b9a4244..67cb0c96838c 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
@@ -1418,6 +1418,12 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id) | |||
1418 | u32 queues; | 1418 | u32 queues; |
1419 | int syserr; | 1419 | int syserr; |
1420 | 1420 | ||
1421 | /* Could this be ours? If interrupts are disabled then the | ||
1422 | * channel state may not be valid. | ||
1423 | */ | ||
1424 | if (!efx->legacy_irq_enabled) | ||
1425 | return result; | ||
1426 | |||
1421 | /* Read the ISR which also ACKs the interrupts */ | 1427 | /* Read the ISR which also ACKs the interrupts */ |
1422 | efx_readd(efx, ®, FR_BZ_INT_ISR0); | 1428 | efx_readd(efx, ®, FR_BZ_INT_ISR0); |
1423 | queues = EFX_EXTRACT_DWORD(reg, 0, 31); | 1429 | queues = EFX_EXTRACT_DWORD(reg, 0, 31); |
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index 06bc6034ce81..2114837809e7 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -1509,6 +1509,8 @@ static int stmmac_probe(struct net_device *dev) | |||
1509 | pr_warning("\tno valid MAC address;" | 1509 | pr_warning("\tno valid MAC address;" |
1510 | "please, use ifconfig or nwhwconfig!\n"); | 1510 | "please, use ifconfig or nwhwconfig!\n"); |
1511 | 1511 | ||
1512 | spin_lock_init(&priv->lock); | ||
1513 | |||
1512 | ret = register_netdev(dev); | 1514 | ret = register_netdev(dev); |
1513 | if (ret) { | 1515 | if (ret) { |
1514 | pr_err("%s: ERROR %i registering the device\n", | 1516 | pr_err("%s: ERROR %i registering the device\n", |
@@ -1520,8 +1522,6 @@ static int stmmac_probe(struct net_device *dev) | |||
1520 | dev->name, (dev->features & NETIF_F_SG) ? "on" : "off", | 1522 | dev->name, (dev->features & NETIF_F_SG) ? "on" : "off", |
1521 | (dev->features & NETIF_F_HW_CSUM) ? "on" : "off"); | 1523 | (dev->features & NETIF_F_HW_CSUM) ? "on" : "off"); |
1522 | 1524 | ||
1523 | spin_lock_init(&priv->lock); | ||
1524 | |||
1525 | return ret; | 1525 | return ret; |
1526 | } | 1526 | } |
1527 | 1527 | ||
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 3ed2a67bd6d3..b409d7ec4ac1 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1016,7 +1016,7 @@ static void init_ring(struct net_device *dev) | |||
1016 | 1016 | ||
1017 | /* Fill in the Rx buffers. Handle allocation failure gracefully. */ | 1017 | /* Fill in the Rx buffers. Handle allocation failure gracefully. */ |
1018 | for (i = 0; i < RX_RING_SIZE; i++) { | 1018 | for (i = 0; i < RX_RING_SIZE; i++) { |
1019 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz); | 1019 | struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz + 2); |
1020 | np->rx_skbuff[i] = skb; | 1020 | np->rx_skbuff[i] = skb; |
1021 | if (skb == NULL) | 1021 | if (skb == NULL) |
1022 | break; | 1022 | break; |
@@ -1407,7 +1407,7 @@ static void refill_rx (struct net_device *dev) | |||
1407 | struct sk_buff *skb; | 1407 | struct sk_buff *skb; |
1408 | entry = np->dirty_rx % RX_RING_SIZE; | 1408 | entry = np->dirty_rx % RX_RING_SIZE; |
1409 | if (np->rx_skbuff[entry] == NULL) { | 1409 | if (np->rx_skbuff[entry] == NULL) { |
1410 | skb = dev_alloc_skb(np->rx_buf_sz); | 1410 | skb = dev_alloc_skb(np->rx_buf_sz + 2); |
1411 | np->rx_skbuff[entry] = skb; | 1411 | np->rx_skbuff[entry] = skb; |
1412 | if (skb == NULL) | 1412 | if (skb == NULL) |
1413 | break; /* Better luck next round. */ | 1413 | break; /* Better luck next round. */ |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 8b3dc1eb4015..296000bf5a25 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -324,7 +324,7 @@ static int bdx_fw_load(struct bdx_priv *priv) | |||
324 | ENTER; | 324 | ENTER; |
325 | master = READ_REG(priv, regINIT_SEMAPHORE); | 325 | master = READ_REG(priv, regINIT_SEMAPHORE); |
326 | if (!READ_REG(priv, regINIT_STATUS) && master) { | 326 | if (!READ_REG(priv, regINIT_STATUS) && master) { |
327 | rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev); | 327 | rc = request_firmware(&fw, "tehuti/bdx.bin", &priv->pdev->dev); |
328 | if (rc) | 328 | if (rc) |
329 | goto out; | 329 | goto out; |
330 | bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); | 330 | bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); |
@@ -2510,4 +2510,4 @@ module_exit(bdx_module_exit); | |||
2510 | MODULE_LICENSE("GPL"); | 2510 | MODULE_LICENSE("GPL"); |
2511 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2511 | MODULE_AUTHOR(DRIVER_AUTHOR); |
2512 | MODULE_DESCRIPTION(BDX_DRV_DESC); | 2512 | MODULE_DESCRIPTION(BDX_DRV_DESC); |
2513 | MODULE_FIRMWARE("tehuti/firmware.bin"); | 2513 | MODULE_FIRMWARE("tehuti/bdx.bin"); |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index a9f7d5d1a269..7064e035757a 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
@@ -688,9 +688,6 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, | |||
688 | 688 | ||
689 | DMFE_DBUG(0, "dmfe_start_xmit", 0); | 689 | DMFE_DBUG(0, "dmfe_start_xmit", 0); |
690 | 690 | ||
691 | /* Resource flag check */ | ||
692 | netif_stop_queue(dev); | ||
693 | |||
694 | /* Too large packet check */ | 691 | /* Too large packet check */ |
695 | if (skb->len > MAX_PACKET_SIZE) { | 692 | if (skb->len > MAX_PACKET_SIZE) { |
696 | pr_err("big packet = %d\n", (u16)skb->len); | 693 | pr_err("big packet = %d\n", (u16)skb->len); |
@@ -698,6 +695,9 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, | |||
698 | return NETDEV_TX_OK; | 695 | return NETDEV_TX_OK; |
699 | } | 696 | } |
700 | 697 | ||
698 | /* Resource flag check */ | ||
699 | netif_stop_queue(dev); | ||
700 | |||
701 | spin_lock_irqsave(&db->lock, flags); | 701 | spin_lock_irqsave(&db->lock, flags); |
702 | 702 | ||
703 | /* No Tx resource check, it never happen nromally */ | 703 | /* No Tx resource check, it never happen nromally */ |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 5b83c3f35f47..a3c46f6a15e7 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -1004,7 +1004,6 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | strcpy(info->driver, KBUILD_MODNAME); | 1006 | strcpy(info->driver, KBUILD_MODNAME); |
1007 | strcpy(info->version, UTS_RELEASE); | ||
1008 | strcpy(info->bus_info, pci_name(pci_dev)); | 1007 | strcpy(info->bus_info, pci_name(pci_dev)); |
1009 | } | 1008 | } |
1010 | 1009 | ||
diff --git a/drivers/net/ucc_geth.h b/drivers/net/ucc_geth.h index 05a95586f3c5..055b87ab4f07 100644 --- a/drivers/net/ucc_geth.h +++ b/drivers/net/ucc_geth.h | |||
@@ -899,7 +899,8 @@ struct ucc_geth_hardware_statistics { | |||
899 | #define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size | 899 | #define UCC_GETH_UTFS_INIT 512 /* Tx virtual FIFO size |
900 | */ | 900 | */ |
901 | #define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ | 901 | #define UCC_GETH_UTFET_INIT 256 /* 1/2 utfs */ |
902 | #define UCC_GETH_UTFTT_INIT 512 | 902 | #define UCC_GETH_UTFTT_INIT 256 /* 1/2 utfs |
903 | due to errata */ | ||
903 | /* Gigabit Ethernet (1000 Mbps) */ | 904 | /* Gigabit Ethernet (1000 Mbps) */ |
904 | #define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual | 905 | #define UCC_GETH_URFS_GIGA_INIT 4096/*2048*/ /* Rx virtual |
905 | FIFO size */ | 906 | FIFO size */ |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index aea4645be7f6..6140b56cce53 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -1508,6 +1508,10 @@ static const struct usb_device_id products [] = { | |||
1508 | USB_DEVICE (0x0b95, 0x1780), | 1508 | USB_DEVICE (0x0b95, 0x1780), |
1509 | .driver_info = (unsigned long) &ax88178_info, | 1509 | .driver_info = (unsigned long) &ax88178_info, |
1510 | }, { | 1510 | }, { |
1511 | // Logitec LAN-GTJ/U2A | ||
1512 | USB_DEVICE (0x0789, 0x0160), | ||
1513 | .driver_info = (unsigned long) &ax88178_info, | ||
1514 | }, { | ||
1511 | // Linksys USB200M Rev 2 | 1515 | // Linksys USB200M Rev 2 |
1512 | USB_DEVICE (0x13b1, 0x0018), | 1516 | USB_DEVICE (0x13b1, 0x0018), |
1513 | .driver_info = (unsigned long) &ax88772_info, | 1517 | .driver_info = (unsigned long) &ax88772_info, |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index b154a94de03e..812edf85d6d3 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -958,10 +958,6 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, | |||
958 | /* Packet is complete. Inject into stack. */ | 958 | /* Packet is complete. Inject into stack. */ |
959 | /* We have IP packet here */ | 959 | /* We have IP packet here */ |
960 | odev->skb_rx_buf->protocol = cpu_to_be16(ETH_P_IP); | 960 | odev->skb_rx_buf->protocol = cpu_to_be16(ETH_P_IP); |
961 | /* don't check it */ | ||
962 | odev->skb_rx_buf->ip_summed = | ||
963 | CHECKSUM_UNNECESSARY; | ||
964 | |||
965 | skb_reset_mac_header(odev->skb_rx_buf); | 961 | skb_reset_mac_header(odev->skb_rx_buf); |
966 | 962 | ||
967 | /* Ship it off to the kernel */ | 963 | /* Ship it off to the kernel */ |
@@ -2994,12 +2990,14 @@ static int hso_probe(struct usb_interface *interface, | |||
2994 | 2990 | ||
2995 | case HSO_INTF_BULK: | 2991 | case HSO_INTF_BULK: |
2996 | /* It's a regular bulk interface */ | 2992 | /* It's a regular bulk interface */ |
2997 | if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) && | 2993 | if ((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) { |
2998 | !disable_net) | 2994 | if (!disable_net) |
2999 | hso_dev = hso_create_net_device(interface, port_spec); | 2995 | hso_dev = |
3000 | else | 2996 | hso_create_net_device(interface, port_spec); |
2997 | } else { | ||
3001 | hso_dev = | 2998 | hso_dev = |
3002 | hso_create_bulk_serial_device(interface, port_spec); | 2999 | hso_create_bulk_serial_device(interface, port_spec); |
3000 | } | ||
3003 | if (!hso_dev) | 3001 | if (!hso_dev) |
3004 | goto exit; | 3002 | goto exit; |
3005 | break; | 3003 | break; |
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index a6281e3987b5..2b791392e788 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * MOSCHIP MCS7830 based USB 2.0 Ethernet Devices | 2 | * MOSCHIP MCS7830 based (7730/7830/7832) USB 2.0 Ethernet Devices |
3 | * | 3 | * |
4 | * based on usbnet.c, asix.c and the vendor provided mcs7830 driver | 4 | * based on usbnet.c, asix.c and the vendor provided mcs7830 driver |
5 | * | 5 | * |
@@ -11,6 +11,9 @@ | |||
11 | * | 11 | * |
12 | * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!). | 12 | * Definitions gathered from MOSCHIP, Data Sheet_7830DA.pdf (thanks!). |
13 | * | 13 | * |
14 | * 2010-12-19: add 7832 USB PID ("functionality same as MCS7830"), | ||
15 | * per active notification by manufacturer | ||
16 | * | ||
14 | * TODO: | 17 | * TODO: |
15 | * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?) | 18 | * - support HIF_REG_CONFIG_SLEEPMODE/HIF_REG_CONFIG_TXENABLE (via autopm?) |
16 | * - implement ethtool_ops get_pauseparam/set_pauseparam | 19 | * - implement ethtool_ops get_pauseparam/set_pauseparam |
@@ -60,6 +63,7 @@ | |||
60 | #define MCS7830_MAX_MCAST 64 | 63 | #define MCS7830_MAX_MCAST 64 |
61 | 64 | ||
62 | #define MCS7830_VENDOR_ID 0x9710 | 65 | #define MCS7830_VENDOR_ID 0x9710 |
66 | #define MCS7832_PRODUCT_ID 0x7832 | ||
63 | #define MCS7830_PRODUCT_ID 0x7830 | 67 | #define MCS7830_PRODUCT_ID 0x7830 |
64 | #define MCS7730_PRODUCT_ID 0x7730 | 68 | #define MCS7730_PRODUCT_ID 0x7730 |
65 | 69 | ||
@@ -351,7 +355,7 @@ static int mcs7830_set_autoneg(struct usbnet *dev, int ptrUserPhyMode) | |||
351 | if (!ret) | 355 | if (!ret) |
352 | ret = mcs7830_write_phy(dev, MII_BMCR, | 356 | ret = mcs7830_write_phy(dev, MII_BMCR, |
353 | BMCR_ANENABLE | BMCR_ANRESTART ); | 357 | BMCR_ANENABLE | BMCR_ANRESTART ); |
354 | return ret < 0 ? : 0; | 358 | return ret; |
355 | } | 359 | } |
356 | 360 | ||
357 | 361 | ||
@@ -626,7 +630,7 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
626 | } | 630 | } |
627 | 631 | ||
628 | static const struct driver_info moschip_info = { | 632 | static const struct driver_info moschip_info = { |
629 | .description = "MOSCHIP 7830/7730 usb-NET adapter", | 633 | .description = "MOSCHIP 7830/7832/7730 usb-NET adapter", |
630 | .bind = mcs7830_bind, | 634 | .bind = mcs7830_bind, |
631 | .rx_fixup = mcs7830_rx_fixup, | 635 | .rx_fixup = mcs7830_rx_fixup, |
632 | .flags = FLAG_ETHER, | 636 | .flags = FLAG_ETHER, |
@@ -645,6 +649,10 @@ static const struct driver_info sitecom_info = { | |||
645 | 649 | ||
646 | static const struct usb_device_id products[] = { | 650 | static const struct usb_device_id products[] = { |
647 | { | 651 | { |
652 | USB_DEVICE(MCS7830_VENDOR_ID, MCS7832_PRODUCT_ID), | ||
653 | .driver_info = (unsigned long) &moschip_info, | ||
654 | }, | ||
655 | { | ||
648 | USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), | 656 | USB_DEVICE(MCS7830_VENDOR_ID, MCS7830_PRODUCT_ID), |
649 | .driver_info = (unsigned long) &moschip_info, | 657 | .driver_info = (unsigned long) &moschip_info, |
650 | }, | 658 | }, |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 0bbc0c323135..cc83fa71c3ff 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -166,7 +166,9 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
166 | if (!(rcv->flags & IFF_UP)) | 166 | if (!(rcv->flags & IFF_UP)) |
167 | goto tx_drop; | 167 | goto tx_drop; |
168 | 168 | ||
169 | if (dev->features & NETIF_F_NO_CSUM) | 169 | /* don't change ip_summed == CHECKSUM_PARTIAL, as that |
170 | will cause bad checksum on forwarded packets */ | ||
171 | if (skb->ip_summed == CHECKSUM_NONE) | ||
170 | skb->ip_summed = rcv_priv->ip_summed; | 172 | skb->ip_summed = rcv_priv->ip_summed; |
171 | 173 | ||
172 | length = skb->len + ETH_HLEN; | 174 | length = skb->len + ETH_HLEN; |
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c index ea476cbd38b5..e305274f83fb 100644 --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c | |||
@@ -293,6 +293,7 @@ static inline void sca_tx_done(port_t *port) | |||
293 | struct net_device *dev = port->netdev; | 293 | struct net_device *dev = port->netdev; |
294 | card_t* card = port->card; | 294 | card_t* card = port->card; |
295 | u8 stat; | 295 | u8 stat; |
296 | unsigned count = 0; | ||
296 | 297 | ||
297 | spin_lock(&port->lock); | 298 | spin_lock(&port->lock); |
298 | 299 | ||
@@ -316,10 +317,12 @@ static inline void sca_tx_done(port_t *port) | |||
316 | dev->stats.tx_bytes += readw(&desc->len); | 317 | dev->stats.tx_bytes += readw(&desc->len); |
317 | } | 318 | } |
318 | writeb(0, &desc->stat); /* Free descriptor */ | 319 | writeb(0, &desc->stat); /* Free descriptor */ |
320 | count++; | ||
319 | port->txlast = (port->txlast + 1) % card->tx_ring_buffers; | 321 | port->txlast = (port->txlast + 1) % card->tx_ring_buffers; |
320 | } | 322 | } |
321 | 323 | ||
322 | netif_wake_queue(dev); | 324 | if (count) |
325 | netif_wake_queue(dev); | ||
323 | spin_unlock(&port->lock); | 326 | spin_unlock(&port->lock); |
324 | } | 327 | } |
325 | 328 | ||
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index d81ad8397885..24297b274cd4 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -498,7 +498,6 @@ norbuff: | |||
498 | static int x25_asy_close(struct net_device *dev) | 498 | static int x25_asy_close(struct net_device *dev) |
499 | { | 499 | { |
500 | struct x25_asy *sl = netdev_priv(dev); | 500 | struct x25_asy *sl = netdev_priv(dev); |
501 | int err; | ||
502 | 501 | ||
503 | spin_lock(&sl->lock); | 502 | spin_lock(&sl->lock); |
504 | if (sl->tty) | 503 | if (sl->tty) |
@@ -507,10 +506,6 @@ static int x25_asy_close(struct net_device *dev) | |||
507 | netif_stop_queue(dev); | 506 | netif_stop_queue(dev); |
508 | sl->rcount = 0; | 507 | sl->rcount = 0; |
509 | sl->xleft = 0; | 508 | sl->xleft = 0; |
510 | err = lapb_unregister(dev); | ||
511 | if (err != LAPB_OK) | ||
512 | printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n", | ||
513 | err); | ||
514 | spin_unlock(&sl->lock); | 509 | spin_unlock(&sl->lock); |
515 | return 0; | 510 | return 0; |
516 | } | 511 | } |
@@ -582,7 +577,7 @@ static int x25_asy_open_tty(struct tty_struct *tty) | |||
582 | if (err) | 577 | if (err) |
583 | return err; | 578 | return err; |
584 | /* Done. We have linked the TTY line to a channel. */ | 579 | /* Done. We have linked the TTY line to a channel. */ |
585 | return sl->dev->base_addr; | 580 | return 0; |
586 | } | 581 | } |
587 | 582 | ||
588 | 583 | ||
@@ -595,6 +590,7 @@ static int x25_asy_open_tty(struct tty_struct *tty) | |||
595 | static void x25_asy_close_tty(struct tty_struct *tty) | 590 | static void x25_asy_close_tty(struct tty_struct *tty) |
596 | { | 591 | { |
597 | struct x25_asy *sl = tty->disc_data; | 592 | struct x25_asy *sl = tty->disc_data; |
593 | int err; | ||
598 | 594 | ||
599 | /* First make sure we're connected. */ | 595 | /* First make sure we're connected. */ |
600 | if (!sl || sl->magic != X25_ASY_MAGIC) | 596 | if (!sl || sl->magic != X25_ASY_MAGIC) |
@@ -605,6 +601,11 @@ static void x25_asy_close_tty(struct tty_struct *tty) | |||
605 | dev_close(sl->dev); | 601 | dev_close(sl->dev); |
606 | rtnl_unlock(); | 602 | rtnl_unlock(); |
607 | 603 | ||
604 | err = lapb_unregister(sl->dev); | ||
605 | if (err != LAPB_OK) | ||
606 | printk(KERN_ERR "x25_asy_close: lapb_unregister error -%d\n", | ||
607 | err); | ||
608 | |||
608 | tty->disc_data = NULL; | 609 | tty->disc_data = NULL; |
609 | sl->tty = NULL; | 610 | sl->tty = NULL; |
610 | x25_asy_free(sl); | 611 | x25_asy_free(sl); |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 8251946842e6..42ed923cdb1a 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1917,7 +1917,8 @@ ath5k_beacon_send(struct ath5k_softc *sc) | |||
1917 | sc->bmisscount = 0; | 1917 | sc->bmisscount = 0; |
1918 | } | 1918 | } |
1919 | 1919 | ||
1920 | if (sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) { | 1920 | if ((sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) || |
1921 | sc->opmode == NL80211_IFTYPE_MESH_POINT) { | ||
1921 | u64 tsf = ath5k_hw_get_tsf64(ah); | 1922 | u64 tsf = ath5k_hw_get_tsf64(ah); |
1922 | u32 tsftu = TSF_TO_TU(tsf); | 1923 | u32 tsftu = TSF_TO_TU(tsf); |
1923 | int slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval; | 1924 | int slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval; |
@@ -1949,8 +1950,9 @@ ath5k_beacon_send(struct ath5k_softc *sc) | |||
1949 | /* NB: hw still stops DMA, so proceed */ | 1950 | /* NB: hw still stops DMA, so proceed */ |
1950 | } | 1951 | } |
1951 | 1952 | ||
1952 | /* refresh the beacon for AP mode */ | 1953 | /* refresh the beacon for AP or MESH mode */ |
1953 | if (sc->opmode == NL80211_IFTYPE_AP) | 1954 | if (sc->opmode == NL80211_IFTYPE_AP || |
1955 | sc->opmode == NL80211_IFTYPE_MESH_POINT) | ||
1954 | ath5k_beacon_update(sc->hw, vif); | 1956 | ath5k_beacon_update(sc->hw, vif); |
1955 | 1957 | ||
1956 | ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr); | 1958 | ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr); |
@@ -2851,7 +2853,8 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, | |||
2851 | 2853 | ||
2852 | /* Assign the vap/adhoc to a beacon xmit slot. */ | 2854 | /* Assign the vap/adhoc to a beacon xmit slot. */ |
2853 | if ((avf->opmode == NL80211_IFTYPE_AP) || | 2855 | if ((avf->opmode == NL80211_IFTYPE_AP) || |
2854 | (avf->opmode == NL80211_IFTYPE_ADHOC)) { | 2856 | (avf->opmode == NL80211_IFTYPE_ADHOC) || |
2857 | (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { | ||
2855 | int slot; | 2858 | int slot; |
2856 | 2859 | ||
2857 | WARN_ON(list_empty(&sc->bcbuf)); | 2860 | WARN_ON(list_empty(&sc->bcbuf)); |
@@ -2870,7 +2873,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, | |||
2870 | sc->bslot[avf->bslot] = vif; | 2873 | sc->bslot[avf->bslot] = vif; |
2871 | if (avf->opmode == NL80211_IFTYPE_AP) | 2874 | if (avf->opmode == NL80211_IFTYPE_AP) |
2872 | sc->num_ap_vifs++; | 2875 | sc->num_ap_vifs++; |
2873 | else | 2876 | else if (avf->opmode == NL80211_IFTYPE_ADHOC) |
2874 | sc->num_adhoc_vifs++; | 2877 | sc->num_adhoc_vifs++; |
2875 | } | 2878 | } |
2876 | 2879 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index c4182359bee4..a7b82f0085d2 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -55,6 +55,8 @@ | |||
55 | #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ | 55 | #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ |
56 | #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ | 56 | #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ |
57 | 57 | ||
58 | #define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6)) | ||
59 | |||
58 | static const struct ar9300_eeprom ar9300_default = { | 60 | static const struct ar9300_eeprom ar9300_default = { |
59 | .eepromVersion = 2, | 61 | .eepromVersion = 2, |
60 | .templateVersion = 2, | 62 | .templateVersion = 2, |
@@ -290,20 +292,21 @@ static const struct ar9300_eeprom ar9300_default = { | |||
290 | } | 292 | } |
291 | }, | 293 | }, |
292 | .ctlPowerData_2G = { | 294 | .ctlPowerData_2G = { |
293 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 295 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
294 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 296 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
295 | { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, | 297 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, |
296 | 298 | ||
297 | { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, | 299 | { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, |
298 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 300 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
299 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 301 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
300 | 302 | ||
301 | { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, | 303 | { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, |
302 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 304 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
303 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 305 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
304 | 306 | ||
305 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 307 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
306 | { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, | 308 | { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, |
309 | { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, | ||
307 | }, | 310 | }, |
308 | .modalHeader5G = { | 311 | .modalHeader5G = { |
309 | /* 4 idle,t1,t2,b (4 bits per setting) */ | 312 | /* 4 idle,t1,t2,b (4 bits per setting) */ |
@@ -568,56 +571,56 @@ static const struct ar9300_eeprom ar9300_default = { | |||
568 | .ctlPowerData_5G = { | 571 | .ctlPowerData_5G = { |
569 | { | 572 | { |
570 | { | 573 | { |
571 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 574 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
572 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 575 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
573 | } | 576 | } |
574 | }, | 577 | }, |
575 | { | 578 | { |
576 | { | 579 | { |
577 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 580 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
578 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 581 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
579 | } | 582 | } |
580 | }, | 583 | }, |
581 | { | 584 | { |
582 | { | 585 | { |
583 | {60, 0}, {60, 1}, {60, 0}, {60, 1}, | 586 | CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), |
584 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 587 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
585 | } | 588 | } |
586 | }, | 589 | }, |
587 | { | 590 | { |
588 | { | 591 | { |
589 | {60, 0}, {60, 1}, {60, 1}, {60, 0}, | 592 | CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
590 | {60, 1}, {60, 0}, {60, 0}, {60, 0}, | 593 | CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), |
591 | } | 594 | } |
592 | }, | 595 | }, |
593 | { | 596 | { |
594 | { | 597 | { |
595 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 598 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
596 | {60, 0}, {60, 0}, {60, 0}, {60, 0}, | 599 | CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), |
597 | } | 600 | } |
598 | }, | 601 | }, |
599 | { | 602 | { |
600 | { | 603 | { |
601 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 604 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
602 | {60, 1}, {60, 0}, {60, 0}, {60, 0}, | 605 | CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), |
603 | } | 606 | } |
604 | }, | 607 | }, |
605 | { | 608 | { |
606 | { | 609 | { |
607 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 610 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
608 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 611 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
609 | } | 612 | } |
610 | }, | 613 | }, |
611 | { | 614 | { |
612 | { | 615 | { |
613 | {60, 1}, {60, 1}, {60, 0}, {60, 1}, | 616 | CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), |
614 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 617 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
615 | } | 618 | } |
616 | }, | 619 | }, |
617 | { | 620 | { |
618 | { | 621 | { |
619 | {60, 1}, {60, 0}, {60, 1}, {60, 1}, | 622 | CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), |
620 | {60, 1}, {60, 1}, {60, 0}, {60, 1}, | 623 | CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), |
621 | } | 624 | } |
622 | }, | 625 | }, |
623 | } | 626 | } |
@@ -1827,9 +1830,9 @@ static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep, | |||
1827 | struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; | 1830 | struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; |
1828 | 1831 | ||
1829 | if (is2GHz) | 1832 | if (is2GHz) |
1830 | return ctl_2g[idx].ctlEdges[edge].tPower; | 1833 | return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]); |
1831 | else | 1834 | else |
1832 | return ctl_5g[idx].ctlEdges[edge].tPower; | 1835 | return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]); |
1833 | } | 1836 | } |
1834 | 1837 | ||
1835 | static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, | 1838 | static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, |
@@ -1847,12 +1850,12 @@ static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, | |||
1847 | 1850 | ||
1848 | if (is2GHz) { | 1851 | if (is2GHz) { |
1849 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && | 1852 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && |
1850 | ctl_2g[idx].ctlEdges[edge - 1].flag) | 1853 | CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1])) |
1851 | return ctl_2g[idx].ctlEdges[edge - 1].tPower; | 1854 | return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]); |
1852 | } else { | 1855 | } else { |
1853 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && | 1856 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && |
1854 | ctl_5g[idx].ctlEdges[edge - 1].flag) | 1857 | CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1])) |
1855 | return ctl_5g[idx].ctlEdges[edge - 1].tPower; | 1858 | return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]); |
1856 | } | 1859 | } |
1857 | 1860 | ||
1858 | return AR9300_MAX_RATE_POWER; | 1861 | return AR9300_MAX_RATE_POWER; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h index 3c533bb983c7..655b3033396c 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | |||
@@ -261,17 +261,12 @@ struct cal_tgt_pow_ht { | |||
261 | u8 tPow2x[14]; | 261 | u8 tPow2x[14]; |
262 | } __packed; | 262 | } __packed; |
263 | 263 | ||
264 | struct cal_ctl_edge_pwr { | ||
265 | u8 tPower:6, | ||
266 | flag:2; | ||
267 | } __packed; | ||
268 | |||
269 | struct cal_ctl_data_2g { | 264 | struct cal_ctl_data_2g { |
270 | struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G]; | 265 | u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G]; |
271 | } __packed; | 266 | } __packed; |
272 | 267 | ||
273 | struct cal_ctl_data_5g { | 268 | struct cal_ctl_data_5g { |
274 | struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G]; | 269 | u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G]; |
275 | } __packed; | 270 | } __packed; |
276 | 271 | ||
277 | struct ar9300_eeprom { | 272 | struct ar9300_eeprom { |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 170d44a35ccb..0963071e8f90 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/leds.h> | 22 | #include <linux/leds.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <linux/pm_qos_params.h> | ||
24 | 25 | ||
25 | #include "debug.h" | 26 | #include "debug.h" |
26 | #include "common.h" | 27 | #include "common.h" |
@@ -328,7 +329,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp); | |||
328 | struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); | 329 | struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); |
329 | void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); | 330 | void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); |
330 | int ath_tx_setup(struct ath_softc *sc, int haltype); | 331 | int ath_tx_setup(struct ath_softc *sc, int haltype); |
331 | void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); | 332 | bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); |
332 | void ath_draintxq(struct ath_softc *sc, | 333 | void ath_draintxq(struct ath_softc *sc, |
333 | struct ath_txq *txq, bool retry_tx); | 334 | struct ath_txq *txq, bool retry_tx); |
334 | void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); | 335 | void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); |
@@ -646,6 +647,8 @@ struct ath_softc { | |||
646 | struct ath_descdma txsdma; | 647 | struct ath_descdma txsdma; |
647 | 648 | ||
648 | struct ath_ant_comb ant_comb; | 649 | struct ath_ant_comb ant_comb; |
650 | |||
651 | struct pm_qos_request_list pm_qos_req; | ||
649 | }; | 652 | }; |
650 | 653 | ||
651 | struct ath_wiphy { | 654 | struct ath_wiphy { |
@@ -675,7 +678,6 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz) | |||
675 | } | 678 | } |
676 | 679 | ||
677 | extern struct ieee80211_ops ath9k_ops; | 680 | extern struct ieee80211_ops ath9k_ops; |
678 | extern struct pm_qos_request_list ath9k_pm_qos_req; | ||
679 | extern int modparam_nohwcrypt; | 681 | extern int modparam_nohwcrypt; |
680 | extern int led_blink; | 682 | extern int led_blink; |
681 | 683 | ||
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index 1266333f586d..2bbf94d0191e 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c | |||
@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, | |||
240 | for (i = 0; (i < num_band_edges) && | 240 | for (i = 0; (i < num_band_edges) && |
241 | (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { | 241 | (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { |
242 | if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { | 242 | if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { |
243 | twiceMaxEdgePower = pRdEdgesPower[i].tPower; | 243 | twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl); |
244 | break; | 244 | break; |
245 | } else if ((i > 0) && | 245 | } else if ((i > 0) && |
246 | (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, | 246 | (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, |
247 | is2GHz))) { | 247 | is2GHz))) { |
248 | if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, | 248 | if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, |
249 | is2GHz) < freq && | 249 | is2GHz) < freq && |
250 | pRdEdgesPower[i - 1].flag) { | 250 | CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) { |
251 | twiceMaxEdgePower = | 251 | twiceMaxEdgePower = |
252 | pRdEdgesPower[i - 1].tPower; | 252 | CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl); |
253 | } | 253 | } |
254 | break; | 254 | break; |
255 | } | 255 | } |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index dacb45e1b906..dd59f09441a3 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h | |||
@@ -233,6 +233,18 @@ | |||
233 | 233 | ||
234 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) | 234 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) |
235 | 235 | ||
236 | #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) | ||
237 | #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) | ||
238 | |||
239 | #define LNA_CTL_BUF_MODE BIT(0) | ||
240 | #define LNA_CTL_ISEL_LO BIT(1) | ||
241 | #define LNA_CTL_ISEL_HI BIT(2) | ||
242 | #define LNA_CTL_BUF_IN BIT(3) | ||
243 | #define LNA_CTL_FEM_BAND BIT(4) | ||
244 | #define LNA_CTL_LOCAL_BIAS BIT(5) | ||
245 | #define LNA_CTL_FORCE_XPA BIT(6) | ||
246 | #define LNA_CTL_USE_ANT1 BIT(7) | ||
247 | |||
236 | enum eeprom_param { | 248 | enum eeprom_param { |
237 | EEP_NFTHRESH_5, | 249 | EEP_NFTHRESH_5, |
238 | EEP_NFTHRESH_2, | 250 | EEP_NFTHRESH_2, |
@@ -378,10 +390,7 @@ struct modal_eep_header { | |||
378 | u8 xatten2Margin[AR5416_MAX_CHAINS]; | 390 | u8 xatten2Margin[AR5416_MAX_CHAINS]; |
379 | u8 ob_ch1; | 391 | u8 ob_ch1; |
380 | u8 db_ch1; | 392 | u8 db_ch1; |
381 | u8 useAnt1:1, | 393 | u8 lna_ctl; |
382 | force_xpaon:1, | ||
383 | local_bias:1, | ||
384 | femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; | ||
385 | u8 miscBits; | 394 | u8 miscBits; |
386 | u16 xpaBiasLvlFreq[3]; | 395 | u16 xpaBiasLvlFreq[3]; |
387 | u8 futureModal[6]; | 396 | u8 futureModal[6]; |
@@ -535,18 +544,10 @@ struct cal_target_power_ht { | |||
535 | u8 tPow2x[8]; | 544 | u8 tPow2x[8]; |
536 | } __packed; | 545 | } __packed; |
537 | 546 | ||
538 | |||
539 | #ifdef __BIG_ENDIAN_BITFIELD | ||
540 | struct cal_ctl_edges { | ||
541 | u8 bChannel; | ||
542 | u8 flag:2, tPower:6; | ||
543 | } __packed; | ||
544 | #else | ||
545 | struct cal_ctl_edges { | 547 | struct cal_ctl_edges { |
546 | u8 bChannel; | 548 | u8 bChannel; |
547 | u8 tPower:6, flag:2; | 549 | u8 ctl; |
548 | } __packed; | 550 | } __packed; |
549 | #endif | ||
550 | 551 | ||
551 | struct cal_data_op_loop_ar9287 { | 552 | struct cal_data_op_loop_ar9287 { |
552 | u8 pwrPdg[2][5]; | 553 | u8 pwrPdg[2][5]; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 76b4d65472dd..a3ccb1b9638d 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah, | |||
451 | ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, | 451 | ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, |
452 | AR_AN_TOP2_LOCALBIAS, | 452 | AR_AN_TOP2_LOCALBIAS, |
453 | AR_AN_TOP2_LOCALBIAS_S, | 453 | AR_AN_TOP2_LOCALBIAS_S, |
454 | pModal->local_bias); | 454 | !!(pModal->lna_ctl & |
455 | LNA_CTL_LOCAL_BIAS)); | ||
455 | REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG, | 456 | REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG, |
456 | pModal->force_xpaon); | 457 | !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA)); |
457 | } | 458 | } |
458 | 459 | ||
459 | REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, | 460 | REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, |
@@ -1062,15 +1063,19 @@ static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, | |||
1062 | case 1: | 1063 | case 1: |
1063 | break; | 1064 | break; |
1064 | case 2: | 1065 | case 2: |
1065 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | 1066 | if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) |
1067 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | ||
1068 | else | ||
1069 | scaledPower = 0; | ||
1066 | break; | 1070 | break; |
1067 | case 3: | 1071 | case 3: |
1068 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | 1072 | if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) |
1073 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | ||
1074 | else | ||
1075 | scaledPower = 0; | ||
1069 | break; | 1076 | break; |
1070 | } | 1077 | } |
1071 | 1078 | ||
1072 | scaledPower = max((u16)0, scaledPower); | ||
1073 | |||
1074 | if (IS_CHAN_2GHZ(chan)) { | 1079 | if (IS_CHAN_2GHZ(chan)) { |
1075 | numCtlModes = ARRAY_SIZE(ctlModesFor11g) - | 1080 | numCtlModes = ARRAY_SIZE(ctlModesFor11g) - |
1076 | SUB_NUM_CTL_MODES_AT_2G_40; | 1081 | SUB_NUM_CTL_MODES_AT_2G_40; |
@@ -1428,9 +1433,9 @@ static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah, | |||
1428 | 1433 | ||
1429 | num_ant_config = 1; | 1434 | num_ant_config = 1; |
1430 | 1435 | ||
1431 | if (pBase->version >= 0x0E0D) | 1436 | if (pBase->version >= 0x0E0D && |
1432 | if (pModal->useAnt1) | 1437 | (pModal->lna_ctl & LNA_CTL_USE_ANT1)) |
1433 | num_ant_config += 1; | 1438 | num_ant_config += 1; |
1434 | 1439 | ||
1435 | return num_ant_config; | 1440 | return num_ant_config; |
1436 | } | 1441 | } |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index dfb6560dab92..0de3c3d3c245 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -1024,6 +1024,13 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface, | |||
1024 | struct hif_device_usb *hif_dev = | 1024 | struct hif_device_usb *hif_dev = |
1025 | (struct hif_device_usb *) usb_get_intfdata(interface); | 1025 | (struct hif_device_usb *) usb_get_intfdata(interface); |
1026 | 1026 | ||
1027 | /* | ||
1028 | * The device has to be set to FULLSLEEP mode in case no | ||
1029 | * interface is up. | ||
1030 | */ | ||
1031 | if (!(hif_dev->flags & HIF_USB_START)) | ||
1032 | ath9k_htc_suspend(hif_dev->htc_handle); | ||
1033 | |||
1027 | ath9k_hif_usb_dealloc_urbs(hif_dev); | 1034 | ath9k_hif_usb_dealloc_urbs(hif_dev); |
1028 | 1035 | ||
1029 | return 0; | 1036 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 75ecf6a30d25..c3b561daa6c1 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -455,6 +455,8 @@ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv); | |||
455 | void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv); | 455 | void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv); |
456 | void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv); | 456 | void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv); |
457 | void ath9k_ps_work(struct work_struct *work); | 457 | void ath9k_ps_work(struct work_struct *work); |
458 | bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, | ||
459 | enum ath9k_power_mode mode); | ||
458 | 460 | ||
459 | void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); | 461 | void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); |
460 | void ath9k_init_leds(struct ath9k_htc_priv *priv); | 462 | void ath9k_init_leds(struct ath9k_htc_priv *priv); |
@@ -464,6 +466,7 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, | |||
464 | u16 devid, char *product); | 466 | u16 devid, char *product); |
465 | void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug); | 467 | void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug); |
466 | #ifdef CONFIG_PM | 468 | #ifdef CONFIG_PM |
469 | void ath9k_htc_suspend(struct htc_target *htc_handle); | ||
467 | int ath9k_htc_resume(struct htc_target *htc_handle); | 470 | int ath9k_htc_resume(struct htc_target *htc_handle); |
468 | #endif | 471 | #endif |
469 | #ifdef CONFIG_ATH9K_HTC_DEBUGFS | 472 | #ifdef CONFIG_ATH9K_HTC_DEBUGFS |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 7c8a38d04561..8776f49ffd41 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -891,6 +891,12 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) | |||
891 | } | 891 | } |
892 | 892 | ||
893 | #ifdef CONFIG_PM | 893 | #ifdef CONFIG_PM |
894 | |||
895 | void ath9k_htc_suspend(struct htc_target *htc_handle) | ||
896 | { | ||
897 | ath9k_htc_setpower(htc_handle->drv_priv, ATH9K_PM_FULL_SLEEP); | ||
898 | } | ||
899 | |||
894 | int ath9k_htc_resume(struct htc_target *htc_handle) | 900 | int ath9k_htc_resume(struct htc_target *htc_handle) |
895 | { | 901 | { |
896 | int ret; | 902 | int ret; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 9a3be8da755d..51977caca47f 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -63,8 +63,8 @@ static enum htc_phymode ath9k_htc_get_curmode(struct ath9k_htc_priv *priv, | |||
63 | return mode; | 63 | return mode; |
64 | } | 64 | } |
65 | 65 | ||
66 | static bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, | 66 | bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, |
67 | enum ath9k_power_mode mode) | 67 | enum ath9k_power_mode mode) |
68 | { | 68 | { |
69 | bool ret; | 69 | bool ret; |
70 | 70 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6ebc68bca91f..c7fbe25cc128 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2044,7 +2044,8 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio) | |||
2044 | val = REG_READ(ah, AR7010_GPIO_IN); | 2044 | val = REG_READ(ah, AR7010_GPIO_IN); |
2045 | return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; | 2045 | return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; |
2046 | } else if (AR_SREV_9300_20_OR_LATER(ah)) | 2046 | } else if (AR_SREV_9300_20_OR_LATER(ah)) |
2047 | return MS_REG_READ(AR9300, gpio) != 0; | 2047 | return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) & |
2048 | AR_GPIO_BIT(gpio)) != 0; | ||
2048 | else if (AR_SREV_9271(ah)) | 2049 | else if (AR_SREV_9271(ah)) |
2049 | return MS_REG_READ(AR9271, gpio) != 0; | 2050 | return MS_REG_READ(AR9271, gpio) != 0; |
2050 | else if (AR_SREV_9287_11_OR_LATER(ah)) | 2051 | else if (AR_SREV_9287_11_OR_LATER(ah)) |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 92bc5c5f4876..14b8ab386daf 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -15,7 +15,6 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/pm_qos_params.h> | ||
19 | 18 | ||
20 | #include "ath9k.h" | 19 | #include "ath9k.h" |
21 | 20 | ||
@@ -180,8 +179,6 @@ static const struct ath_ops ath9k_common_ops = { | |||
180 | .write = ath9k_iowrite32, | 179 | .write = ath9k_iowrite32, |
181 | }; | 180 | }; |
182 | 181 | ||
183 | struct pm_qos_request_list ath9k_pm_qos_req; | ||
184 | |||
185 | /**************************/ | 182 | /**************************/ |
186 | /* Initialization */ | 183 | /* Initialization */ |
187 | /**************************/ | 184 | /**************************/ |
@@ -664,6 +661,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
664 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; | 661 | hw->flags |= IEEE80211_HW_MFP_CAPABLE; |
665 | 662 | ||
666 | hw->wiphy->interface_modes = | 663 | hw->wiphy->interface_modes = |
664 | BIT(NL80211_IFTYPE_P2P_GO) | | ||
665 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
667 | BIT(NL80211_IFTYPE_AP) | | 666 | BIT(NL80211_IFTYPE_AP) | |
668 | BIT(NL80211_IFTYPE_WDS) | | 667 | BIT(NL80211_IFTYPE_WDS) | |
669 | BIT(NL80211_IFTYPE_STATION) | | 668 | BIT(NL80211_IFTYPE_STATION) | |
@@ -759,7 +758,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
759 | ath_init_leds(sc); | 758 | ath_init_leds(sc); |
760 | ath_start_rfkill_poll(sc); | 759 | ath_start_rfkill_poll(sc); |
761 | 760 | ||
762 | pm_qos_add_request(&ath9k_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, | 761 | pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, |
763 | PM_QOS_DEFAULT_VALUE); | 762 | PM_QOS_DEFAULT_VALUE); |
764 | 763 | ||
765 | return 0; | 764 | return 0; |
@@ -830,7 +829,7 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
830 | } | 829 | } |
831 | 830 | ||
832 | ieee80211_unregister_hw(hw); | 831 | ieee80211_unregister_hw(hw); |
833 | pm_qos_remove_request(&ath9k_pm_qos_req); | 832 | pm_qos_remove_request(&sc->pm_qos_req); |
834 | ath_rx_cleanup(sc); | 833 | ath_rx_cleanup(sc); |
835 | ath_tx_cleanup(sc); | 834 | ath_tx_cleanup(sc); |
836 | ath9k_deinit_softc(sc); | 835 | ath9k_deinit_softc(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 8c13479b17cd..c996963ab339 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -703,8 +703,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | |||
703 | rs->rs_phyerr = phyerr; | 703 | rs->rs_phyerr = phyerr; |
704 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) | 704 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) |
705 | rs->rs_status |= ATH9K_RXERR_DECRYPT; | 705 | rs->rs_status |= ATH9K_RXERR_DECRYPT; |
706 | else if ((ads.ds_rxstatus8 & AR_MichaelErr) && | 706 | else if (ads.ds_rxstatus8 & AR_MichaelErr) |
707 | rs->rs_keyix != ATH9K_RXKEYIX_INVALID) | ||
708 | rs->rs_status |= ATH9K_RXERR_MIC; | 707 | rs->rs_status |= ATH9K_RXERR_MIC; |
709 | else if (ads.ds_rxstatus8 & AR_KeyMiss) | 708 | else if (ads.ds_rxstatus8 & AR_KeyMiss) |
710 | rs->rs_status |= ATH9K_RXERR_DECRYPT; | 709 | rs->rs_status |= ATH9K_RXERR_DECRYPT; |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 25d3ef4c338e..c0c3464d3a86 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -15,7 +15,6 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/nl80211.h> | 17 | #include <linux/nl80211.h> |
18 | #include <linux/pm_qos_params.h> | ||
19 | #include "ath9k.h" | 18 | #include "ath9k.h" |
20 | #include "btcoex.h" | 19 | #include "btcoex.h" |
21 | 20 | ||
@@ -245,11 +244,12 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | |||
245 | * the relevant bits of the h/w. | 244 | * the relevant bits of the h/w. |
246 | */ | 245 | */ |
247 | ath9k_hw_set_interrupts(ah, 0); | 246 | ath9k_hw_set_interrupts(ah, 0); |
248 | ath_drain_all_txq(sc, false); | 247 | stopped = ath_drain_all_txq(sc, false); |
249 | 248 | ||
250 | spin_lock_bh(&sc->rx.pcu_lock); | 249 | spin_lock_bh(&sc->rx.pcu_lock); |
251 | 250 | ||
252 | stopped = ath_stoprecv(sc); | 251 | if (!ath_stoprecv(sc)) |
252 | stopped = false; | ||
253 | 253 | ||
254 | /* XXX: do not flush receive queue here. We don't want | 254 | /* XXX: do not flush receive queue here. We don't want |
255 | * to flush data frames already in queue because of | 255 | * to flush data frames already in queue because of |
@@ -1244,7 +1244,7 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1244 | ath9k_btcoex_timer_resume(sc); | 1244 | ath9k_btcoex_timer_resume(sc); |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | pm_qos_update_request(&ath9k_pm_qos_req, 55); | 1247 | pm_qos_update_request(&sc->pm_qos_req, 55); |
1248 | 1248 | ||
1249 | mutex_unlock: | 1249 | mutex_unlock: |
1250 | mutex_unlock(&sc->mutex); | 1250 | mutex_unlock(&sc->mutex); |
@@ -1423,7 +1423,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1423 | 1423 | ||
1424 | sc->sc_flags |= SC_OP_INVALID; | 1424 | sc->sc_flags |= SC_OP_INVALID; |
1425 | 1425 | ||
1426 | pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE); | 1426 | pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE); |
1427 | 1427 | ||
1428 | mutex_unlock(&sc->mutex); | 1428 | mutex_unlock(&sc->mutex); |
1429 | 1429 | ||
@@ -1520,7 +1520,6 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1520 | struct ath_softc *sc = aphy->sc; | 1520 | struct ath_softc *sc = aphy->sc; |
1521 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1521 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1522 | struct ath_vif *avp = (void *)vif->drv_priv; | 1522 | struct ath_vif *avp = (void *)vif->drv_priv; |
1523 | int i; | ||
1524 | 1523 | ||
1525 | ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); | 1524 | ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); |
1526 | 1525 | ||
@@ -1534,21 +1533,24 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1534 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || | 1533 | if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || |
1535 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || | 1534 | (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || |
1536 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { | 1535 | (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { |
1536 | /* Disable SWBA interrupt */ | ||
1537 | sc->sc_ah->imask &= ~ATH9K_INT_SWBA; | ||
1537 | ath9k_ps_wakeup(sc); | 1538 | ath9k_ps_wakeup(sc); |
1539 | ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); | ||
1538 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 1540 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); |
1539 | ath9k_ps_restore(sc); | 1541 | ath9k_ps_restore(sc); |
1542 | tasklet_kill(&sc->bcon_tasklet); | ||
1540 | } | 1543 | } |
1541 | 1544 | ||
1542 | ath_beacon_return(sc, avp); | 1545 | ath_beacon_return(sc, avp); |
1543 | sc->sc_flags &= ~SC_OP_BEACONS; | 1546 | sc->sc_flags &= ~SC_OP_BEACONS; |
1544 | 1547 | ||
1545 | for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { | 1548 | if (sc->nbcnvifs) { |
1546 | if (sc->beacon.bslot[i] == vif) { | 1549 | /* Re-enable SWBA interrupt */ |
1547 | printk(KERN_DEBUG "%s: vif had allocated beacon " | 1550 | sc->sc_ah->imask |= ATH9K_INT_SWBA; |
1548 | "slot\n", __func__); | 1551 | ath9k_ps_wakeup(sc); |
1549 | sc->beacon.bslot[i] = NULL; | 1552 | ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); |
1550 | sc->beacon.bslot_aphy[i] = NULL; | 1553 | ath9k_ps_restore(sc); |
1551 | } | ||
1552 | } | 1554 | } |
1553 | 1555 | ||
1554 | sc->nvifs--; | 1556 | sc->nvifs--; |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index c76ea53c20ce..fdc2ec52b42f 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -518,7 +518,7 @@ bool ath_stoprecv(struct ath_softc *sc) | |||
518 | bool stopped; | 518 | bool stopped; |
519 | 519 | ||
520 | spin_lock_bh(&sc->rx.rxbuflock); | 520 | spin_lock_bh(&sc->rx.rxbuflock); |
521 | ath9k_hw_stoppcurecv(ah); | 521 | ath9k_hw_abortpcurecv(ah); |
522 | ath9k_hw_setrxfilter(ah, 0); | 522 | ath9k_hw_setrxfilter(ah, 0); |
523 | stopped = ath9k_hw_stopdmarecv(ah); | 523 | stopped = ath9k_hw_stopdmarecv(ah); |
524 | 524 | ||
@@ -838,6 +838,10 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
838 | struct ath_rx_status *rx_stats, | 838 | struct ath_rx_status *rx_stats, |
839 | bool *decrypt_error) | 839 | bool *decrypt_error) |
840 | { | 840 | { |
841 | #define is_mc_or_valid_tkip_keyix ((is_mc || \ | ||
842 | (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \ | ||
843 | test_bit(rx_stats->rs_keyix, common->tkip_keymap)))) | ||
844 | |||
841 | struct ath_hw *ah = common->ah; | 845 | struct ath_hw *ah = common->ah; |
842 | __le16 fc; | 846 | __le16 fc; |
843 | u8 rx_status_len = ah->caps.rx_status_len; | 847 | u8 rx_status_len = ah->caps.rx_status_len; |
@@ -879,15 +883,18 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
879 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { | 883 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { |
880 | *decrypt_error = true; | 884 | *decrypt_error = true; |
881 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { | 885 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { |
886 | bool is_mc; | ||
882 | /* | 887 | /* |
883 | * The MIC error bit is only valid if the frame | 888 | * The MIC error bit is only valid if the frame |
884 | * is not a control frame or fragment, and it was | 889 | * is not a control frame or fragment, and it was |
885 | * decrypted using a valid TKIP key. | 890 | * decrypted using a valid TKIP key. |
886 | */ | 891 | */ |
892 | is_mc = !!is_multicast_ether_addr(hdr->addr1); | ||
893 | |||
887 | if (!ieee80211_is_ctl(fc) && | 894 | if (!ieee80211_is_ctl(fc) && |
888 | !ieee80211_has_morefrags(fc) && | 895 | !ieee80211_has_morefrags(fc) && |
889 | !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && | 896 | !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && |
890 | test_bit(rx_stats->rs_keyix, common->tkip_keymap)) | 897 | is_mc_or_valid_tkip_keyix) |
891 | rxs->flag |= RX_FLAG_MMIC_ERROR; | 898 | rxs->flag |= RX_FLAG_MMIC_ERROR; |
892 | else | 899 | else |
893 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; | 900 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index dddf579aacf1..2c6a22fbb0f0 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -984,11 +984,13 @@ enum { | |||
984 | #define AR9287_GPIO_IN_VAL_S 11 | 984 | #define AR9287_GPIO_IN_VAL_S 11 |
985 | #define AR9271_GPIO_IN_VAL 0xFFFF0000 | 985 | #define AR9271_GPIO_IN_VAL 0xFFFF0000 |
986 | #define AR9271_GPIO_IN_VAL_S 16 | 986 | #define AR9271_GPIO_IN_VAL_S 16 |
987 | #define AR9300_GPIO_IN_VAL 0x0001FFFF | ||
988 | #define AR9300_GPIO_IN_VAL_S 0 | ||
989 | #define AR7010_GPIO_IN_VAL 0x0000FFFF | 987 | #define AR7010_GPIO_IN_VAL 0x0000FFFF |
990 | #define AR7010_GPIO_IN_VAL_S 0 | 988 | #define AR7010_GPIO_IN_VAL_S 0 |
991 | 989 | ||
990 | #define AR_GPIO_IN 0x404c | ||
991 | #define AR9300_GPIO_IN_VAL 0x0001FFFF | ||
992 | #define AR9300_GPIO_IN_VAL_S 0 | ||
993 | |||
992 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) | 994 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) |
993 | #define AR_GPIO_OE_OUT_DRV 0x3 | 995 | #define AR_GPIO_OE_OUT_DRV 0x3 |
994 | #define AR_GPIO_OE_OUT_DRV_NO 0x0 | 996 | #define AR_GPIO_OE_OUT_DRV_NO 0x0 |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index f2ade2402ce2..aff04789f794 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1120,7 +1120,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) | |||
1120 | } | 1120 | } |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | 1123 | bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) |
1124 | { | 1124 | { |
1125 | struct ath_hw *ah = sc->sc_ah; | 1125 | struct ath_hw *ah = sc->sc_ah; |
1126 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1126 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
@@ -1128,7 +1128,7 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | |||
1128 | int i, npend = 0; | 1128 | int i, npend = 0; |
1129 | 1129 | ||
1130 | if (sc->sc_flags & SC_OP_INVALID) | 1130 | if (sc->sc_flags & SC_OP_INVALID) |
1131 | return; | 1131 | return true; |
1132 | 1132 | ||
1133 | /* Stop beacon queue */ | 1133 | /* Stop beacon queue */ |
1134 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); | 1134 | ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); |
@@ -1142,25 +1142,15 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | |||
1142 | } | 1142 | } |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | if (npend) { | 1145 | if (npend) |
1146 | int r; | 1146 | ath_print(common, ATH_DBG_FATAL, "Failed to stop TX DMA!\n"); |
1147 | |||
1148 | ath_print(common, ATH_DBG_FATAL, | ||
1149 | "Failed to stop TX DMA. Resetting hardware!\n"); | ||
1150 | |||
1151 | spin_lock_bh(&sc->sc_resetlock); | ||
1152 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); | ||
1153 | if (r) | ||
1154 | ath_print(common, ATH_DBG_FATAL, | ||
1155 | "Unable to reset hardware; reset status %d\n", | ||
1156 | r); | ||
1157 | spin_unlock_bh(&sc->sc_resetlock); | ||
1158 | } | ||
1159 | 1147 | ||
1160 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { | 1148 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { |
1161 | if (ATH_TXQ_SETUP(sc, i)) | 1149 | if (ATH_TXQ_SETUP(sc, i)) |
1162 | ath_draintxq(sc, &sc->tx.txq[i], retry_tx); | 1150 | ath_draintxq(sc, &sc->tx.txq[i], retry_tx); |
1163 | } | 1151 | } |
1152 | |||
1153 | return !npend; | ||
1164 | } | 1154 | } |
1165 | 1155 | ||
1166 | void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) | 1156 | void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) |
diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c index ae6c006bbc56..546b4e4ec5ea 100644 --- a/drivers/net/wireless/ath/carl9170/fw.c +++ b/drivers/net/wireless/ath/carl9170/fw.c | |||
@@ -291,7 +291,8 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) | |||
291 | 291 | ||
292 | if (SUPP(CARL9170FW_WLANTX_CAB)) { | 292 | if (SUPP(CARL9170FW_WLANTX_CAB)) { |
293 | ar->hw->wiphy->interface_modes |= | 293 | ar->hw->wiphy->interface_modes |= |
294 | BIT(NL80211_IFTYPE_AP); | 294 | BIT(NL80211_IFTYPE_AP) | |
295 | BIT(NL80211_IFTYPE_P2P_GO); | ||
295 | } | 296 | } |
296 | } | 297 | } |
297 | 298 | ||
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c index 980ae70ea424..dc7b30b170d0 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
@@ -647,7 +647,7 @@ init: | |||
647 | } | 647 | } |
648 | 648 | ||
649 | unlock: | 649 | unlock: |
650 | if (err && (vif_id != -1)) { | 650 | if (err && (vif_id >= 0)) { |
651 | vif_priv->active = false; | 651 | vif_priv->active = false; |
652 | bitmap_release_region(&ar->vif_bitmap, vif_id, 0); | 652 | bitmap_release_region(&ar->vif_bitmap, vif_id, 0); |
653 | ar->vifs--; | 653 | ar->vifs--; |
@@ -1631,7 +1631,8 @@ void *carl9170_alloc(size_t priv_size) | |||
1631 | * supports these modes. The code which will add the | 1631 | * supports these modes. The code which will add the |
1632 | * additional interface_modes is in fw.c. | 1632 | * additional interface_modes is in fw.c. |
1633 | */ | 1633 | */ |
1634 | hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); | 1634 | hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
1635 | BIT(NL80211_IFTYPE_P2P_CLIENT); | ||
1635 | 1636 | ||
1636 | hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | | 1637 | hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | |
1637 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | | 1638 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c index b575c865142d..7e6506a77bbb 100644 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ b/drivers/net/wireless/ath/carl9170/tx.c | |||
@@ -810,7 +810,7 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) | |||
810 | 810 | ||
811 | mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | | 811 | mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | |
812 | AR9170_TX_MAC_BACKOFF); | 812 | AR9170_TX_MAC_BACKOFF); |
813 | mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) && | 813 | mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) & |
814 | AR9170_TX_MAC_QOS); | 814 | AR9170_TX_MAC_QOS); |
815 | 815 | ||
816 | no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK); | 816 | no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK); |
diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c index 9a55338d957f..09e2dfd7b175 100644 --- a/drivers/net/wireless/b43/sdio.c +++ b/drivers/net/wireless/b43/sdio.c | |||
@@ -163,6 +163,7 @@ static int b43_sdio_probe(struct sdio_func *func, | |||
163 | err_free_ssb: | 163 | err_free_ssb: |
164 | kfree(sdio); | 164 | kfree(sdio); |
165 | err_disable_func: | 165 | err_disable_func: |
166 | sdio_claim_host(func); | ||
166 | sdio_disable_func(func); | 167 | sdio_disable_func(func); |
167 | err_release_host: | 168 | err_release_host: |
168 | sdio_release_host(func); | 169 | sdio_release_host(func); |
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 25a2722c8a98..1d9aed645723 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -891,7 +891,6 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local, | |||
891 | 891 | ||
892 | SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops); | 892 | SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops); |
893 | 893 | ||
894 | netif_stop_queue(dev); | ||
895 | } | 894 | } |
896 | 895 | ||
897 | static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) | 896 | static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index db540910b110..0e027f787fbc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -315,6 +315,7 @@ struct iwl_cfg iwl100_bgn_cfg = { | |||
315 | .mod_params = &iwlagn_mod_params, | 315 | .mod_params = &iwlagn_mod_params, |
316 | .base_params = &iwl1000_base_params, | 316 | .base_params = &iwl1000_base_params, |
317 | .ht_params = &iwl1000_ht_params, | 317 | .ht_params = &iwl1000_ht_params, |
318 | .use_new_eeprom_reading = true, | ||
318 | }; | 319 | }; |
319 | 320 | ||
320 | struct iwl_cfg iwl100_bg_cfg = { | 321 | struct iwl_cfg iwl100_bg_cfg = { |
@@ -330,6 +331,7 @@ struct iwl_cfg iwl100_bg_cfg = { | |||
330 | .ops = &iwl1000_ops, | 331 | .ops = &iwl1000_ops, |
331 | .mod_params = &iwlagn_mod_params, | 332 | .mod_params = &iwlagn_mod_params, |
332 | .base_params = &iwl1000_base_params, | 333 | .base_params = &iwl1000_base_params, |
334 | .use_new_eeprom_reading = true, | ||
333 | }; | 335 | }; |
334 | 336 | ||
335 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 337 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 11e6532fc573..0ceeaac85eda 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -561,6 +561,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = { | |||
561 | .ht_params = &iwl6000_ht_params, | 561 | .ht_params = &iwl6000_ht_params, |
562 | .need_dc_calib = true, | 562 | .need_dc_calib = true, |
563 | .need_temp_offset_calib = true, | 563 | .need_temp_offset_calib = true, |
564 | .use_new_eeprom_reading = true, | ||
564 | }; | 565 | }; |
565 | 566 | ||
566 | struct iwl_cfg iwl6000g2a_2abg_cfg = { | 567 | struct iwl_cfg iwl6000g2a_2abg_cfg = { |
@@ -578,6 +579,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = { | |||
578 | .base_params = &iwl6000_base_params, | 579 | .base_params = &iwl6000_base_params, |
579 | .need_dc_calib = true, | 580 | .need_dc_calib = true, |
580 | .need_temp_offset_calib = true, | 581 | .need_temp_offset_calib = true, |
582 | .use_new_eeprom_reading = true, | ||
581 | }; | 583 | }; |
582 | 584 | ||
583 | struct iwl_cfg iwl6000g2a_2bg_cfg = { | 585 | struct iwl_cfg iwl6000g2a_2bg_cfg = { |
@@ -595,6 +597,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = { | |||
595 | .base_params = &iwl6000_base_params, | 597 | .base_params = &iwl6000_base_params, |
596 | .need_dc_calib = true, | 598 | .need_dc_calib = true, |
597 | .need_temp_offset_calib = true, | 599 | .need_temp_offset_calib = true, |
600 | .use_new_eeprom_reading = true, | ||
598 | }; | 601 | }; |
599 | 602 | ||
600 | struct iwl_cfg iwl6000g2b_2agn_cfg = { | 603 | struct iwl_cfg iwl6000g2b_2agn_cfg = { |
@@ -616,6 +619,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { | |||
616 | .need_temp_offset_calib = true, | 619 | .need_temp_offset_calib = true, |
617 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 620 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
618 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 621 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
622 | .use_new_eeprom_reading = true, | ||
619 | }; | 623 | }; |
620 | 624 | ||
621 | struct iwl_cfg iwl6000g2b_2abg_cfg = { | 625 | struct iwl_cfg iwl6000g2b_2abg_cfg = { |
@@ -636,6 +640,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { | |||
636 | .need_temp_offset_calib = true, | 640 | .need_temp_offset_calib = true, |
637 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 641 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
638 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 642 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
643 | .use_new_eeprom_reading = true, | ||
639 | }; | 644 | }; |
640 | 645 | ||
641 | struct iwl_cfg iwl6000g2b_2bgn_cfg = { | 646 | struct iwl_cfg iwl6000g2b_2bgn_cfg = { |
@@ -657,6 +662,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { | |||
657 | .need_temp_offset_calib = true, | 662 | .need_temp_offset_calib = true, |
658 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 663 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
659 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 664 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
665 | .use_new_eeprom_reading = true, | ||
660 | }; | 666 | }; |
661 | 667 | ||
662 | struct iwl_cfg iwl6000g2b_2bg_cfg = { | 668 | struct iwl_cfg iwl6000g2b_2bg_cfg = { |
@@ -677,6 +683,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { | |||
677 | .need_temp_offset_calib = true, | 683 | .need_temp_offset_calib = true, |
678 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 684 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
679 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 685 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
686 | .use_new_eeprom_reading = true, | ||
680 | }; | 687 | }; |
681 | 688 | ||
682 | struct iwl_cfg iwl6000g2b_bgn_cfg = { | 689 | struct iwl_cfg iwl6000g2b_bgn_cfg = { |
@@ -698,6 +705,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { | |||
698 | .need_temp_offset_calib = true, | 705 | .need_temp_offset_calib = true, |
699 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 706 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
700 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 707 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
708 | .use_new_eeprom_reading = true, | ||
701 | }; | 709 | }; |
702 | 710 | ||
703 | struct iwl_cfg iwl6000g2b_bg_cfg = { | 711 | struct iwl_cfg iwl6000g2b_bg_cfg = { |
@@ -718,6 +726,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { | |||
718 | .need_temp_offset_calib = true, | 726 | .need_temp_offset_calib = true, |
719 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 727 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
720 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 728 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
729 | .use_new_eeprom_reading = true, | ||
721 | }; | 730 | }; |
722 | 731 | ||
723 | /* | 732 | /* |
@@ -804,6 +813,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = { | |||
804 | .base_params = &iwl6050_base_params, | 813 | .base_params = &iwl6050_base_params, |
805 | .ht_params = &iwl6000_ht_params, | 814 | .ht_params = &iwl6000_ht_params, |
806 | .need_dc_calib = true, | 815 | .need_dc_calib = true, |
816 | .use_new_eeprom_reading = true, | ||
807 | }; | 817 | }; |
808 | 818 | ||
809 | struct iwl_cfg iwl6050_2abg_cfg = { | 819 | struct iwl_cfg iwl6050_2abg_cfg = { |
@@ -857,6 +867,7 @@ struct iwl_cfg iwl130_bgn_cfg = { | |||
857 | .need_dc_calib = true, | 867 | .need_dc_calib = true, |
858 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 868 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
859 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 869 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
870 | .use_new_eeprom_reading = true, | ||
860 | }; | 871 | }; |
861 | 872 | ||
862 | struct iwl_cfg iwl130_bg_cfg = { | 873 | struct iwl_cfg iwl130_bg_cfg = { |
@@ -876,6 +887,7 @@ struct iwl_cfg iwl130_bg_cfg = { | |||
876 | .need_dc_calib = true, | 887 | .need_dc_calib = true, |
877 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ | 888 | /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ |
878 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, | 889 | .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, |
890 | .use_new_eeprom_reading = true, | ||
879 | }; | 891 | }; |
880 | 892 | ||
881 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | 893 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c index a650baba0809..9eeeda18748d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | |||
@@ -392,7 +392,7 @@ static s8 iwl_update_channel_txpower(struct iwl_priv *priv, | |||
392 | /** | 392 | /** |
393 | * iwlcore_eeprom_enhanced_txpower: process enhanced tx power info | 393 | * iwlcore_eeprom_enhanced_txpower: process enhanced tx power info |
394 | */ | 394 | */ |
395 | void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) | 395 | static void iwlcore_eeprom_enhanced_txpower_old(struct iwl_priv *priv) |
396 | { | 396 | { |
397 | int eeprom_section_count = 0; | 397 | int eeprom_section_count = 0; |
398 | int section, element; | 398 | int section, element; |
@@ -419,7 +419,8 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
419 | * always check for valid entry before process | 419 | * always check for valid entry before process |
420 | * the information | 420 | * the information |
421 | */ | 421 | */ |
422 | if (!enhanced_txpower->common || enhanced_txpower->reserved) | 422 | if (!(enhanced_txpower->flags || enhanced_txpower->channel) || |
423 | enhanced_txpower->delta_20_in_40) | ||
423 | continue; | 424 | continue; |
424 | 425 | ||
425 | for (element = 0; element < eeprom_section_count; element++) { | 426 | for (element = 0; element < eeprom_section_count; element++) { |
@@ -452,3 +453,86 @@ void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
452 | } | 453 | } |
453 | } | 454 | } |
454 | } | 455 | } |
456 | |||
457 | static void | ||
458 | iwlcore_eeprom_enh_txp_read_element(struct iwl_priv *priv, | ||
459 | struct iwl_eeprom_enhanced_txpwr *txp, | ||
460 | s8 max_txpower_avg) | ||
461 | { | ||
462 | int ch_idx; | ||
463 | bool is_ht40 = txp->flags & IWL_EEPROM_ENH_TXP_FL_40MHZ; | ||
464 | enum ieee80211_band band; | ||
465 | |||
466 | band = txp->flags & IWL_EEPROM_ENH_TXP_FL_BAND_52G ? | ||
467 | IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; | ||
468 | |||
469 | for (ch_idx = 0; ch_idx < priv->channel_count; ch_idx++) { | ||
470 | struct iwl_channel_info *ch_info = &priv->channel_info[ch_idx]; | ||
471 | |||
472 | /* update matching channel or from common data only */ | ||
473 | if (txp->channel != 0 && ch_info->channel != txp->channel) | ||
474 | continue; | ||
475 | |||
476 | /* update matching band only */ | ||
477 | if (band != ch_info->band) | ||
478 | continue; | ||
479 | |||
480 | if (ch_info->max_power_avg < max_txpower_avg && !is_ht40) { | ||
481 | ch_info->max_power_avg = max_txpower_avg; | ||
482 | ch_info->curr_txpow = max_txpower_avg; | ||
483 | ch_info->scan_power = max_txpower_avg; | ||
484 | } | ||
485 | |||
486 | if (is_ht40 && ch_info->ht40_max_power_avg < max_txpower_avg) | ||
487 | ch_info->ht40_max_power_avg = max_txpower_avg; | ||
488 | } | ||
489 | } | ||
490 | |||
491 | #define EEPROM_TXP_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT) | ||
492 | #define EEPROM_TXP_ENTRY_LEN sizeof(struct iwl_eeprom_enhanced_txpwr) | ||
493 | #define EEPROM_TXP_SZ_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT_SIZE) | ||
494 | |||
495 | static void iwlcore_eeprom_enhanced_txpower_new(struct iwl_priv *priv) | ||
496 | { | ||
497 | struct iwl_eeprom_enhanced_txpwr *txp_array, *txp; | ||
498 | int idx, entries; | ||
499 | __le16 *txp_len; | ||
500 | s8 max_txp_avg, max_txp_avg_halfdbm; | ||
501 | |||
502 | BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8); | ||
503 | |||
504 | /* the length is in 16-bit words, but we want entries */ | ||
505 | txp_len = (__le16 *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_SZ_OFFS); | ||
506 | entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN; | ||
507 | |||
508 | txp_array = (void *) iwlagn_eeprom_query_addr(priv, EEPROM_TXP_OFFS); | ||
509 | for (idx = 0; idx < entries; idx++) { | ||
510 | txp = &txp_array[idx]; | ||
511 | |||
512 | /* skip invalid entries */ | ||
513 | if (!(txp->flags & IWL_EEPROM_ENH_TXP_FL_VALID)) | ||
514 | continue; | ||
515 | |||
516 | max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx, | ||
517 | &max_txp_avg_halfdbm); | ||
518 | |||
519 | /* | ||
520 | * Update the user limit values values to the highest | ||
521 | * power supported by any channel | ||
522 | */ | ||
523 | if (max_txp_avg > priv->tx_power_user_lmt) | ||
524 | priv->tx_power_user_lmt = max_txp_avg; | ||
525 | if (max_txp_avg_halfdbm > priv->tx_power_lmt_in_half_dbm) | ||
526 | priv->tx_power_lmt_in_half_dbm = max_txp_avg_halfdbm; | ||
527 | |||
528 | iwlcore_eeprom_enh_txp_read_element(priv, txp, max_txp_avg); | ||
529 | } | ||
530 | } | ||
531 | |||
532 | void iwlcore_eeprom_enhanced_txpower(struct iwl_priv *priv) | ||
533 | { | ||
534 | if (priv->cfg->use_new_eeprom_reading) | ||
535 | iwlcore_eeprom_enhanced_txpower_new(priv); | ||
536 | else | ||
537 | iwlcore_eeprom_enhanced_txpower_old(priv); | ||
538 | } | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index b555edd53354..554afb7d9670 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -569,6 +569,12 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address) | |||
569 | case INDIRECT_REGULATORY: | 569 | case INDIRECT_REGULATORY: |
570 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY); | 570 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY); |
571 | break; | 571 | break; |
572 | case INDIRECT_TXP_LIMIT: | ||
573 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT); | ||
574 | break; | ||
575 | case INDIRECT_TXP_LIMIT_SIZE: | ||
576 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE); | ||
577 | break; | ||
572 | case INDIRECT_CALIBRATION: | 578 | case INDIRECT_CALIBRATION: |
573 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION); | 579 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION); |
574 | break; | 580 | break; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 64527def059f..954ecc2c34c4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -390,6 +390,7 @@ struct iwl_cfg { | |||
390 | const bool need_temp_offset_calib; /* if used set to true */ | 390 | const bool need_temp_offset_calib; /* if used set to true */ |
391 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; | 391 | u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; |
392 | u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; | 392 | u8 scan_tx_antennas[IEEE80211_NUM_BANDS]; |
393 | const bool use_new_eeprom_reading; /* temporary, remove later */ | ||
393 | }; | 394 | }; |
394 | 395 | ||
395 | /*************************** | 396 | /*************************** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index d9b590625ae4..e3a279d2d0b6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -120,6 +120,17 @@ struct iwl_eeprom_channel { | |||
120 | s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ | 120 | s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ |
121 | } __packed; | 121 | } __packed; |
122 | 122 | ||
123 | enum iwl_eeprom_enhanced_txpwr_flags { | ||
124 | IWL_EEPROM_ENH_TXP_FL_VALID = BIT(0), | ||
125 | IWL_EEPROM_ENH_TXP_FL_BAND_52G = BIT(1), | ||
126 | IWL_EEPROM_ENH_TXP_FL_OFDM = BIT(2), | ||
127 | IWL_EEPROM_ENH_TXP_FL_40MHZ = BIT(3), | ||
128 | IWL_EEPROM_ENH_TXP_FL_HT_AP = BIT(4), | ||
129 | IWL_EEPROM_ENH_TXP_FL_RES1 = BIT(5), | ||
130 | IWL_EEPROM_ENH_TXP_FL_RES2 = BIT(6), | ||
131 | IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE = BIT(7), | ||
132 | }; | ||
133 | |||
123 | /** | 134 | /** |
124 | * iwl_eeprom_enhanced_txpwr structure | 135 | * iwl_eeprom_enhanced_txpwr structure |
125 | * This structure presents the enhanced regulatory tx power limit layout | 136 | * This structure presents the enhanced regulatory tx power limit layout |
@@ -127,21 +138,23 @@ struct iwl_eeprom_channel { | |||
127 | * Enhanced regulatory tx power portion of eeprom image can be broken down | 138 | * Enhanced regulatory tx power portion of eeprom image can be broken down |
128 | * into individual structures; each one is 8 bytes in size and contain the | 139 | * into individual structures; each one is 8 bytes in size and contain the |
129 | * following information | 140 | * following information |
130 | * @common: (desc + channel) not used by driver, should _NOT_ be "zero" | 141 | * @flags: entry flags |
142 | * @channel: channel number | ||
131 | * @chain_a_max_pwr: chain a max power in 1/2 dBm | 143 | * @chain_a_max_pwr: chain a max power in 1/2 dBm |
132 | * @chain_b_max_pwr: chain b max power in 1/2 dBm | 144 | * @chain_b_max_pwr: chain b max power in 1/2 dBm |
133 | * @chain_c_max_pwr: chain c max power in 1/2 dBm | 145 | * @chain_c_max_pwr: chain c max power in 1/2 dBm |
134 | * @reserved: not used, should be "zero" | 146 | * @delta_20_in_40: 20-in-40 deltas (hi/lo) |
135 | * @mimo2_max_pwr: mimo2 max power in 1/2 dBm | 147 | * @mimo2_max_pwr: mimo2 max power in 1/2 dBm |
136 | * @mimo3_max_pwr: mimo3 max power in 1/2 dBm | 148 | * @mimo3_max_pwr: mimo3 max power in 1/2 dBm |
137 | * | 149 | * |
138 | */ | 150 | */ |
139 | struct iwl_eeprom_enhanced_txpwr { | 151 | struct iwl_eeprom_enhanced_txpwr { |
140 | __le16 common; | 152 | u8 flags; |
153 | u8 channel; | ||
141 | s8 chain_a_max; | 154 | s8 chain_a_max; |
142 | s8 chain_b_max; | 155 | s8 chain_b_max; |
143 | s8 chain_c_max; | 156 | s8 chain_c_max; |
144 | s8 reserved; | 157 | u8 delta_20_in_40; |
145 | s8 mimo2_max; | 158 | s8 mimo2_max; |
146 | s8 mimo3_max; | 159 | s8 mimo3_max; |
147 | } __packed; | 160 | } __packed; |
@@ -186,6 +199,8 @@ struct iwl_eeprom_enhanced_txpwr { | |||
186 | #define EEPROM_LINK_CALIBRATION (2*0x67) | 199 | #define EEPROM_LINK_CALIBRATION (2*0x67) |
187 | #define EEPROM_LINK_PROCESS_ADJST (2*0x68) | 200 | #define EEPROM_LINK_PROCESS_ADJST (2*0x68) |
188 | #define EEPROM_LINK_OTHERS (2*0x69) | 201 | #define EEPROM_LINK_OTHERS (2*0x69) |
202 | #define EEPROM_LINK_TXP_LIMIT (2*0x6a) | ||
203 | #define EEPROM_LINK_TXP_LIMIT_SIZE (2*0x6b) | ||
189 | 204 | ||
190 | /* agn regulatory - indirect access */ | 205 | /* agn regulatory - indirect access */ |
191 | #define EEPROM_REG_BAND_1_CHANNELS ((0x08)\ | 206 | #define EEPROM_REG_BAND_1_CHANNELS ((0x08)\ |
@@ -389,6 +404,8 @@ struct iwl_eeprom_calib_info { | |||
389 | #define INDIRECT_CALIBRATION 0x00040000 | 404 | #define INDIRECT_CALIBRATION 0x00040000 |
390 | #define INDIRECT_PROCESS_ADJST 0x00050000 | 405 | #define INDIRECT_PROCESS_ADJST 0x00050000 |
391 | #define INDIRECT_OTHERS 0x00060000 | 406 | #define INDIRECT_OTHERS 0x00060000 |
407 | #define INDIRECT_TXP_LIMIT 0x00070000 | ||
408 | #define INDIRECT_TXP_LIMIT_SIZE 0x00080000 | ||
392 | #define INDIRECT_ADDRESS 0x00100000 | 409 | #define INDIRECT_ADDRESS 0x00100000 |
393 | 410 | ||
394 | /* General */ | 411 | /* General */ |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 373930afc26b..113f4f204657 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -619,7 +619,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, | |||
619 | print_ssid(ssid_buf, ssid, ssid_len), | 619 | print_ssid(ssid_buf, ssid, ssid_len), |
620 | LBS_SCAN_RSSI_TO_MBM(rssi)/100); | 620 | LBS_SCAN_RSSI_TO_MBM(rssi)/100); |
621 | 621 | ||
622 | if (channel || | 622 | if (channel && |
623 | !(channel->flags & IEEE80211_CHAN_DISABLED)) | 623 | !(channel->flags & IEEE80211_CHAN_DISABLED)) |
624 | cfg80211_inform_bss(wiphy, channel, | 624 | cfg80211_inform_bss(wiphy, channel, |
625 | bssid, le64_to_cpu(*(__le64 *)tsfdesc), | 625 | bssid, le64_to_cpu(*(__le64 *)tsfdesc), |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index e5685dc317a8..b4de0ca10feb 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -1170,7 +1170,6 @@ static void if_sdio_remove(struct sdio_func *func) | |||
1170 | lbs_deb_sdio("call remove card\n"); | 1170 | lbs_deb_sdio("call remove card\n"); |
1171 | lbs_stop_card(card->priv); | 1171 | lbs_stop_card(card->priv); |
1172 | lbs_remove_card(card->priv); | 1172 | lbs_remove_card(card->priv); |
1173 | card->priv->surpriseremoved = 1; | ||
1174 | 1173 | ||
1175 | flush_workqueue(card->workqueue); | 1174 | flush_workqueue(card->workqueue); |
1176 | destroy_workqueue(card->workqueue); | 1175 | destroy_workqueue(card->workqueue); |
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index 79bcb4e5d2ca..ecd4d04b2c3c 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c | |||
@@ -1055,7 +1055,6 @@ static int __devexit libertas_spi_remove(struct spi_device *spi) | |||
1055 | lbs_stop_card(priv); | 1055 | lbs_stop_card(priv); |
1056 | lbs_remove_card(priv); /* will call free_netdev */ | 1056 | lbs_remove_card(priv); /* will call free_netdev */ |
1057 | 1057 | ||
1058 | priv->surpriseremoved = 1; | ||
1059 | free_irq(spi->irq, card); | 1058 | free_irq(spi->irq, card); |
1060 | if_spi_terminate_spi_thread(card); | 1059 | if_spi_terminate_spi_thread(card); |
1061 | if (card->pdata->teardown) | 1060 | if (card->pdata->teardown) |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 46b88b118c99..fcd1bbfc632d 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -915,8 +915,6 @@ void lbs_remove_card(struct lbs_private *priv) | |||
915 | 915 | ||
916 | lbs_free_adapter(priv); | 916 | lbs_free_adapter(priv); |
917 | lbs_cfg_free(priv); | 917 | lbs_cfg_free(priv); |
918 | |||
919 | priv->dev = NULL; | ||
920 | free_netdev(dev); | 918 | free_netdev(dev); |
921 | 919 | ||
922 | lbs_deb_leave(LBS_DEB_MAIN); | 920 | lbs_deb_leave(LBS_DEB_MAIN); |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index e8e2d0f4763d..f3d396e7544b 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -1392,10 +1392,9 @@ static void orinoco_process_scan_results(struct work_struct *work) | |||
1392 | orinoco_add_hostscan_results(priv, buf, len); | 1392 | orinoco_add_hostscan_results(priv, buf, len); |
1393 | 1393 | ||
1394 | kfree(buf); | 1394 | kfree(buf); |
1395 | } else if (priv->scan_request) { | 1395 | } else { |
1396 | /* Either abort or complete the scan */ | 1396 | /* Either abort or complete the scan */ |
1397 | cfg80211_scan_done(priv->scan_request, (len < 0)); | 1397 | orinoco_scan_done(priv, (len < 0)); |
1398 | priv->scan_request = NULL; | ||
1399 | } | 1398 | } |
1400 | 1399 | ||
1401 | spin_lock_irqsave(&priv->scan_lock, flags); | 1400 | spin_lock_irqsave(&priv->scan_lock, flags); |
@@ -1684,6 +1683,8 @@ static int __orinoco_down(struct orinoco_private *priv) | |||
1684 | hermes_write_regn(hw, EVACK, 0xffff); | 1683 | hermes_write_regn(hw, EVACK, 0xffff); |
1685 | } | 1684 | } |
1686 | 1685 | ||
1686 | orinoco_scan_done(priv, true); | ||
1687 | |||
1687 | /* firmware will have to reassociate */ | 1688 | /* firmware will have to reassociate */ |
1688 | netif_carrier_off(dev); | 1689 | netif_carrier_off(dev); |
1689 | priv->last_linkstatus = 0xffff; | 1690 | priv->last_linkstatus = 0xffff; |
@@ -1762,10 +1763,7 @@ void orinoco_reset(struct work_struct *work) | |||
1762 | orinoco_unlock(priv, &flags); | 1763 | orinoco_unlock(priv, &flags); |
1763 | 1764 | ||
1764 | /* Scanning support: Notify scan cancellation */ | 1765 | /* Scanning support: Notify scan cancellation */ |
1765 | if (priv->scan_request) { | 1766 | orinoco_scan_done(priv, true); |
1766 | cfg80211_scan_done(priv->scan_request, 1); | ||
1767 | priv->scan_request = NULL; | ||
1768 | } | ||
1769 | 1767 | ||
1770 | if (priv->hard_reset) { | 1768 | if (priv->hard_reset) { |
1771 | err = (*priv->hard_reset)(priv); | 1769 | err = (*priv->hard_reset)(priv); |
@@ -1813,6 +1811,12 @@ static int __orinoco_commit(struct orinoco_private *priv) | |||
1813 | struct net_device *dev = priv->ndev; | 1811 | struct net_device *dev = priv->ndev; |
1814 | int err = 0; | 1812 | int err = 0; |
1815 | 1813 | ||
1814 | /* If we've called commit, we are reconfiguring or bringing the | ||
1815 | * interface up. Maintaining countermeasures across this would | ||
1816 | * be confusing, so note that we've disabled them. The port will | ||
1817 | * be enabled later in orinoco_commit or __orinoco_up. */ | ||
1818 | priv->tkip_cm_active = 0; | ||
1819 | |||
1816 | err = orinoco_hw_program_rids(priv); | 1820 | err = orinoco_hw_program_rids(priv); |
1817 | 1821 | ||
1818 | /* FIXME: what about netif_tx_lock */ | 1822 | /* FIXME: what about netif_tx_lock */ |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 71b3d68b9403..32954c4b243a 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -151,20 +151,20 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
151 | goto failed; | 151 | goto failed; |
152 | } | 152 | } |
153 | 153 | ||
154 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
155 | if (ret) | ||
156 | goto failed; | ||
157 | |||
158 | /* We initialize the hermes structure before completing PCMCIA | ||
159 | * configuration just in case the interrupt handler gets | ||
160 | * called. */ | ||
161 | mem = ioport_map(link->resource[0]->start, | 154 | mem = ioport_map(link->resource[0]->start, |
162 | resource_size(link->resource[0])); | 155 | resource_size(link->resource[0])); |
163 | if (!mem) | 156 | if (!mem) |
164 | goto failed; | 157 | goto failed; |
165 | 158 | ||
159 | /* We initialize the hermes structure before completing PCMCIA | ||
160 | * configuration just in case the interrupt handler gets | ||
161 | * called. */ | ||
166 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 162 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
167 | 163 | ||
164 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
165 | if (ret) | ||
166 | goto failed; | ||
167 | |||
168 | ret = pcmcia_enable_device(link); | 168 | ret = pcmcia_enable_device(link); |
169 | if (ret) | 169 | if (ret) |
170 | goto failed; | 170 | goto failed; |
diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c index 4300d9db7d8c..86cb54c842e7 100644 --- a/drivers/net/wireless/orinoco/scan.c +++ b/drivers/net/wireless/orinoco/scan.c | |||
@@ -229,3 +229,11 @@ void orinoco_add_hostscan_results(struct orinoco_private *priv, | |||
229 | priv->scan_request = NULL; | 229 | priv->scan_request = NULL; |
230 | } | 230 | } |
231 | } | 231 | } |
232 | |||
233 | void orinoco_scan_done(struct orinoco_private *priv, bool abort) | ||
234 | { | ||
235 | if (priv->scan_request) { | ||
236 | cfg80211_scan_done(priv->scan_request, abort); | ||
237 | priv->scan_request = NULL; | ||
238 | } | ||
239 | } | ||
diff --git a/drivers/net/wireless/orinoco/scan.h b/drivers/net/wireless/orinoco/scan.h index 2dc4e046dbdb..27281fb0a6dc 100644 --- a/drivers/net/wireless/orinoco/scan.h +++ b/drivers/net/wireless/orinoco/scan.h | |||
@@ -16,5 +16,6 @@ void orinoco_add_extscan_result(struct orinoco_private *priv, | |||
16 | void orinoco_add_hostscan_results(struct orinoco_private *dev, | 16 | void orinoco_add_hostscan_results(struct orinoco_private *dev, |
17 | unsigned char *buf, | 17 | unsigned char *buf, |
18 | size_t len); | 18 | size_t len); |
19 | void orinoco_scan_done(struct orinoco_private *priv, bool abort); | ||
19 | 20 | ||
20 | #endif /* _ORINOCO_SCAN_H_ */ | 21 | #endif /* _ORINOCO_SCAN_H_ */ |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index fb859a5ad2eb..db34c282e59b 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -214,21 +214,21 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
214 | goto failed; | 214 | goto failed; |
215 | } | 215 | } |
216 | 216 | ||
217 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
218 | if (ret) | ||
219 | goto failed; | ||
220 | |||
221 | /* We initialize the hermes structure before completing PCMCIA | ||
222 | * configuration just in case the interrupt handler gets | ||
223 | * called. */ | ||
224 | mem = ioport_map(link->resource[0]->start, | 217 | mem = ioport_map(link->resource[0]->start, |
225 | resource_size(link->resource[0])); | 218 | resource_size(link->resource[0])); |
226 | if (!mem) | 219 | if (!mem) |
227 | goto failed; | 220 | goto failed; |
228 | 221 | ||
222 | /* We initialize the hermes structure before completing PCMCIA | ||
223 | * configuration just in case the interrupt handler gets | ||
224 | * called. */ | ||
229 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 225 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
230 | hw->eeprom_pda = true; | 226 | hw->eeprom_pda = true; |
231 | 227 | ||
228 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
229 | if (ret) | ||
230 | goto failed; | ||
231 | |||
232 | ret = pcmcia_enable_device(link); | 232 | ret = pcmcia_enable_device(link); |
233 | if (ret) | 233 | if (ret) |
234 | goto failed; | 234 | goto failed; |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index 93505f93bf97..e5afabee60d1 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -911,10 +911,10 @@ static int orinoco_ioctl_set_auth(struct net_device *dev, | |||
911 | */ | 911 | */ |
912 | if (param->value) { | 912 | if (param->value) { |
913 | priv->tkip_cm_active = 1; | 913 | priv->tkip_cm_active = 1; |
914 | ret = hermes_enable_port(hw, 0); | 914 | ret = hermes_disable_port(hw, 0); |
915 | } else { | 915 | } else { |
916 | priv->tkip_cm_active = 0; | 916 | priv->tkip_cm_active = 0; |
917 | ret = hermes_disable_port(hw, 0); | 917 | ret = hermes_enable_port(hw, 0); |
918 | } | 918 | } |
919 | break; | 919 | break; |
920 | 920 | ||
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index d5bc21e5a02c..2325e56a9b0b 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -43,6 +43,7 @@ MODULE_FIRMWARE("isl3887usb"); | |||
43 | 43 | ||
44 | static struct usb_device_id p54u_table[] __devinitdata = { | 44 | static struct usb_device_id p54u_table[] __devinitdata = { |
45 | /* Version 1 devices (pci chip + net2280) */ | 45 | /* Version 1 devices (pci chip + net2280) */ |
46 | {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ | ||
46 | {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ | 47 | {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ |
47 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ | 48 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ |
48 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ | 49 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ |
@@ -56,9 +57,13 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
56 | {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ | 57 | {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ |
57 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ | 58 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ |
58 | {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ | 59 | {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ |
60 | {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ | ||
59 | {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ | 61 | {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ |
60 | {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ | 62 | {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ |
63 | {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */ | ||
64 | {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */ | ||
61 | {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ | 65 | {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ |
66 | {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */ | ||
62 | {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ | 67 | {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ |
63 | {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ | 68 | {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ |
64 | {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ | 69 | {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ |
@@ -94,6 +99,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
94 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 99 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
95 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ | 100 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ |
96 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | 101 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ |
102 | {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */ | ||
97 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ | 103 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ |
98 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ | 104 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ |
99 | {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ | 105 | {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index b26739535986..09a67905c230 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -912,6 +912,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
912 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); | 912 | __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); |
913 | __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); | 913 | __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); |
914 | __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags); | 914 | __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags); |
915 | __set_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags); | ||
915 | if (!modparam_nohwcrypt) | 916 | if (!modparam_nohwcrypt) |
916 | __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); | 917 | __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); |
917 | __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); | 918 | __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 94fe589acfaa..ab43e7ca2a23 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -664,6 +664,7 @@ enum rt2x00_flags { | |||
664 | DRIVER_REQUIRE_COPY_IV, | 664 | DRIVER_REQUIRE_COPY_IV, |
665 | DRIVER_REQUIRE_L2PAD, | 665 | DRIVER_REQUIRE_L2PAD, |
666 | DRIVER_REQUIRE_TXSTATUS_FIFO, | 666 | DRIVER_REQUIRE_TXSTATUS_FIFO, |
667 | DRIVER_REQUIRE_TASKLET_CONTEXT, | ||
667 | 668 | ||
668 | /* | 669 | /* |
669 | * Driver features | 670 | * Driver features |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 5ba79b935f09..d019830ca840 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -390,9 +390,12 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
390 | * through a mac80211 library call (RTS/CTS) then we should not | 390 | * through a mac80211 library call (RTS/CTS) then we should not |
391 | * send the status report back. | 391 | * send the status report back. |
392 | */ | 392 | */ |
393 | if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) | 393 | if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) { |
394 | ieee80211_tx_status(rt2x00dev->hw, entry->skb); | 394 | if (test_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags)) |
395 | else | 395 | ieee80211_tx_status(rt2x00dev->hw, entry->skb); |
396 | else | ||
397 | ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); | ||
398 | } else | ||
396 | dev_kfree_skb_any(entry->skb); | 399 | dev_kfree_skb_any(entry->skb); |
397 | 400 | ||
398 | /* | 401 | /* |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 458bb57914a3..cdbeec9f83ea 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -66,8 +66,8 @@ struct netfront_cb { | |||
66 | 66 | ||
67 | #define GRANT_INVALID_REF 0 | 67 | #define GRANT_INVALID_REF 0 |
68 | 68 | ||
69 | #define NET_TX_RING_SIZE __RING_SIZE((struct xen_netif_tx_sring *)0, PAGE_SIZE) | 69 | #define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE) |
70 | #define NET_RX_RING_SIZE __RING_SIZE((struct xen_netif_rx_sring *)0, PAGE_SIZE) | 70 | #define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE) |
71 | #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) | 71 | #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) |
72 | 72 | ||
73 | struct netfront_info { | 73 | struct netfront_info { |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index cd1b3dcd61db..ec47e22fa186 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -744,7 +744,7 @@ static int yellowfin_init_ring(struct net_device *dev) | |||
744 | } | 744 | } |
745 | 745 | ||
746 | for (i = 0; i < RX_RING_SIZE; i++) { | 746 | for (i = 0; i < RX_RING_SIZE; i++) { |
747 | struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz); | 747 | struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz + 2); |
748 | yp->rx_skbuff[i] = skb; | 748 | yp->rx_skbuff[i] = skb; |
749 | if (skb == NULL) | 749 | if (skb == NULL) |
750 | break; | 750 | break; |
@@ -1157,7 +1157,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1157 | for (; yp->cur_rx - yp->dirty_rx > 0; yp->dirty_rx++) { | 1157 | for (; yp->cur_rx - yp->dirty_rx > 0; yp->dirty_rx++) { |
1158 | entry = yp->dirty_rx % RX_RING_SIZE; | 1158 | entry = yp->dirty_rx % RX_RING_SIZE; |
1159 | if (yp->rx_skbuff[entry] == NULL) { | 1159 | if (yp->rx_skbuff[entry] == NULL) { |
1160 | struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz); | 1160 | struct sk_buff *skb = dev_alloc_skb(yp->rx_buf_sz + 2); |
1161 | if (skb == NULL) | 1161 | if (skb == NULL) |
1162 | break; /* Better luck next round. */ | 1162 | break; /* Better luck next round. */ |
1163 | yp->rx_skbuff[entry] = skb; | 1163 | yp->rx_skbuff[entry] = skb; |
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c index c85d3c7421fc..f37fbeb66a44 100644 --- a/drivers/of/of_i2c.c +++ b/drivers/of/of_i2c.c | |||
@@ -61,7 +61,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap) | |||
61 | info.of_node = of_node_get(node); | 61 | info.of_node = of_node_get(node); |
62 | info.archdata = &dev_ad; | 62 | info.archdata = &dev_ad; |
63 | 63 | ||
64 | request_module("%s", info.type); | 64 | request_module("%s%s", I2C_MODULE_PREFIX, info.type); |
65 | 65 | ||
66 | result = i2c_new_device(adap, &info); | 66 | result = i2c_new_device(adap, &info); |
67 | if (result == NULL) { | 67 | if (result == NULL) { |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index d9f51485beee..9383063d2b16 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -349,7 +349,6 @@ static struct irq_chip dino_interrupt_type = { | |||
349 | .name = "GSC-PCI", | 349 | .name = "GSC-PCI", |
350 | .unmask = dino_unmask_irq, | 350 | .unmask = dino_unmask_irq, |
351 | .mask = dino_mask_irq, | 351 | .mask = dino_mask_irq, |
352 | .ack = no_ack_irq, | ||
353 | }; | 352 | }; |
354 | 353 | ||
355 | 354 | ||
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 1211974f55aa..e860038b0b84 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c | |||
@@ -186,7 +186,6 @@ static struct irq_chip eisa_interrupt_type = { | |||
186 | .name = "EISA", | 186 | .name = "EISA", |
187 | .unmask = eisa_unmask_irq, | 187 | .unmask = eisa_unmask_irq, |
188 | .mask = eisa_mask_irq, | 188 | .mask = eisa_mask_irq, |
189 | .ack = no_ack_irq, | ||
190 | }; | 189 | }; |
191 | 190 | ||
192 | static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) | 191 | static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) |
@@ -340,7 +339,7 @@ static int __init eisa_probe(struct parisc_device *dev) | |||
340 | setup_irq(2, &irq2_action); | 339 | setup_irq(2, &irq2_action); |
341 | for (i = 0; i < 16; i++) { | 340 | for (i = 0; i < 16; i++) { |
342 | set_irq_chip_and_handler(i, &eisa_interrupt_type, | 341 | set_irq_chip_and_handler(i, &eisa_interrupt_type, |
343 | handle_level_irq); | 342 | handle_simple_irq); |
344 | } | 343 | } |
345 | 344 | ||
346 | EISA_bus = 1; | 345 | EISA_bus = 1; |
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index e605298e3aee..772b1939ac21 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c | |||
@@ -143,7 +143,6 @@ static struct irq_chip gsc_asic_interrupt_type = { | |||
143 | .name = "GSC-ASIC", | 143 | .name = "GSC-ASIC", |
144 | .unmask = gsc_asic_unmask_irq, | 144 | .unmask = gsc_asic_unmask_irq, |
145 | .mask = gsc_asic_mask_irq, | 145 | .mask = gsc_asic_mask_irq, |
146 | .ack = no_ack_irq, | ||
147 | }; | 146 | }; |
148 | 147 | ||
149 | int gsc_assign_irq(struct irq_chip *type, void *data) | 148 | int gsc_assign_irq(struct irq_chip *type, void *data) |
@@ -153,7 +152,7 @@ int gsc_assign_irq(struct irq_chip *type, void *data) | |||
153 | if (irq > GSC_IRQ_MAX) | 152 | if (irq > GSC_IRQ_MAX) |
154 | return NO_IRQ; | 153 | return NO_IRQ; |
155 | 154 | ||
156 | set_irq_chip_and_handler(irq, type, handle_level_irq); | 155 | set_irq_chip_and_handler(irq, type, handle_simple_irq); |
157 | set_irq_chip_data(irq, data); | 156 | set_irq_chip_data(irq, data); |
158 | 157 | ||
159 | return irq++; | 158 | return irq++; |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index a3120a09c43d..0327894bf235 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -669,6 +669,13 @@ printk("\n"); | |||
669 | DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq, | 669 | DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq, |
670 | vi->eoi_addr, vi->eoi_data); | 670 | vi->eoi_addr, vi->eoi_data); |
671 | iosapic_eoi(vi->eoi_addr, vi->eoi_data); | 671 | iosapic_eoi(vi->eoi_addr, vi->eoi_data); |
672 | } | ||
673 | |||
674 | static void iosapic_eoi_irq(unsigned int irq) | ||
675 | { | ||
676 | struct vector_info *vi = get_irq_chip_data(irq); | ||
677 | |||
678 | iosapic_eoi(vi->eoi_addr, vi->eoi_data); | ||
672 | cpu_eoi_irq(irq); | 679 | cpu_eoi_irq(irq); |
673 | } | 680 | } |
674 | 681 | ||
@@ -705,6 +712,7 @@ static struct irq_chip iosapic_interrupt_type = { | |||
705 | .unmask = iosapic_unmask_irq, | 712 | .unmask = iosapic_unmask_irq, |
706 | .mask = iosapic_mask_irq, | 713 | .mask = iosapic_mask_irq, |
707 | .ack = cpu_ack_irq, | 714 | .ack = cpu_ack_irq, |
715 | .eoi = iosapic_eoi_irq, | ||
708 | #ifdef CONFIG_SMP | 716 | #ifdef CONFIG_SMP |
709 | .set_affinity = iosapic_set_affinity_irq, | 717 | .set_affinity = iosapic_set_affinity_irq, |
710 | #endif | 718 | #endif |
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 2350e8a86eef..f2f501e5b6a0 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -64,6 +64,7 @@ static unsigned int led_diskio __read_mostly = 1; | |||
64 | static unsigned int led_lanrxtx __read_mostly = 1; | 64 | static unsigned int led_lanrxtx __read_mostly = 1; |
65 | static char lcd_text[32] __read_mostly; | 65 | static char lcd_text[32] __read_mostly; |
66 | static char lcd_text_default[32] __read_mostly; | 66 | static char lcd_text_default[32] __read_mostly; |
67 | static int lcd_no_led_support __read_mostly = 0; /* KittyHawk doesn't support LED on its LCD */ | ||
67 | 68 | ||
68 | 69 | ||
69 | static struct workqueue_struct *led_wq; | 70 | static struct workqueue_struct *led_wq; |
@@ -115,7 +116,7 @@ lcd_info __attribute__((aligned(8))) __read_mostly = | |||
115 | .lcd_width = 16, | 116 | .lcd_width = 16, |
116 | .lcd_cmd_reg_addr = KITTYHAWK_LCD_CMD, | 117 | .lcd_cmd_reg_addr = KITTYHAWK_LCD_CMD, |
117 | .lcd_data_reg_addr = KITTYHAWK_LCD_DATA, | 118 | .lcd_data_reg_addr = KITTYHAWK_LCD_DATA, |
118 | .min_cmd_delay = 40, | 119 | .min_cmd_delay = 80, |
119 | .reset_cmd1 = 0x80, | 120 | .reset_cmd1 = 0x80, |
120 | .reset_cmd2 = 0xc0, | 121 | .reset_cmd2 = 0xc0, |
121 | }; | 122 | }; |
@@ -135,6 +136,9 @@ static int start_task(void) | |||
135 | /* Display the default text now */ | 136 | /* Display the default text now */ |
136 | if (led_type == LED_HASLCD) lcd_print( lcd_text_default ); | 137 | if (led_type == LED_HASLCD) lcd_print( lcd_text_default ); |
137 | 138 | ||
139 | /* KittyHawk has no LED support on its LCD */ | ||
140 | if (lcd_no_led_support) return 0; | ||
141 | |||
138 | /* Create the work queue and queue the LED task */ | 142 | /* Create the work queue and queue the LED task */ |
139 | led_wq = create_singlethread_workqueue("led_wq"); | 143 | led_wq = create_singlethread_workqueue("led_wq"); |
140 | queue_delayed_work(led_wq, &led_task, 0); | 144 | queue_delayed_work(led_wq, &led_task, 0); |
@@ -248,9 +252,13 @@ static int __init led_create_procfs(void) | |||
248 | 252 | ||
249 | proc_pdc_root = proc_mkdir("pdc", 0); | 253 | proc_pdc_root = proc_mkdir("pdc", 0); |
250 | if (!proc_pdc_root) return -1; | 254 | if (!proc_pdc_root) return -1; |
251 | ent = proc_create_data("led", S_IRUGO|S_IWUSR, proc_pdc_root, | 255 | |
252 | &led_proc_fops, (void *)LED_NOLCD); /* LED */ | 256 | if (!lcd_no_led_support) |
253 | if (!ent) return -1; | 257 | { |
258 | ent = proc_create_data("led", S_IRUGO|S_IWUSR, proc_pdc_root, | ||
259 | &led_proc_fops, (void *)LED_NOLCD); /* LED */ | ||
260 | if (!ent) return -1; | ||
261 | } | ||
254 | 262 | ||
255 | if (led_type == LED_HASLCD) | 263 | if (led_type == LED_HASLCD) |
256 | { | 264 | { |
@@ -692,6 +700,7 @@ int __init led_init(void) | |||
692 | case 0x58B: /* KittyHawk DC2 100 (K200) */ | 700 | case 0x58B: /* KittyHawk DC2 100 (K200) */ |
693 | printk(KERN_INFO "%s: KittyHawk-Machine (hversion 0x%x) found, " | 701 | printk(KERN_INFO "%s: KittyHawk-Machine (hversion 0x%x) found, " |
694 | "LED detection skipped.\n", __FILE__, CPU_HVERSION); | 702 | "LED detection skipped.\n", __FILE__, CPU_HVERSION); |
703 | lcd_no_led_support = 1; | ||
695 | goto found; /* use the preinitialized values of lcd_info */ | 704 | goto found; /* use the preinitialized values of lcd_info */ |
696 | } | 705 | } |
697 | 706 | ||
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index 0846dafdfff1..28241532c0fd 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -323,7 +323,6 @@ static struct irq_chip superio_interrupt_type = { | |||
323 | .name = SUPERIO, | 323 | .name = SUPERIO, |
324 | .unmask = superio_unmask_irq, | 324 | .unmask = superio_unmask_irq, |
325 | .mask = superio_mask_irq, | 325 | .mask = superio_mask_irq, |
326 | .ack = no_ack_irq, | ||
327 | }; | 326 | }; |
328 | 327 | ||
329 | #ifdef DEBUG_SUPERIO_INIT | 328 | #ifdef DEBUG_SUPERIO_INIT |
@@ -354,7 +353,7 @@ int superio_fixup_irq(struct pci_dev *pcidev) | |||
354 | #endif | 353 | #endif |
355 | 354 | ||
356 | for (i = 0; i < 16; i++) { | 355 | for (i = 0; i < 16; i++) { |
357 | set_irq_chip_and_handler(i, &superio_interrupt_type, handle_level_irq); | 356 | set_irq_chip_and_handler(i, &superio_interrupt_type, handle_simple_irq); |
358 | } | 357 | } |
359 | 358 | ||
360 | /* | 359 | /* |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 003170ea2e39..69546e9213dd 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -64,77 +64,6 @@ void pci_bus_remove_resources(struct pci_bus *bus) | |||
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | static bool pci_bus_resource_better(struct resource *res1, bool pos1, | ||
68 | struct resource *res2, bool pos2) | ||
69 | { | ||
70 | /* If exactly one is positive decode, always prefer that one */ | ||
71 | if (pos1 != pos2) | ||
72 | return pos1 ? true : false; | ||
73 | |||
74 | /* Prefer the one that contains the highest address */ | ||
75 | if (res1->end != res2->end) | ||
76 | return (res1->end > res2->end) ? true : false; | ||
77 | |||
78 | /* Otherwise, prefer the one with highest "center of gravity" */ | ||
79 | if (res1->start != res2->start) | ||
80 | return (res1->start > res2->start) ? true : false; | ||
81 | |||
82 | /* Otherwise, choose one arbitrarily (but consistently) */ | ||
83 | return (res1 > res2) ? true : false; | ||
84 | } | ||
85 | |||
86 | static bool pci_bus_resource_positive(struct pci_bus *bus, struct resource *res) | ||
87 | { | ||
88 | struct pci_bus_resource *bus_res; | ||
89 | |||
90 | /* | ||
91 | * This relies on the fact that pci_bus.resource[] refers to P2P or | ||
92 | * CardBus bridge base/limit registers, which are always positively | ||
93 | * decoded. The pci_bus.resources list contains host bridge or | ||
94 | * subtractively decoded resources. | ||
95 | */ | ||
96 | list_for_each_entry(bus_res, &bus->resources, list) { | ||
97 | if (bus_res->res == res) | ||
98 | return (bus_res->flags & PCI_SUBTRACTIVE_DECODE) ? | ||
99 | false : true; | ||
100 | } | ||
101 | return true; | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * Find the next-best bus resource after the cursor "res". If the cursor is | ||
106 | * NULL, return the best resource. "Best" means that we prefer positive | ||
107 | * decode regions over subtractive decode, then those at higher addresses. | ||
108 | */ | ||
109 | static struct resource *pci_bus_find_resource_prev(struct pci_bus *bus, | ||
110 | unsigned int type, | ||
111 | struct resource *res) | ||
112 | { | ||
113 | bool res_pos, r_pos, prev_pos = false; | ||
114 | struct resource *r, *prev = NULL; | ||
115 | int i; | ||
116 | |||
117 | res_pos = pci_bus_resource_positive(bus, res); | ||
118 | pci_bus_for_each_resource(bus, r, i) { | ||
119 | if (!r) | ||
120 | continue; | ||
121 | |||
122 | if ((r->flags & IORESOURCE_TYPE_BITS) != type) | ||
123 | continue; | ||
124 | |||
125 | r_pos = pci_bus_resource_positive(bus, r); | ||
126 | if (!res || pci_bus_resource_better(res, res_pos, r, r_pos)) { | ||
127 | if (!prev || pci_bus_resource_better(r, r_pos, | ||
128 | prev, prev_pos)) { | ||
129 | prev = r; | ||
130 | prev_pos = r_pos; | ||
131 | } | ||
132 | } | ||
133 | } | ||
134 | |||
135 | return prev; | ||
136 | } | ||
137 | |||
138 | /** | 67 | /** |
139 | * pci_bus_alloc_resource - allocate a resource from a parent bus | 68 | * pci_bus_alloc_resource - allocate a resource from a parent bus |
140 | * @bus: PCI bus | 69 | * @bus: PCI bus |
@@ -160,10 +89,9 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
160 | resource_size_t), | 89 | resource_size_t), |
161 | void *alignf_data) | 90 | void *alignf_data) |
162 | { | 91 | { |
163 | int ret = -ENOMEM; | 92 | int i, ret = -ENOMEM; |
164 | struct resource *r; | 93 | struct resource *r; |
165 | resource_size_t max = -1; | 94 | resource_size_t max = -1; |
166 | unsigned int type = res->flags & IORESOURCE_TYPE_BITS; | ||
167 | 95 | ||
168 | type_mask |= IORESOURCE_IO | IORESOURCE_MEM; | 96 | type_mask |= IORESOURCE_IO | IORESOURCE_MEM; |
169 | 97 | ||
@@ -171,9 +99,10 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
171 | if (!(res->flags & IORESOURCE_MEM_64)) | 99 | if (!(res->flags & IORESOURCE_MEM_64)) |
172 | max = PCIBIOS_MAX_MEM_32; | 100 | max = PCIBIOS_MAX_MEM_32; |
173 | 101 | ||
174 | /* Look for space at highest addresses first */ | 102 | pci_bus_for_each_resource(bus, r, i) { |
175 | r = pci_bus_find_resource_prev(bus, type, NULL); | 103 | if (!r) |
176 | for ( ; r; r = pci_bus_find_resource_prev(bus, type, r)) { | 104 | continue; |
105 | |||
177 | /* type_mask must match */ | 106 | /* type_mask must match */ |
178 | if ((res->flags ^ r->flags) & type_mask) | 107 | if ((res->flags ^ r->flags) & type_mask) |
179 | continue; | 108 | continue; |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 0157708d474d..09933eb9126b 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -1417,6 +1417,11 @@ int __init enable_drhd_fault_handling(void) | |||
1417 | (unsigned long long)drhd->reg_base_addr, ret); | 1417 | (unsigned long long)drhd->reg_base_addr, ret); |
1418 | return -1; | 1418 | return -1; |
1419 | } | 1419 | } |
1420 | |||
1421 | /* | ||
1422 | * Clear any previous faults. | ||
1423 | */ | ||
1424 | dmar_fault(iommu->irq, iommu); | ||
1420 | } | 1425 | } |
1421 | 1426 | ||
1422 | return 0; | 1427 | return 0; |
diff --git a/drivers/pci/hotplug/pciehp_acpi.c b/drivers/pci/hotplug/pciehp_acpi.c index 2574700db461..5f7226223a62 100644 --- a/drivers/pci/hotplug/pciehp_acpi.c +++ b/drivers/pci/hotplug/pciehp_acpi.c | |||
@@ -115,7 +115,8 @@ static struct pcie_port_service_driver __initdata dummy_driver = { | |||
115 | static int __init select_detection_mode(void) | 115 | static int __init select_detection_mode(void) |
116 | { | 116 | { |
117 | struct dummy_slot *slot, *tmp; | 117 | struct dummy_slot *slot, *tmp; |
118 | pcie_port_service_register(&dummy_driver); | 118 | if (pcie_port_service_register(&dummy_driver)) |
119 | return PCIEHP_DETECT_ACPI; | ||
119 | pcie_port_service_unregister(&dummy_driver); | 120 | pcie_port_service_unregister(&dummy_driver); |
120 | list_for_each_entry_safe(slot, tmp, &dummy_slots, list) { | 121 | list_for_each_entry_safe(slot, tmp, &dummy_slots, list) { |
121 | list_del(&slot->list); | 122 | list_del(&slot->list); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 6f9350cabbd5..53a786fd0d40 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -2329,6 +2329,9 @@ static void __devinit nvbridge_check_legacy_irq_routing(struct pci_dev *dev) | |||
2329 | { | 2329 | { |
2330 | u32 cfg; | 2330 | u32 cfg; |
2331 | 2331 | ||
2332 | if (!pci_find_capability(dev, PCI_CAP_ID_HT)) | ||
2333 | return; | ||
2334 | |||
2332 | pci_read_config_dword(dev, 0x74, &cfg); | 2335 | pci_read_config_dword(dev, 0x74, &cfg); |
2333 | 2336 | ||
2334 | if (cfg & ((1 << 2) | (1 << 15))) { | 2337 | if (cfg & ((1 << 2) | (1 << 15))) { |
@@ -2764,6 +2767,29 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_m | |||
2764 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | 2767 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); |
2765 | #endif /*CONFIG_MMC_RICOH_MMC*/ | 2768 | #endif /*CONFIG_MMC_RICOH_MMC*/ |
2766 | 2769 | ||
2770 | #if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) | ||
2771 | #define VTUNCERRMSK_REG 0x1ac | ||
2772 | #define VTD_MSK_SPEC_ERRORS (1 << 31) | ||
2773 | /* | ||
2774 | * This is a quirk for masking vt-d spec defined errors to platform error | ||
2775 | * handling logic. With out this, platforms using Intel 7500, 5500 chipsets | ||
2776 | * (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based | ||
2777 | * on the RAS config settings of the platform) when a vt-d fault happens. | ||
2778 | * The resulting SMI caused the system to hang. | ||
2779 | * | ||
2780 | * VT-d spec related errors are already handled by the VT-d OS code, so no | ||
2781 | * need to report the same error through other channels. | ||
2782 | */ | ||
2783 | static void vtd_mask_spec_errors(struct pci_dev *dev) | ||
2784 | { | ||
2785 | u32 word; | ||
2786 | |||
2787 | pci_read_config_dword(dev, VTUNCERRMSK_REG, &word); | ||
2788 | pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS); | ||
2789 | } | ||
2790 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, vtd_mask_spec_errors); | ||
2791 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors); | ||
2792 | #endif | ||
2767 | 2793 | ||
2768 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, | 2794 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, |
2769 | struct pci_fixup *end) | 2795 | struct pci_fixup *end) |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 3753fd0722e7..2fe8cb8e95cd 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -70,6 +70,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, | |||
70 | va_end(args); | 70 | va_end(args); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | EXPORT_SYMBOL(soc_pcmcia_debug); | ||
73 | 74 | ||
74 | #endif | 75 | #endif |
75 | 76 | ||
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 60a5a5c6b50a..d235f44fd7a3 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -81,6 +81,8 @@ MODULE_PARM_DESC(wapf, "WAPF value"); | |||
81 | 81 | ||
82 | static int wlan_status = 1; | 82 | static int wlan_status = 1; |
83 | static int bluetooth_status = 1; | 83 | static int bluetooth_status = 1; |
84 | static int wimax_status = -1; | ||
85 | static int wwan_status = -1; | ||
84 | 86 | ||
85 | module_param(wlan_status, int, 0444); | 87 | module_param(wlan_status, int, 0444); |
86 | MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " | 88 | MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " |
@@ -92,6 +94,16 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " | |||
92 | "(0 = disabled, 1 = enabled, -1 = don't do anything). " | 94 | "(0 = disabled, 1 = enabled, -1 = don't do anything). " |
93 | "default is 1"); | 95 | "default is 1"); |
94 | 96 | ||
97 | module_param(wimax_status, int, 0444); | ||
98 | MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot " | ||
99 | "(0 = disabled, 1 = enabled, -1 = don't do anything). " | ||
100 | "default is 1"); | ||
101 | |||
102 | module_param(wwan_status, int, 0444); | ||
103 | MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot " | ||
104 | "(0 = disabled, 1 = enabled, -1 = don't do anything). " | ||
105 | "default is 1"); | ||
106 | |||
95 | /* | 107 | /* |
96 | * Some events we use, same for all Asus | 108 | * Some events we use, same for all Asus |
97 | */ | 109 | */ |
@@ -114,6 +126,8 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " | |||
114 | */ | 126 | */ |
115 | #define WL_RSTS 0x01 /* internal Wifi */ | 127 | #define WL_RSTS 0x01 /* internal Wifi */ |
116 | #define BT_RSTS 0x02 /* internal Bluetooth */ | 128 | #define BT_RSTS 0x02 /* internal Bluetooth */ |
129 | #define WM_RSTS 0x08 /* internal wimax */ | ||
130 | #define WW_RSTS 0x20 /* internal wwan */ | ||
117 | 131 | ||
118 | /* LED */ | 132 | /* LED */ |
119 | #define METHOD_MLED "MLED" | 133 | #define METHOD_MLED "MLED" |
@@ -132,6 +146,11 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " | |||
132 | */ | 146 | */ |
133 | #define METHOD_WLAN "WLED" | 147 | #define METHOD_WLAN "WLED" |
134 | #define METHOD_BLUETOOTH "BLED" | 148 | #define METHOD_BLUETOOTH "BLED" |
149 | |||
150 | /* WWAN and WIMAX */ | ||
151 | #define METHOD_WWAN "GSMC" | ||
152 | #define METHOD_WIMAX "WMXC" | ||
153 | |||
135 | #define METHOD_WL_STATUS "RSTS" | 154 | #define METHOD_WL_STATUS "RSTS" |
136 | 155 | ||
137 | /* Brightness */ | 156 | /* Brightness */ |
@@ -883,6 +902,64 @@ static ssize_t store_bluetooth(struct device *dev, | |||
883 | } | 902 | } |
884 | 903 | ||
885 | /* | 904 | /* |
905 | * Wimax | ||
906 | */ | ||
907 | static int asus_wimax_set(struct asus_laptop *asus, int status) | ||
908 | { | ||
909 | if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) { | ||
910 | pr_warning("Error setting wimax status to %d", status); | ||
911 | return -EIO; | ||
912 | } | ||
913 | return 0; | ||
914 | } | ||
915 | |||
916 | static ssize_t show_wimax(struct device *dev, | ||
917 | struct device_attribute *attr, char *buf) | ||
918 | { | ||
919 | struct asus_laptop *asus = dev_get_drvdata(dev); | ||
920 | |||
921 | return sprintf(buf, "%d\n", asus_wireless_status(asus, WM_RSTS)); | ||
922 | } | ||
923 | |||
924 | static ssize_t store_wimax(struct device *dev, | ||
925 | struct device_attribute *attr, const char *buf, | ||
926 | size_t count) | ||
927 | { | ||
928 | struct asus_laptop *asus = dev_get_drvdata(dev); | ||
929 | |||
930 | return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX); | ||
931 | } | ||
932 | |||
933 | /* | ||
934 | * Wwan | ||
935 | */ | ||
936 | static int asus_wwan_set(struct asus_laptop *asus, int status) | ||
937 | { | ||
938 | if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) { | ||
939 | pr_warning("Error setting wwan status to %d", status); | ||
940 | return -EIO; | ||
941 | } | ||
942 | return 0; | ||
943 | } | ||
944 | |||
945 | static ssize_t show_wwan(struct device *dev, | ||
946 | struct device_attribute *attr, char *buf) | ||
947 | { | ||
948 | struct asus_laptop *asus = dev_get_drvdata(dev); | ||
949 | |||
950 | return sprintf(buf, "%d\n", asus_wireless_status(asus, WW_RSTS)); | ||
951 | } | ||
952 | |||
953 | static ssize_t store_wwan(struct device *dev, | ||
954 | struct device_attribute *attr, const char *buf, | ||
955 | size_t count) | ||
956 | { | ||
957 | struct asus_laptop *asus = dev_get_drvdata(dev); | ||
958 | |||
959 | return sysfs_acpi_set(asus, buf, count, METHOD_WWAN); | ||
960 | } | ||
961 | |||
962 | /* | ||
886 | * Display | 963 | * Display |
887 | */ | 964 | */ |
888 | static void asus_set_display(struct asus_laptop *asus, int value) | 965 | static void asus_set_display(struct asus_laptop *asus, int value) |
@@ -1202,6 +1279,8 @@ static DEVICE_ATTR(infos, S_IRUGO, show_infos, NULL); | |||
1202 | static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); | 1279 | static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); |
1203 | static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, | 1280 | static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, |
1204 | show_bluetooth, store_bluetooth); | 1281 | show_bluetooth, store_bluetooth); |
1282 | static DEVICE_ATTR(wimax, S_IRUGO | S_IWUSR, show_wimax, store_wimax); | ||
1283 | static DEVICE_ATTR(wwan, S_IRUGO | S_IWUSR, show_wwan, store_wwan); | ||
1205 | static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); | 1284 | static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); |
1206 | static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); | 1285 | static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); |
1207 | static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); | 1286 | static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); |
@@ -1212,6 +1291,8 @@ static struct attribute *asus_attributes[] = { | |||
1212 | &dev_attr_infos.attr, | 1291 | &dev_attr_infos.attr, |
1213 | &dev_attr_wlan.attr, | 1292 | &dev_attr_wlan.attr, |
1214 | &dev_attr_bluetooth.attr, | 1293 | &dev_attr_bluetooth.attr, |
1294 | &dev_attr_wimax.attr, | ||
1295 | &dev_attr_wwan.attr, | ||
1215 | &dev_attr_display.attr, | 1296 | &dev_attr_display.attr, |
1216 | &dev_attr_ledd.attr, | 1297 | &dev_attr_ledd.attr, |
1217 | &dev_attr_ls_level.attr, | 1298 | &dev_attr_ls_level.attr, |
@@ -1239,6 +1320,13 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj, | |||
1239 | } else if (attr == &dev_attr_display.attr) { | 1320 | } else if (attr == &dev_attr_display.attr) { |
1240 | supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); | 1321 | supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); |
1241 | 1322 | ||
1323 | } else if (attr == &dev_attr_wimax.attr) { | ||
1324 | supported = | ||
1325 | !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL); | ||
1326 | |||
1327 | } else if (attr == &dev_attr_wwan.attr) { | ||
1328 | supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL); | ||
1329 | |||
1242 | } else if (attr == &dev_attr_ledd.attr) { | 1330 | } else if (attr == &dev_attr_ledd.attr) { |
1243 | supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); | 1331 | supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); |
1244 | 1332 | ||
@@ -1397,7 +1485,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus) | |||
1397 | 1485 | ||
1398 | /* | 1486 | /* |
1399 | * The HWRS method return informations about the hardware. | 1487 | * The HWRS method return informations about the hardware. |
1400 | * 0x80 bit is for WLAN, 0x100 for Bluetooth. | 1488 | * 0x80 bit is for WLAN, 0x100 for Bluetooth, |
1489 | * 0x40 for WWAN, 0x10 for WIMAX. | ||
1401 | * The significance of others is yet to be found. | 1490 | * The significance of others is yet to be found. |
1402 | */ | 1491 | */ |
1403 | status = | 1492 | status = |
@@ -1440,6 +1529,12 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus) | |||
1440 | if (wlan_status >= 0) | 1529 | if (wlan_status >= 0) |
1441 | asus_wlan_set(asus, !!wlan_status); | 1530 | asus_wlan_set(asus, !!wlan_status); |
1442 | 1531 | ||
1532 | if (wimax_status >= 0) | ||
1533 | asus_wimax_set(asus, !!wimax_status); | ||
1534 | |||
1535 | if (wwan_status >= 0) | ||
1536 | asus_wwan_set(asus, !!wwan_status); | ||
1537 | |||
1443 | /* Keyboard Backlight is on by default */ | 1538 | /* Keyboard Backlight is on by default */ |
1444 | if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) | 1539 | if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) |
1445 | asus_kled_set(asus, 1); | 1540 | asus_kled_set(asus, 1); |
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c index 462ceab93f87..0d50fbbe2478 100644 --- a/drivers/platform/x86/eeepc-wmi.c +++ b/drivers/platform/x86/eeepc-wmi.c | |||
@@ -298,8 +298,8 @@ static void eeepc_wmi_notify(u32 value, void *context) | |||
298 | kfree(obj); | 298 | kfree(obj); |
299 | } | 299 | } |
300 | 300 | ||
301 | static int store_cpufv(struct device *dev, struct device_attribute *attr, | 301 | static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr, |
302 | const char *buf, size_t count) | 302 | const char *buf, size_t count) |
303 | { | 303 | { |
304 | int value; | 304 | int value; |
305 | struct acpi_buffer input = { (acpi_size)sizeof(value), &value }; | 305 | struct acpi_buffer input = { (acpi_size)sizeof(value), &value }; |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 1dac659b5e0c..9e05af9c41cb 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -172,6 +172,8 @@ static int hp_wmi_perform_query(int query, int write, u32 *buffer, | |||
172 | bios_return = *((struct bios_return *)obj->buffer.pointer); | 172 | bios_return = *((struct bios_return *)obj->buffer.pointer); |
173 | 173 | ||
174 | memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); | 174 | memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); |
175 | |||
176 | kfree(obj); | ||
175 | return 0; | 177 | return 0; |
176 | } | 178 | } |
177 | 179 | ||
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c index 3c2c6b91ecb3..94a114aa8e28 100644 --- a/drivers/platform/x86/ibm_rtl.c +++ b/drivers/platform/x86/ibm_rtl.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/sysdev.h> | 29 | #include <linux/sysdev.h> |
30 | #include <linux/dmi.h> | 30 | #include <linux/dmi.h> |
31 | #include <linux/efi.h> | ||
31 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
32 | #include <asm/bios_ebda.h> | 33 | #include <asm/bios_ebda.h> |
33 | 34 | ||
@@ -220,32 +221,13 @@ static void rtl_teardown_sysfs(void) { | |||
220 | sysdev_class_unregister(&class_rtl); | 221 | sysdev_class_unregister(&class_rtl); |
221 | } | 222 | } |
222 | 223 | ||
223 | static int dmi_check_cb(const struct dmi_system_id *id) | ||
224 | { | ||
225 | RTL_DEBUG("found IBM server '%s'\n", id->ident); | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | #define ibm_dmi_entry(NAME, TYPE) \ | ||
230 | { \ | ||
231 | .ident = NAME, \ | ||
232 | .matches = { \ | ||
233 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ | ||
234 | DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \ | ||
235 | }, \ | ||
236 | .callback = dmi_check_cb \ | ||
237 | } | ||
238 | 224 | ||
239 | static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { | 225 | static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { |
240 | ibm_dmi_entry("BladeCenter LS21", "7971"), | 226 | { \ |
241 | ibm_dmi_entry("BladeCenter LS22", "7901"), | 227 | .matches = { \ |
242 | ibm_dmi_entry("BladeCenter HS21 XM", "7995"), | 228 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ |
243 | ibm_dmi_entry("BladeCenter HS22", "7870"), | 229 | }, \ |
244 | ibm_dmi_entry("BladeCenter HS22V", "7871"), | 230 | }, |
245 | ibm_dmi_entry("System x3550 M2", "7946"), | ||
246 | ibm_dmi_entry("System x3650 M2", "7947"), | ||
247 | ibm_dmi_entry("System x3550 M3", "7944"), | ||
248 | ibm_dmi_entry("System x3650 M3", "7945"), | ||
249 | { } | 231 | { } |
250 | }; | 232 | }; |
251 | 233 | ||
@@ -257,7 +239,7 @@ static int __init ibm_rtl_init(void) { | |||
257 | if (force) | 239 | if (force) |
258 | pr_warning("ibm-rtl: module loaded by force\n"); | 240 | pr_warning("ibm-rtl: module loaded by force\n"); |
259 | /* first ensure that we are running on IBM HW */ | 241 | /* first ensure that we are running on IBM HW */ |
260 | else if (!dmi_check_system(ibm_rtl_dmi_table)) | 242 | else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table)) |
261 | return -ENODEV; | 243 | return -ENODEV; |
262 | 244 | ||
263 | /* Get the address for the Extended BIOS Data Area */ | 245 | /* Get the address for the Extended BIOS Data Area */ |
@@ -302,7 +284,7 @@ static int __init ibm_rtl_init(void) { | |||
302 | RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", | 284 | RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", |
303 | rtl_cmd_width, rtl_cmd_type); | 285 | rtl_cmd_width, rtl_cmd_type); |
304 | addr = ioread32(&rtl_table->cmd_port_address); | 286 | addr = ioread32(&rtl_table->cmd_port_address); |
305 | RTL_DEBUG("addr = %#llx\n", addr); | 287 | RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr); |
306 | plen = rtl_cmd_width/sizeof(char); | 288 | plen = rtl_cmd_width/sizeof(char); |
307 | rtl_cmd_addr = rtl_port_map(addr, plen); | 289 | rtl_cmd_addr = rtl_port_map(addr, plen); |
308 | RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr); | 290 | RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr); |
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index 42a5469a2459..35278ad7e628 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -43,16 +43,18 @@ MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"); | |||
43 | 43 | ||
44 | #define dprintk(msg...) pr_debug(DRV_PFX msg) | 44 | #define dprintk(msg...) pr_debug(DRV_PFX msg) |
45 | 45 | ||
46 | #define KEYCODE_BASE 0xD0 | 46 | #define SCANCODE_BASE 0xD0 |
47 | #define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE | 47 | #define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE |
48 | #define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1) | 48 | #define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1) |
49 | #define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2) | 49 | #define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2) |
50 | #define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3) | 50 | #define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3) |
51 | #define MSI_WMI_MUTE (SCANCODE_BASE + 4) | ||
51 | static struct key_entry msi_wmi_keymap[] = { | 52 | static struct key_entry msi_wmi_keymap[] = { |
52 | { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, | 53 | { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, |
53 | { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, | 54 | { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, |
54 | { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, | 55 | { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, |
55 | { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, | 56 | { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, |
57 | { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} }, | ||
56 | { KE_END, 0} | 58 | { KE_END, 0} |
57 | }; | 59 | }; |
58 | static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; | 60 | static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; |
@@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context) | |||
169 | ktime_t diff; | 171 | ktime_t diff; |
170 | cur = ktime_get_real(); | 172 | cur = ktime_get_real(); |
171 | diff = ktime_sub(cur, last_pressed[key->code - | 173 | diff = ktime_sub(cur, last_pressed[key->code - |
172 | KEYCODE_BASE]); | 174 | SCANCODE_BASE]); |
173 | /* Ignore event if the same event happened in a 50 ms | 175 | /* Ignore event if the same event happened in a 50 ms |
174 | timeframe -> Key press may result in 10-20 GPEs */ | 176 | timeframe -> Key press may result in 10-20 GPEs */ |
175 | if (ktime_to_us(diff) < 1000 * 50) { | 177 | if (ktime_to_us(diff) < 1000 * 50) { |
@@ -178,7 +180,7 @@ static void msi_wmi_notify(u32 value, void *context) | |||
178 | key->code, ktime_to_us(diff)); | 180 | key->code, ktime_to_us(diff)); |
179 | return; | 181 | return; |
180 | } | 182 | } |
181 | last_pressed[key->code - KEYCODE_BASE] = cur; | 183 | last_pressed[key->code - SCANCODE_BASE] = cur; |
182 | 184 | ||
183 | if (key->type == KE_KEY && | 185 | if (key->type == KE_KEY && |
184 | /* Brightness is served via acpi video driver */ | 186 | /* Brightness is served via acpi video driver */ |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 2d61186ad5a2..e8c21994b36d 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -8497,7 +8497,6 @@ static void ibm_exit(struct ibm_struct *ibm) | |||
8497 | ibm->acpi->type, | 8497 | ibm->acpi->type, |
8498 | dispatch_acpi_notify); | 8498 | dispatch_acpi_notify); |
8499 | ibm->flags.acpi_notify_installed = 0; | 8499 | ibm->flags.acpi_notify_installed = 0; |
8500 | ibm->flags.acpi_notify_installed = 0; | ||
8501 | } | 8500 | } |
8502 | 8501 | ||
8503 | if (ibm->flags.proc_created) { | 8502 | if (ibm->flags.proc_created) { |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 06f304f46e02..4276da7291b8 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -135,6 +135,7 @@ static const struct key_entry toshiba_acpi_keymap[] __initconst = { | |||
135 | { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, | 135 | { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, |
136 | { KE_KEY, 0x142, { KEY_WLAN } }, | 136 | { KE_KEY, 0x142, { KEY_WLAN } }, |
137 | { KE_KEY, 0x143, { KEY_PROG1 } }, | 137 | { KE_KEY, 0x143, { KEY_PROG1 } }, |
138 | { KE_KEY, 0x17f, { KEY_FN } }, | ||
138 | { KE_KEY, 0xb05, { KEY_PROG2 } }, | 139 | { KE_KEY, 0xb05, { KEY_PROG2 } }, |
139 | { KE_KEY, 0xb06, { KEY_WWW } }, | 140 | { KE_KEY, 0xb06, { KEY_WWW } }, |
140 | { KE_KEY, 0xb07, { KEY_MAIL } }, | 141 | { KE_KEY, 0xb07, { KEY_MAIL } }, |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 104b77c87ef5..aecd9a9b549f 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -755,7 +755,7 @@ static bool guid_already_parsed(const char *guid_string) | |||
755 | struct wmi_block *wblock; | 755 | struct wmi_block *wblock; |
756 | 756 | ||
757 | list_for_each_entry(wblock, &wmi_block_list, list) | 757 | list_for_each_entry(wblock, &wmi_block_list, list) |
758 | if (strncmp(wblock->gblock.guid, guid_string, 16) == 0) | 758 | if (memcmp(wblock->gblock.guid, guid_string, 16) == 0) |
759 | return true; | 759 | return true; |
760 | 760 | ||
761 | return false; | 761 | return false; |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 2d73dfcecdbb..57313f4658bc 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -180,7 +180,7 @@ struct pnp_protocol pnpacpi_protocol = { | |||
180 | }; | 180 | }; |
181 | EXPORT_SYMBOL(pnpacpi_protocol); | 181 | EXPORT_SYMBOL(pnpacpi_protocol); |
182 | 182 | ||
183 | static char *pnpacpi_get_id(struct acpi_device *device) | 183 | static char *__init pnpacpi_get_id(struct acpi_device *device) |
184 | { | 184 | { |
185 | struct acpi_hardware_id *id; | 185 | struct acpi_hardware_id *id; |
186 | 186 | ||
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f1d10c974cd4..ba521f0f0fac 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -911,7 +911,7 @@ out: | |||
911 | } | 911 | } |
912 | 912 | ||
913 | /** | 913 | /** |
914 | * set_consumer_device_supply: Bind a regulator to a symbolic supply | 914 | * set_consumer_device_supply - Bind a regulator to a symbolic supply |
915 | * @rdev: regulator source | 915 | * @rdev: regulator source |
916 | * @consumer_dev: device the supply applies to | 916 | * @consumer_dev: device the supply applies to |
917 | * @consumer_dev_name: dev_name() string for device supply applies to | 917 | * @consumer_dev_name: dev_name() string for device supply applies to |
@@ -1052,7 +1052,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, | |||
1052 | printk(KERN_WARNING | 1052 | printk(KERN_WARNING |
1053 | "%s: could not add device link %s err %d\n", | 1053 | "%s: could not add device link %s err %d\n", |
1054 | __func__, dev->kobj.name, err); | 1054 | __func__, dev->kobj.name, err); |
1055 | device_remove_file(dev, ®ulator->dev_attr); | ||
1056 | goto link_name_err; | 1055 | goto link_name_err; |
1057 | } | 1056 | } |
1058 | } | 1057 | } |
@@ -1268,13 +1267,17 @@ static int _regulator_enable(struct regulator_dev *rdev) | |||
1268 | { | 1267 | { |
1269 | int ret, delay; | 1268 | int ret, delay; |
1270 | 1269 | ||
1271 | /* do we need to enable the supply regulator first */ | 1270 | if (rdev->use_count == 0) { |
1272 | if (rdev->supply) { | 1271 | /* do we need to enable the supply regulator first */ |
1273 | ret = _regulator_enable(rdev->supply); | 1272 | if (rdev->supply) { |
1274 | if (ret < 0) { | 1273 | mutex_lock(&rdev->supply->mutex); |
1275 | printk(KERN_ERR "%s: failed to enable %s: %d\n", | 1274 | ret = _regulator_enable(rdev->supply); |
1276 | __func__, rdev_get_name(rdev), ret); | 1275 | mutex_unlock(&rdev->supply->mutex); |
1277 | return ret; | 1276 | if (ret < 0) { |
1277 | printk(KERN_ERR "%s: failed to enable %s: %d\n", | ||
1278 | __func__, rdev_get_name(rdev), ret); | ||
1279 | return ret; | ||
1280 | } | ||
1278 | } | 1281 | } |
1279 | } | 1282 | } |
1280 | 1283 | ||
@@ -1313,10 +1316,12 @@ static int _regulator_enable(struct regulator_dev *rdev) | |||
1313 | if (ret < 0) | 1316 | if (ret < 0) |
1314 | return ret; | 1317 | return ret; |
1315 | 1318 | ||
1316 | if (delay >= 1000) | 1319 | if (delay >= 1000) { |
1317 | mdelay(delay / 1000); | 1320 | mdelay(delay / 1000); |
1318 | else if (delay) | 1321 | udelay(delay % 1000); |
1322 | } else if (delay) { | ||
1319 | udelay(delay); | 1323 | udelay(delay); |
1324 | } | ||
1320 | 1325 | ||
1321 | } else if (ret < 0) { | 1326 | } else if (ret < 0) { |
1322 | printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n", | 1327 | printk(KERN_ERR "%s: is_enabled() failed for %s: %d\n", |
@@ -1359,6 +1364,7 @@ static int _regulator_disable(struct regulator_dev *rdev, | |||
1359 | struct regulator_dev **supply_rdev_ptr) | 1364 | struct regulator_dev **supply_rdev_ptr) |
1360 | { | 1365 | { |
1361 | int ret = 0; | 1366 | int ret = 0; |
1367 | *supply_rdev_ptr = NULL; | ||
1362 | 1368 | ||
1363 | if (WARN(rdev->use_count <= 0, | 1369 | if (WARN(rdev->use_count <= 0, |
1364 | "unbalanced disables for %s\n", | 1370 | "unbalanced disables for %s\n", |
@@ -2346,6 +2352,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2346 | if (init_data->supply_regulator && init_data->supply_regulator_dev) { | 2352 | if (init_data->supply_regulator && init_data->supply_regulator_dev) { |
2347 | dev_err(dev, | 2353 | dev_err(dev, |
2348 | "Supply regulator specified by both name and dev\n"); | 2354 | "Supply regulator specified by both name and dev\n"); |
2355 | ret = -EINVAL; | ||
2349 | goto scrub; | 2356 | goto scrub; |
2350 | } | 2357 | } |
2351 | 2358 | ||
@@ -2364,6 +2371,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2364 | if (!found) { | 2371 | if (!found) { |
2365 | dev_err(dev, "Failed to find supply %s\n", | 2372 | dev_err(dev, "Failed to find supply %s\n", |
2366 | init_data->supply_regulator); | 2373 | init_data->supply_regulator); |
2374 | ret = -ENODEV; | ||
2367 | goto scrub; | 2375 | goto scrub; |
2368 | } | 2376 | } |
2369 | 2377 | ||
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index 4597d508a229..ecd99f59dba8 100644 --- a/drivers/regulator/mc13783-regulator.c +++ b/drivers/regulator/mc13783-regulator.c | |||
@@ -465,8 +465,8 @@ static struct regulator_ops mc13783_fixed_regulator_ops = { | |||
465 | .get_voltage = mc13783_fixed_regulator_get_voltage, | 465 | .get_voltage = mc13783_fixed_regulator_get_voltage, |
466 | }; | 466 | }; |
467 | 467 | ||
468 | int mc13783_powermisc_rmw(struct mc13783_regulator_priv *priv, u32 mask, | 468 | static int mc13783_powermisc_rmw(struct mc13783_regulator_priv *priv, u32 mask, |
469 | u32 val) | 469 | u32 val) |
470 | { | 470 | { |
471 | struct mc13783 *mc13783 = priv->mc13783; | 471 | struct mc13783 *mc13783 = priv->mc13783; |
472 | int ret; | 472 | int ret; |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 51237fbb1bbb..6d20b0454a1d 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -231,8 +231,7 @@ static int tps6586x_dvm_voltages[] = { | |||
231 | }; | 231 | }; |
232 | 232 | ||
233 | #define TPS6586X_REGULATOR(_id, vdata, _ops, vreg, shift, nbits, \ | 233 | #define TPS6586X_REGULATOR(_id, vdata, _ops, vreg, shift, nbits, \ |
234 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ | 234 | ereg0, ebit0, ereg1, ebit1) \ |
235 | { \ | ||
236 | .desc = { \ | 235 | .desc = { \ |
237 | .name = "REG-" #_id, \ | 236 | .name = "REG-" #_id, \ |
238 | .ops = &tps6586x_regulator_##_ops, \ | 237 | .ops = &tps6586x_regulator_##_ops, \ |
@@ -248,18 +247,26 @@ static int tps6586x_dvm_voltages[] = { | |||
248 | .enable_bit[0] = (ebit0), \ | 247 | .enable_bit[0] = (ebit0), \ |
249 | .enable_reg[1] = TPS6586X_SUPPLY##ereg1, \ | 248 | .enable_reg[1] = TPS6586X_SUPPLY##ereg1, \ |
250 | .enable_bit[1] = (ebit1), \ | 249 | .enable_bit[1] = (ebit1), \ |
251 | .voltages = tps6586x_##vdata##_voltages, \ | 250 | .voltages = tps6586x_##vdata##_voltages, |
252 | } | 251 | |
252 | #define TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ | ||
253 | .go_reg = TPS6586X_##goreg, \ | ||
254 | .go_bit = (gobit), | ||
253 | 255 | ||
254 | #define TPS6586X_LDO(_id, vdata, vreg, shift, nbits, \ | 256 | #define TPS6586X_LDO(_id, vdata, vreg, shift, nbits, \ |
255 | ereg0, ebit0, ereg1, ebit1) \ | 257 | ereg0, ebit0, ereg1, ebit1) \ |
258 | { \ | ||
256 | TPS6586X_REGULATOR(_id, vdata, ldo_ops, vreg, shift, nbits, \ | 259 | TPS6586X_REGULATOR(_id, vdata, ldo_ops, vreg, shift, nbits, \ |
257 | ereg0, ebit0, ereg1, ebit1, 0, 0) | 260 | ereg0, ebit0, ereg1, ebit1) \ |
261 | } | ||
258 | 262 | ||
259 | #define TPS6586X_DVM(_id, vdata, vreg, shift, nbits, \ | 263 | #define TPS6586X_DVM(_id, vdata, vreg, shift, nbits, \ |
260 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ | 264 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ |
265 | { \ | ||
261 | TPS6586X_REGULATOR(_id, vdata, dvm_ops, vreg, shift, nbits, \ | 266 | TPS6586X_REGULATOR(_id, vdata, dvm_ops, vreg, shift, nbits, \ |
262 | ereg0, ebit0, ereg1, ebit1, goreg, gobit) | 267 | ereg0, ebit0, ereg1, ebit1) \ |
268 | TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ | ||
269 | } | ||
263 | 270 | ||
264 | static struct tps6586x_regulator tps6586x_regulator[] = { | 271 | static struct tps6586x_regulator tps6586x_regulator[] = { |
265 | TPS6586X_LDO(LDO_0, ldo, SUPPLYV1, 5, 3, ENC, 0, END, 0), | 272 | TPS6586X_LDO(LDO_0, ldo, SUPPLYV1, 5, 3, ENC, 0, END, 0), |
@@ -267,11 +274,11 @@ static struct tps6586x_regulator tps6586x_regulator[] = { | |||
267 | TPS6586X_LDO(LDO_5, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), | 274 | TPS6586X_LDO(LDO_5, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), |
268 | TPS6586X_LDO(LDO_6, ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), | 275 | TPS6586X_LDO(LDO_6, ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), |
269 | TPS6586X_LDO(LDO_7, ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), | 276 | TPS6586X_LDO(LDO_7, ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), |
270 | TPS6586X_LDO(LDO_8, ldo, SUPPLYV1, 5, 3, ENC, 6, END, 6), | 277 | TPS6586X_LDO(LDO_8, ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), |
271 | TPS6586X_LDO(LDO_9, ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), | 278 | TPS6586X_LDO(LDO_9, ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), |
272 | TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, ENE, 7, ENE, 7), | 279 | TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), |
273 | TPS6586X_LDO(LDO_1, dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), | 280 | TPS6586X_LDO(LDO_1, dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), |
274 | TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 1, END, 1), | 281 | TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), |
275 | 282 | ||
276 | TPS6586X_DVM(LDO_2, dvm, LDO2BV1, 0, 5, ENA, 3, ENB, 3, VCC2, 6), | 283 | TPS6586X_DVM(LDO_2, dvm, LDO2BV1, 0, 5, ENA, 3, ENB, 3, VCC2, 6), |
277 | TPS6586X_DVM(LDO_4, ldo4, LDO4V1, 0, 5, ENC, 3, END, 3, VCC1, 6), | 284 | TPS6586X_DVM(LDO_4, ldo4, LDO4V1, 0, 5, ENC, 3, END, 3, VCC1, 6), |
@@ -290,6 +297,10 @@ static inline int tps6586x_regulator_preinit(struct device *parent, | |||
290 | uint8_t val1, val2; | 297 | uint8_t val1, val2; |
291 | int ret; | 298 | int ret; |
292 | 299 | ||
300 | if (ri->enable_reg[0] == ri->enable_reg[1] && | ||
301 | ri->enable_bit[0] == ri->enable_bit[1]) | ||
302 | return 0; | ||
303 | |||
293 | ret = tps6586x_read(parent, ri->enable_reg[0], &val1); | 304 | ret = tps6586x_read(parent, ri->enable_reg[0], &val1); |
294 | if (ret) | 305 | if (ret) |
295 | return ret; | 306 | return ret; |
@@ -298,14 +309,14 @@ static inline int tps6586x_regulator_preinit(struct device *parent, | |||
298 | if (ret) | 309 | if (ret) |
299 | return ret; | 310 | return ret; |
300 | 311 | ||
301 | if (!(val2 & ri->enable_bit[1])) | 312 | if (!(val2 & (1 << ri->enable_bit[1]))) |
302 | return 0; | 313 | return 0; |
303 | 314 | ||
304 | /* | 315 | /* |
305 | * The regulator is on, but it's enabled with the bit we don't | 316 | * The regulator is on, but it's enabled with the bit we don't |
306 | * want to use, so we switch the enable bits | 317 | * want to use, so we switch the enable bits |
307 | */ | 318 | */ |
308 | if (!(val1 & ri->enable_bit[0])) { | 319 | if (!(val1 & (1 << ri->enable_bit[0]))) { |
309 | ret = tps6586x_set_bits(parent, ri->enable_reg[0], | 320 | ret = tps6586x_set_bits(parent, ri->enable_reg[0], |
310 | 1 << ri->enable_bit[0]); | 321 | 1 << ri->enable_bit[0]); |
311 | if (ret) | 322 | if (ret) |
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 7e5892efc437..a57262a4fa6c 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
@@ -219,12 +219,12 @@ static int twlreg_set_mode(struct regulator_dev *rdev, unsigned mode) | |||
219 | return -EACCES; | 219 | return -EACCES; |
220 | 220 | ||
221 | status = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, | 221 | status = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, |
222 | message >> 8, 0x15 /* PB_WORD_MSB */ ); | 222 | message >> 8, TWL4030_PM_MASTER_PB_WORD_MSB); |
223 | if (status >= 0) | 223 | if (status < 0) |
224 | return status; | 224 | return status; |
225 | 225 | ||
226 | return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, | 226 | return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, |
227 | message, 0x16 /* PB_WORD_LSB */ ); | 227 | message & 0xff, TWL4030_PM_MASTER_PB_WORD_LSB); |
228 | } | 228 | } |
229 | 229 | ||
230 | /*----------------------------------------------------------------------*/ | 230 | /*----------------------------------------------------------------------*/ |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 90cf0a6ff23e..dd14e202c2c8 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -207,7 +207,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
207 | static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) | 207 | static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) |
208 | { | 208 | { |
209 | struct rs5c372 *rs5c = i2c_get_clientdata(client); | 209 | struct rs5c372 *rs5c = i2c_get_clientdata(client); |
210 | unsigned char buf[8]; | 210 | unsigned char buf[7]; |
211 | int addr; | 211 | int addr; |
212 | 212 | ||
213 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " | 213 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index a5050e217150..825951b6b83f 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -635,7 +635,7 @@ static void css_process_crw(struct crw *crw0, struct crw *crw1, int overflow) | |||
635 | init_subchannel_id(&mchk_schid); | 635 | init_subchannel_id(&mchk_schid); |
636 | mchk_schid.sch_no = crw0->rsid; | 636 | mchk_schid.sch_no = crw0->rsid; |
637 | if (crw1) | 637 | if (crw1) |
638 | mchk_schid.ssid = (crw1->rsid >> 8) & 3; | 638 | mchk_schid.ssid = (crw1->rsid >> 4) & 3; |
639 | 639 | ||
640 | /* | 640 | /* |
641 | * Since we are always presented with IPI in the CRW, we have to | 641 | * Since we are always presented with IPI in the CRW, we have to |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index d37c7331f244..0bcd5806bd9a 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -156,6 +156,8 @@ static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter, | |||
156 | if (!(a_status & ZFCP_STATUS_COMMON_RUNNING) || | 156 | if (!(a_status & ZFCP_STATUS_COMMON_RUNNING) || |
157 | a_status & ZFCP_STATUS_COMMON_ERP_FAILED) | 157 | a_status & ZFCP_STATUS_COMMON_ERP_FAILED) |
158 | return 0; | 158 | return 0; |
159 | if (p_status & ZFCP_STATUS_COMMON_NOESC) | ||
160 | return need; | ||
159 | if (!(a_status & ZFCP_STATUS_COMMON_UNBLOCKED)) | 161 | if (!(a_status & ZFCP_STATUS_COMMON_UNBLOCKED)) |
160 | need = ZFCP_ERP_ACTION_REOPEN_ADAPTER; | 162 | need = ZFCP_ERP_ACTION_REOPEN_ADAPTER; |
161 | /* fall through */ | 163 | /* fall through */ |
@@ -188,6 +190,9 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
188 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, | 190 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, |
189 | &zfcp_sdev->status); | 191 | &zfcp_sdev->status); |
190 | erp_action = &zfcp_sdev->erp_action; | 192 | erp_action = &zfcp_sdev->erp_action; |
193 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | ||
194 | erp_action->port = port; | ||
195 | erp_action->sdev = sdev; | ||
191 | if (!(atomic_read(&zfcp_sdev->status) & | 196 | if (!(atomic_read(&zfcp_sdev->status) & |
192 | ZFCP_STATUS_COMMON_RUNNING)) | 197 | ZFCP_STATUS_COMMON_RUNNING)) |
193 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; | 198 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; |
@@ -200,6 +205,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
200 | zfcp_erp_action_dismiss_port(port); | 205 | zfcp_erp_action_dismiss_port(port); |
201 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); | 206 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); |
202 | erp_action = &port->erp_action; | 207 | erp_action = &port->erp_action; |
208 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | ||
209 | erp_action->port = port; | ||
203 | if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_RUNNING)) | 210 | if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_RUNNING)) |
204 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; | 211 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; |
205 | break; | 212 | break; |
@@ -209,6 +216,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
209 | zfcp_erp_action_dismiss_adapter(adapter); | 216 | zfcp_erp_action_dismiss_adapter(adapter); |
210 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); | 217 | atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); |
211 | erp_action = &adapter->erp_action; | 218 | erp_action = &adapter->erp_action; |
219 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | ||
212 | if (!(atomic_read(&adapter->status) & | 220 | if (!(atomic_read(&adapter->status) & |
213 | ZFCP_STATUS_COMMON_RUNNING)) | 221 | ZFCP_STATUS_COMMON_RUNNING)) |
214 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; | 222 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; |
@@ -218,10 +226,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
218 | return NULL; | 226 | return NULL; |
219 | } | 227 | } |
220 | 228 | ||
221 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | ||
222 | erp_action->adapter = adapter; | 229 | erp_action->adapter = adapter; |
223 | erp_action->port = port; | ||
224 | erp_action->sdev = sdev; | ||
225 | erp_action->action = need; | 230 | erp_action->action = need; |
226 | erp_action->status = act_status; | 231 | erp_action->status = act_status; |
227 | 232 | ||
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index be0317457147..2eb7dd56ab80 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -851,7 +851,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd) | |||
851 | 851 | ||
852 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); | 852 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); |
853 | 853 | ||
854 | req->data = zfcp_sdev; | 854 | req->data = sdev; |
855 | req->handler = zfcp_fsf_abort_fcp_command_handler; | 855 | req->handler = zfcp_fsf_abort_fcp_command_handler; |
856 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; | 856 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; |
857 | req->qtcb->header.port_handle = zfcp_sdev->port->handle; | 857 | req->qtcb->header.port_handle = zfcp_sdev->port->handle; |
@@ -2069,8 +2069,6 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) | |||
2069 | struct fcp_resp_with_ext *fcp_rsp; | 2069 | struct fcp_resp_with_ext *fcp_rsp; |
2070 | unsigned long flags; | 2070 | unsigned long flags; |
2071 | 2071 | ||
2072 | zfcp_fsf_fcp_handler_common(req); | ||
2073 | |||
2074 | read_lock_irqsave(&req->adapter->abort_lock, flags); | 2072 | read_lock_irqsave(&req->adapter->abort_lock, flags); |
2075 | 2073 | ||
2076 | scpnt = req->data; | 2074 | scpnt = req->data; |
@@ -2079,6 +2077,8 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) | |||
2079 | return; | 2077 | return; |
2080 | } | 2078 | } |
2081 | 2079 | ||
2080 | zfcp_fsf_fcp_handler_common(req); | ||
2081 | |||
2082 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { | 2082 | if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { |
2083 | set_host_byte(scpnt, DID_TRANSPORT_DISRUPTED); | 2083 | set_host_byte(scpnt, DID_TRANSPORT_DISRUPTED); |
2084 | goto skip_fsfstatus; | 2084 | goto skip_fsfstatus; |
@@ -2170,12 +2170,13 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) | |||
2170 | struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; | 2170 | struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; |
2171 | struct zfcp_qdio *qdio = adapter->qdio; | 2171 | struct zfcp_qdio *qdio = adapter->qdio; |
2172 | struct fsf_qtcb_bottom_io *io; | 2172 | struct fsf_qtcb_bottom_io *io; |
2173 | unsigned long flags; | ||
2173 | 2174 | ||
2174 | if (unlikely(!(atomic_read(&zfcp_sdev->status) & | 2175 | if (unlikely(!(atomic_read(&zfcp_sdev->status) & |
2175 | ZFCP_STATUS_COMMON_UNBLOCKED))) | 2176 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
2176 | return -EBUSY; | 2177 | return -EBUSY; |
2177 | 2178 | ||
2178 | spin_lock(&qdio->req_q_lock); | 2179 | spin_lock_irqsave(&qdio->req_q_lock, flags); |
2179 | if (atomic_read(&qdio->req_q_free) <= 0) { | 2180 | if (atomic_read(&qdio->req_q_free) <= 0) { |
2180 | atomic_inc(&qdio->req_q_full); | 2181 | atomic_inc(&qdio->req_q_full); |
2181 | goto out; | 2182 | goto out; |
@@ -2239,7 +2240,7 @@ failed_scsi_cmnd: | |||
2239 | zfcp_fsf_req_free(req); | 2240 | zfcp_fsf_req_free(req); |
2240 | scsi_cmnd->host_scribble = NULL; | 2241 | scsi_cmnd->host_scribble = NULL; |
2241 | out: | 2242 | out: |
2242 | spin_unlock(&qdio->req_q_lock); | 2243 | spin_unlock_irqrestore(&qdio->req_q_lock, flags); |
2243 | return retval; | 2244 | return retval; |
2244 | } | 2245 | } |
2245 | 2246 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 6bd2dbc4c316..63529ed801eb 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -76,8 +76,8 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) | |||
76 | scpnt->scsi_done(scpnt); | 76 | scpnt->scsi_done(scpnt); |
77 | } | 77 | } |
78 | 78 | ||
79 | static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, | 79 | static |
80 | void (*done) (struct scsi_cmnd *)) | 80 | int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt) |
81 | { | 81 | { |
82 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); | 82 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); |
83 | struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; | 83 | struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; |
@@ -87,7 +87,6 @@ static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, | |||
87 | /* reset the status for this request */ | 87 | /* reset the status for this request */ |
88 | scpnt->result = 0; | 88 | scpnt->result = 0; |
89 | scpnt->host_scribble = NULL; | 89 | scpnt->host_scribble = NULL; |
90 | scpnt->scsi_done = done; | ||
91 | 90 | ||
92 | scsi_result = fc_remote_port_chkready(rport); | 91 | scsi_result = fc_remote_port_chkready(rport); |
93 | if (unlikely(scsi_result)) { | 92 | if (unlikely(scsi_result)) { |
@@ -127,8 +126,6 @@ static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, | |||
127 | return ret; | 126 | return ret; |
128 | } | 127 | } |
129 | 128 | ||
130 | static DEF_SCSI_QCMD(zfcp_scsi_queuecommand) | ||
131 | |||
132 | static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) | 129 | static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) |
133 | { | 130 | { |
134 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); | 131 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index c94502dfac66..045d7e87b632 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -677,7 +677,7 @@ bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric, | |||
677 | bfa_trc(fabric->fcs, event); | 677 | bfa_trc(fabric->fcs, event); |
678 | wwn2str(pwwn_ptr, fabric->bport.port_cfg.pwwn); | 678 | wwn2str(pwwn_ptr, fabric->bport.port_cfg.pwwn); |
679 | 679 | ||
680 | BFA_LOG(KERN_INFO, bfad, log_level, | 680 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
681 | "Port is isolated due to VF_ID mismatch. " | 681 | "Port is isolated due to VF_ID mismatch. " |
682 | "PWWN: %s Port VF_ID: %04x switch port VF_ID: %04x.", | 682 | "PWWN: %s Port VF_ID: %04x switch port VF_ID: %04x.", |
683 | pwwn_ptr, fabric->fcs->port_vfid, | 683 | pwwn_ptr, fabric->fcs->port_vfid, |
@@ -1411,7 +1411,7 @@ bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, | |||
1411 | wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport)); | 1411 | wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport)); |
1412 | wwn2str(fwwn_ptr, | 1412 | wwn2str(fwwn_ptr, |
1413 | bfa_fcs_lport_get_fabric_name(&fabric->bport)); | 1413 | bfa_fcs_lport_get_fabric_name(&fabric->bport)); |
1414 | BFA_LOG(KERN_WARNING, bfad, log_level, | 1414 | BFA_LOG(KERN_WARNING, bfad, bfa_log_level, |
1415 | "Base port WWN = %s Fabric WWN = %s\n", | 1415 | "Base port WWN = %s Fabric WWN = %s\n", |
1416 | pwwn_ptr, fwwn_ptr); | 1416 | pwwn_ptr, fwwn_ptr); |
1417 | } | 1417 | } |
diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c index 9662bcdeb41d..413b58eef93a 100644 --- a/drivers/scsi/bfa/bfa_fcs_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c | |||
@@ -261,7 +261,7 @@ bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim, | |||
261 | bfa_fcb_itnim_online(itnim->itnim_drv); | 261 | bfa_fcb_itnim_online(itnim->itnim_drv); |
262 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); | 262 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); |
263 | wwn2str(rpwwn_buf, itnim->rport->pwwn); | 263 | wwn2str(rpwwn_buf, itnim->rport->pwwn); |
264 | BFA_LOG(KERN_INFO, bfad, log_level, | 264 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
265 | "Target (WWN = %s) is online for initiator (WWN = %s)\n", | 265 | "Target (WWN = %s) is online for initiator (WWN = %s)\n", |
266 | rpwwn_buf, lpwwn_buf); | 266 | rpwwn_buf, lpwwn_buf); |
267 | break; | 267 | break; |
@@ -301,11 +301,11 @@ bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim, | |||
301 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); | 301 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port)); |
302 | wwn2str(rpwwn_buf, itnim->rport->pwwn); | 302 | wwn2str(rpwwn_buf, itnim->rport->pwwn); |
303 | if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE) | 303 | if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE) |
304 | BFA_LOG(KERN_ERR, bfad, log_level, | 304 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
305 | "Target (WWN = %s) connectivity lost for " | 305 | "Target (WWN = %s) connectivity lost for " |
306 | "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf); | 306 | "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf); |
307 | else | 307 | else |
308 | BFA_LOG(KERN_INFO, bfad, log_level, | 308 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
309 | "Target (WWN = %s) offlined by initiator (WWN = %s)\n", | 309 | "Target (WWN = %s) offlined by initiator (WWN = %s)\n", |
310 | rpwwn_buf, lpwwn_buf); | 310 | rpwwn_buf, lpwwn_buf); |
311 | break; | 311 | break; |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 377cbfff6f2e..8d651309302b 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -491,7 +491,7 @@ bfa_fcs_lport_online_actions(struct bfa_fcs_lport_s *port) | |||
491 | __port_action[port->fabric->fab_type].online(port); | 491 | __port_action[port->fabric->fab_type].online(port); |
492 | 492 | ||
493 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 493 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
494 | BFA_LOG(KERN_INFO, bfad, log_level, | 494 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
495 | "Logical port online: WWN = %s Role = %s\n", | 495 | "Logical port online: WWN = %s Role = %s\n", |
496 | lpwwn_buf, "Initiator"); | 496 | lpwwn_buf, "Initiator"); |
497 | 497 | ||
@@ -512,11 +512,11 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) | |||
512 | 512 | ||
513 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 513 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
514 | if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE) | 514 | if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE) |
515 | BFA_LOG(KERN_ERR, bfad, log_level, | 515 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
516 | "Logical port lost fabric connectivity: WWN = %s Role = %s\n", | 516 | "Logical port lost fabric connectivity: WWN = %s Role = %s\n", |
517 | lpwwn_buf, "Initiator"); | 517 | lpwwn_buf, "Initiator"); |
518 | else | 518 | else |
519 | BFA_LOG(KERN_INFO, bfad, log_level, | 519 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
520 | "Logical port taken offline: WWN = %s Role = %s\n", | 520 | "Logical port taken offline: WWN = %s Role = %s\n", |
521 | lpwwn_buf, "Initiator"); | 521 | lpwwn_buf, "Initiator"); |
522 | 522 | ||
@@ -573,7 +573,7 @@ bfa_fcs_lport_deleted(struct bfa_fcs_lport_s *port) | |||
573 | char lpwwn_buf[BFA_STRING_32]; | 573 | char lpwwn_buf[BFA_STRING_32]; |
574 | 574 | ||
575 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 575 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
576 | BFA_LOG(KERN_INFO, bfad, log_level, | 576 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
577 | "Logical port deleted: WWN = %s Role = %s\n", | 577 | "Logical port deleted: WWN = %s Role = %s\n", |
578 | lpwwn_buf, "Initiator"); | 578 | lpwwn_buf, "Initiator"); |
579 | 579 | ||
@@ -878,7 +878,7 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
878 | vport ? vport->vport_drv : NULL); | 878 | vport ? vport->vport_drv : NULL); |
879 | 879 | ||
880 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(lport)); | 880 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(lport)); |
881 | BFA_LOG(KERN_INFO, bfad, log_level, | 881 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
882 | "New logical port created: WWN = %s Role = %s\n", | 882 | "New logical port created: WWN = %s Role = %s\n", |
883 | lpwwn_buf, "Initiator"); | 883 | lpwwn_buf, "Initiator"); |
884 | 884 | ||
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index 47f35c0ef29a..cf4a6e73e60d 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c | |||
@@ -2056,7 +2056,7 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) | |||
2056 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 2056 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
2057 | wwn2str(rpwwn_buf, rport->pwwn); | 2057 | wwn2str(rpwwn_buf, rport->pwwn); |
2058 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) | 2058 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) |
2059 | BFA_LOG(KERN_INFO, bfad, log_level, | 2059 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2060 | "Remote port (WWN = %s) online for logical port (WWN = %s)\n", | 2060 | "Remote port (WWN = %s) online for logical port (WWN = %s)\n", |
2061 | rpwwn_buf, lpwwn_buf); | 2061 | rpwwn_buf, lpwwn_buf); |
2062 | } | 2062 | } |
@@ -2075,12 +2075,12 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport) | |||
2075 | wwn2str(rpwwn_buf, rport->pwwn); | 2075 | wwn2str(rpwwn_buf, rport->pwwn); |
2076 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) { | 2076 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) { |
2077 | if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE) | 2077 | if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE) |
2078 | BFA_LOG(KERN_ERR, bfad, log_level, | 2078 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2079 | "Remote port (WWN = %s) connectivity lost for " | 2079 | "Remote port (WWN = %s) connectivity lost for " |
2080 | "logical port (WWN = %s)\n", | 2080 | "logical port (WWN = %s)\n", |
2081 | rpwwn_buf, lpwwn_buf); | 2081 | rpwwn_buf, lpwwn_buf); |
2082 | else | 2082 | else |
2083 | BFA_LOG(KERN_INFO, bfad, log_level, | 2083 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2084 | "Remote port (WWN = %s) offlined by " | 2084 | "Remote port (WWN = %s) offlined by " |
2085 | "logical port (WWN = %s)\n", | 2085 | "logical port (WWN = %s)\n", |
2086 | rpwwn_buf, lpwwn_buf); | 2086 | rpwwn_buf, lpwwn_buf); |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 54475b53a5ab..9f4aa391ea9d 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -402,7 +402,7 @@ bfa_ioc_sm_op_entry(struct bfa_ioc_s *ioc) | |||
402 | 402 | ||
403 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); | 403 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_OK); |
404 | bfa_ioc_hb_monitor(ioc); | 404 | bfa_ioc_hb_monitor(ioc); |
405 | BFA_LOG(KERN_INFO, bfad, log_level, "IOC enabled\n"); | 405 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC enabled\n"); |
406 | } | 406 | } |
407 | 407 | ||
408 | static void | 408 | static void |
@@ -444,7 +444,7 @@ bfa_ioc_sm_disabling_entry(struct bfa_ioc_s *ioc) | |||
444 | { | 444 | { |
445 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | 445 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; |
446 | bfa_iocpf_disable(ioc); | 446 | bfa_iocpf_disable(ioc); |
447 | BFA_LOG(KERN_INFO, bfad, log_level, "IOC disabled\n"); | 447 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n"); |
448 | } | 448 | } |
449 | 449 | ||
450 | /* | 450 | /* |
@@ -565,7 +565,7 @@ bfa_ioc_sm_fail_entry(struct bfa_ioc_s *ioc) | |||
565 | notify->cbfn(notify->cbarg); | 565 | notify->cbfn(notify->cbarg); |
566 | } | 566 | } |
567 | 567 | ||
568 | BFA_LOG(KERN_CRIT, bfad, log_level, | 568 | BFA_LOG(KERN_CRIT, bfad, bfa_log_level, |
569 | "Heart Beat of IOC has failed\n"); | 569 | "Heart Beat of IOC has failed\n"); |
570 | } | 570 | } |
571 | 571 | ||
@@ -1812,7 +1812,7 @@ bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc) | |||
1812 | * Provide enable completion callback. | 1812 | * Provide enable completion callback. |
1813 | */ | 1813 | */ |
1814 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); | 1814 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); |
1815 | BFA_LOG(KERN_WARNING, bfad, log_level, | 1815 | BFA_LOG(KERN_WARNING, bfad, bfa_log_level, |
1816 | "Running firmware version is incompatible " | 1816 | "Running firmware version is incompatible " |
1817 | "with the driver version\n"); | 1817 | "with the driver version\n"); |
1818 | } | 1818 | } |
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index c768143f4805..37e16ac8f249 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c | |||
@@ -2138,7 +2138,7 @@ bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport, | |||
2138 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2138 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2139 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 2139 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
2140 | wwn2str(pwwn_buf, fcport->pwwn); | 2140 | wwn2str(pwwn_buf, fcport->pwwn); |
2141 | BFA_LOG(KERN_INFO, bfad, log_level, | 2141 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2142 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2142 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2143 | break; | 2143 | break; |
2144 | 2144 | ||
@@ -2198,7 +2198,7 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, | |||
2198 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2198 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2199 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 2199 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
2200 | wwn2str(pwwn_buf, fcport->pwwn); | 2200 | wwn2str(pwwn_buf, fcport->pwwn); |
2201 | BFA_LOG(KERN_INFO, bfad, log_level, | 2201 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2202 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2202 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2203 | break; | 2203 | break; |
2204 | 2204 | ||
@@ -2251,7 +2251,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, | |||
2251 | 2251 | ||
2252 | bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE); | 2252 | bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE); |
2253 | wwn2str(pwwn_buf, fcport->pwwn); | 2253 | wwn2str(pwwn_buf, fcport->pwwn); |
2254 | BFA_LOG(KERN_INFO, bfad, log_level, | 2254 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2255 | "Base port online: WWN = %s\n", pwwn_buf); | 2255 | "Base port online: WWN = %s\n", pwwn_buf); |
2256 | break; | 2256 | break; |
2257 | 2257 | ||
@@ -2277,7 +2277,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, | |||
2277 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2277 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2278 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 2278 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
2279 | wwn2str(pwwn_buf, fcport->pwwn); | 2279 | wwn2str(pwwn_buf, fcport->pwwn); |
2280 | BFA_LOG(KERN_INFO, bfad, log_level, | 2280 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2281 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2281 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2282 | break; | 2282 | break; |
2283 | 2283 | ||
@@ -2322,9 +2322,9 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2322 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2322 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2323 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 2323 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
2324 | wwn2str(pwwn_buf, fcport->pwwn); | 2324 | wwn2str(pwwn_buf, fcport->pwwn); |
2325 | BFA_LOG(KERN_INFO, bfad, log_level, | 2325 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2326 | "Base port offline: WWN = %s\n", pwwn_buf); | 2326 | "Base port offline: WWN = %s\n", pwwn_buf); |
2327 | BFA_LOG(KERN_INFO, bfad, log_level, | 2327 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2328 | "Base port disabled: WWN = %s\n", pwwn_buf); | 2328 | "Base port disabled: WWN = %s\n", pwwn_buf); |
2329 | break; | 2329 | break; |
2330 | 2330 | ||
@@ -2336,10 +2336,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2336 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); | 2336 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); |
2337 | wwn2str(pwwn_buf, fcport->pwwn); | 2337 | wwn2str(pwwn_buf, fcport->pwwn); |
2338 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) | 2338 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) |
2339 | BFA_LOG(KERN_INFO, bfad, log_level, | 2339 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2340 | "Base port offline: WWN = %s\n", pwwn_buf); | 2340 | "Base port offline: WWN = %s\n", pwwn_buf); |
2341 | else | 2341 | else |
2342 | BFA_LOG(KERN_ERR, bfad, log_level, | 2342 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2343 | "Base port (WWN = %s) " | 2343 | "Base port (WWN = %s) " |
2344 | "lost fabric connectivity\n", pwwn_buf); | 2344 | "lost fabric connectivity\n", pwwn_buf); |
2345 | break; | 2345 | break; |
@@ -2349,10 +2349,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2349 | bfa_fcport_reset_linkinfo(fcport); | 2349 | bfa_fcport_reset_linkinfo(fcport); |
2350 | wwn2str(pwwn_buf, fcport->pwwn); | 2350 | wwn2str(pwwn_buf, fcport->pwwn); |
2351 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) | 2351 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) |
2352 | BFA_LOG(KERN_INFO, bfad, log_level, | 2352 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2353 | "Base port offline: WWN = %s\n", pwwn_buf); | 2353 | "Base port offline: WWN = %s\n", pwwn_buf); |
2354 | else | 2354 | else |
2355 | BFA_LOG(KERN_ERR, bfad, log_level, | 2355 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2356 | "Base port (WWN = %s) " | 2356 | "Base port (WWN = %s) " |
2357 | "lost fabric connectivity\n", pwwn_buf); | 2357 | "lost fabric connectivity\n", pwwn_buf); |
2358 | break; | 2358 | break; |
@@ -2363,10 +2363,10 @@ bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, | |||
2363 | bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); | 2363 | bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE); |
2364 | wwn2str(pwwn_buf, fcport->pwwn); | 2364 | wwn2str(pwwn_buf, fcport->pwwn); |
2365 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) | 2365 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) |
2366 | BFA_LOG(KERN_INFO, bfad, log_level, | 2366 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2367 | "Base port offline: WWN = %s\n", pwwn_buf); | 2367 | "Base port offline: WWN = %s\n", pwwn_buf); |
2368 | else | 2368 | else |
2369 | BFA_LOG(KERN_ERR, bfad, log_level, | 2369 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
2370 | "Base port (WWN = %s) " | 2370 | "Base port (WWN = %s) " |
2371 | "lost fabric connectivity\n", pwwn_buf); | 2371 | "lost fabric connectivity\n", pwwn_buf); |
2372 | break; | 2372 | break; |
@@ -2497,7 +2497,7 @@ bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport, | |||
2497 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2497 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2498 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); | 2498 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); |
2499 | wwn2str(pwwn_buf, fcport->pwwn); | 2499 | wwn2str(pwwn_buf, fcport->pwwn); |
2500 | BFA_LOG(KERN_INFO, bfad, log_level, | 2500 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2501 | "Base port enabled: WWN = %s\n", pwwn_buf); | 2501 | "Base port enabled: WWN = %s\n", pwwn_buf); |
2502 | break; | 2502 | break; |
2503 | 2503 | ||
@@ -2551,7 +2551,7 @@ bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport, | |||
2551 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2551 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2552 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); | 2552 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); |
2553 | wwn2str(pwwn_buf, fcport->pwwn); | 2553 | wwn2str(pwwn_buf, fcport->pwwn); |
2554 | BFA_LOG(KERN_INFO, bfad, log_level, | 2554 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
2555 | "Base port enabled: WWN = %s\n", pwwn_buf); | 2555 | "Base port enabled: WWN = %s\n", pwwn_buf); |
2556 | break; | 2556 | break; |
2557 | 2557 | ||
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 1f938974b848..6797720213b2 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -50,7 +50,7 @@ int reqq_size, rspq_size, num_sgpgs; | |||
50 | int rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT; | 50 | int rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT; |
51 | int bfa_lun_queue_depth = BFAD_LUN_QUEUE_DEPTH; | 51 | int bfa_lun_queue_depth = BFAD_LUN_QUEUE_DEPTH; |
52 | int bfa_io_max_sge = BFAD_IO_MAX_SGE; | 52 | int bfa_io_max_sge = BFAD_IO_MAX_SGE; |
53 | int log_level = 3; /* WARNING log level */ | 53 | int bfa_log_level = 3; /* WARNING log level */ |
54 | int ioc_auto_recover = BFA_TRUE; | 54 | int ioc_auto_recover = BFA_TRUE; |
55 | int bfa_linkup_delay = -1; | 55 | int bfa_linkup_delay = -1; |
56 | int fdmi_enable = BFA_TRUE; | 56 | int fdmi_enable = BFA_TRUE; |
@@ -108,8 +108,8 @@ module_param(bfa_lun_queue_depth, int, S_IRUGO | S_IWUSR); | |||
108 | MODULE_PARM_DESC(bfa_lun_queue_depth, "Lun queue depth, default=32, Range[>0]"); | 108 | MODULE_PARM_DESC(bfa_lun_queue_depth, "Lun queue depth, default=32, Range[>0]"); |
109 | module_param(bfa_io_max_sge, int, S_IRUGO | S_IWUSR); | 109 | module_param(bfa_io_max_sge, int, S_IRUGO | S_IWUSR); |
110 | MODULE_PARM_DESC(bfa_io_max_sge, "Max io scatter/gather elements, default=255"); | 110 | MODULE_PARM_DESC(bfa_io_max_sge, "Max io scatter/gather elements, default=255"); |
111 | module_param(log_level, int, S_IRUGO | S_IWUSR); | 111 | module_param(bfa_log_level, int, S_IRUGO | S_IWUSR); |
112 | MODULE_PARM_DESC(log_level, "Driver log level, default=3, " | 112 | MODULE_PARM_DESC(bfa_log_level, "Driver log level, default=3, " |
113 | "Range[Critical:1|Error:2|Warning:3|Info:4]"); | 113 | "Range[Critical:1|Error:2|Warning:3|Info:4]"); |
114 | module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR); | 114 | module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR); |
115 | MODULE_PARM_DESC(ioc_auto_recover, "IOC auto recovery, default=1, " | 115 | MODULE_PARM_DESC(ioc_auto_recover, "IOC auto recovery, default=1, " |
@@ -1112,7 +1112,7 @@ bfad_start_ops(struct bfad_s *bfad) { | |||
1112 | } else | 1112 | } else |
1113 | bfad_os_rport_online_wait(bfad); | 1113 | bfad_os_rport_online_wait(bfad); |
1114 | 1114 | ||
1115 | BFA_LOG(KERN_INFO, bfad, log_level, "bfa device claimed\n"); | 1115 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n"); |
1116 | 1116 | ||
1117 | return BFA_STATUS_OK; | 1117 | return BFA_STATUS_OK; |
1118 | } | 1118 | } |
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index 97f9b6c0937e..d5ce2349ac59 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -337,7 +337,7 @@ extern int num_sgpgs; | |||
337 | extern int rport_del_timeout; | 337 | extern int rport_del_timeout; |
338 | extern int bfa_lun_queue_depth; | 338 | extern int bfa_lun_queue_depth; |
339 | extern int bfa_io_max_sge; | 339 | extern int bfa_io_max_sge; |
340 | extern int log_level; | 340 | extern int bfa_log_level; |
341 | extern int ioc_auto_recover; | 341 | extern int ioc_auto_recover; |
342 | extern int bfa_linkup_delay; | 342 | extern int bfa_linkup_delay; |
343 | extern int msix_disable_cb; | 343 | extern int msix_disable_cb; |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 8ca967dee66d..fbad5e9b2402 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -225,7 +225,8 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | bfa_trc(bfad, hal_io->iotag); | 227 | bfa_trc(bfad, hal_io->iotag); |
228 | BFA_LOG(KERN_INFO, bfad, log_level, "scsi%d: abort cmnd %p iotag %x\n", | 228 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
229 | "scsi%d: abort cmnd %p iotag %x\n", | ||
229 | im_port->shost->host_no, cmnd, hal_io->iotag); | 230 | im_port->shost->host_no, cmnd, hal_io->iotag); |
230 | (void) bfa_ioim_abort(hal_io); | 231 | (void) bfa_ioim_abort(hal_io); |
231 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 232 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
@@ -241,7 +242,7 @@ bfad_im_abort_handler(struct scsi_cmnd *cmnd) | |||
241 | 242 | ||
242 | cmnd->scsi_done(cmnd); | 243 | cmnd->scsi_done(cmnd); |
243 | bfa_trc(bfad, hal_io->iotag); | 244 | bfa_trc(bfad, hal_io->iotag); |
244 | BFA_LOG(KERN_INFO, bfad, log_level, | 245 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
245 | "scsi%d: complete abort 0x%p iotag 0x%x\n", | 246 | "scsi%d: complete abort 0x%p iotag 0x%x\n", |
246 | im_port->shost->host_no, cmnd, hal_io->iotag); | 247 | im_port->shost->host_no, cmnd, hal_io->iotag); |
247 | return SUCCESS; | 248 | return SUCCESS; |
@@ -260,7 +261,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, | |||
260 | 261 | ||
261 | tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); | 262 | tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); |
262 | if (!tskim) { | 263 | if (!tskim) { |
263 | BFA_LOG(KERN_ERR, bfad, log_level, | 264 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
264 | "target reset, fail to allocate tskim\n"); | 265 | "target reset, fail to allocate tskim\n"); |
265 | rc = BFA_STATUS_FAILED; | 266 | rc = BFA_STATUS_FAILED; |
266 | goto out; | 267 | goto out; |
@@ -311,7 +312,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
311 | 312 | ||
312 | tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); | 313 | tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); |
313 | if (!tskim) { | 314 | if (!tskim) { |
314 | BFA_LOG(KERN_ERR, bfad, log_level, | 315 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
315 | "LUN reset, fail to allocate tskim"); | 316 | "LUN reset, fail to allocate tskim"); |
316 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 317 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
317 | rc = FAILED; | 318 | rc = FAILED; |
@@ -336,7 +337,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
336 | 337 | ||
337 | task_status = cmnd->SCp.Status >> 1; | 338 | task_status = cmnd->SCp.Status >> 1; |
338 | if (task_status != BFI_TSKIM_STS_OK) { | 339 | if (task_status != BFI_TSKIM_STS_OK) { |
339 | BFA_LOG(KERN_ERR, bfad, log_level, | 340 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
340 | "LUN reset failure, status: %d\n", task_status); | 341 | "LUN reset failure, status: %d\n", task_status); |
341 | rc = FAILED; | 342 | rc = FAILED; |
342 | } | 343 | } |
@@ -380,7 +381,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
380 | 381 | ||
381 | task_status = cmnd->SCp.Status >> 1; | 382 | task_status = cmnd->SCp.Status >> 1; |
382 | if (task_status != BFI_TSKIM_STS_OK) { | 383 | if (task_status != BFI_TSKIM_STS_OK) { |
383 | BFA_LOG(KERN_ERR, bfad, log_level, | 384 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
384 | "target reset failure," | 385 | "target reset failure," |
385 | " status: %d\n", task_status); | 386 | " status: %d\n", task_status); |
386 | err_cnt++; | 387 | err_cnt++; |
@@ -460,7 +461,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv) | |||
460 | fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim); | 461 | fcid = bfa_fcs_itnim_get_fcid(&itnim_drv->fcs_itnim); |
461 | wwn2str(wwpn_str, wwpn); | 462 | wwn2str(wwpn_str, wwpn); |
462 | fcid2str(fcid_str, fcid); | 463 | fcid2str(fcid_str, fcid); |
463 | BFA_LOG(KERN_INFO, bfad, log_level, | 464 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
464 | "ITNIM FREE scsi%d: FCID: %s WWPN: %s\n", | 465 | "ITNIM FREE scsi%d: FCID: %s WWPN: %s\n", |
465 | port->im_port->shost->host_no, | 466 | port->im_port->shost->host_no, |
466 | fcid_str, wwpn_str); | 467 | fcid_str, wwpn_str); |
@@ -589,7 +590,7 @@ void | |||
589 | bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) | 590 | bfad_im_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) |
590 | { | 591 | { |
591 | bfa_trc(bfad, bfad->inst_no); | 592 | bfa_trc(bfad, bfad->inst_no); |
592 | BFA_LOG(KERN_INFO, bfad, log_level, "Free scsi%d\n", | 593 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "Free scsi%d\n", |
593 | im_port->shost->host_no); | 594 | im_port->shost->host_no); |
594 | 595 | ||
595 | fc_remove_host(im_port->shost); | 596 | fc_remove_host(im_port->shost); |
@@ -1048,7 +1049,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) | |||
1048 | fcid2str(fcid_str, fcid); | 1049 | fcid2str(fcid_str, fcid); |
1049 | list_add_tail(&itnim->list_entry, | 1050 | list_add_tail(&itnim->list_entry, |
1050 | &im_port->itnim_mapped_list); | 1051 | &im_port->itnim_mapped_list); |
1051 | BFA_LOG(KERN_INFO, bfad, log_level, | 1052 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
1052 | "ITNIM ONLINE Target: %d:0:%d " | 1053 | "ITNIM ONLINE Target: %d:0:%d " |
1053 | "FCID: %s WWPN: %s\n", | 1054 | "FCID: %s WWPN: %s\n", |
1054 | im_port->shost->host_no, | 1055 | im_port->shost->host_no, |
@@ -1081,7 +1082,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) | |||
1081 | wwn2str(wwpn_str, wwpn); | 1082 | wwn2str(wwpn_str, wwpn); |
1082 | fcid2str(fcid_str, fcid); | 1083 | fcid2str(fcid_str, fcid); |
1083 | list_del(&itnim->list_entry); | 1084 | list_del(&itnim->list_entry); |
1084 | BFA_LOG(KERN_INFO, bfad, log_level, | 1085 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, |
1085 | "ITNIM OFFLINE Target: %d:0:%d " | 1086 | "ITNIM OFFLINE Target: %d:0:%d " |
1086 | "FCID: %s WWPN: %s\n", | 1087 | "FCID: %s WWPN: %s\n", |
1087 | im_port->shost->host_no, | 1088 | im_port->shost->host_no, |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index b2fb2b2a6e70..a6dea08664fc 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -90,11 +90,7 @@ static const struct pci_device_id hpsa_pci_device_id[] = { | |||
90 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3252}, | 90 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3252}, |
91 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3253}, | 91 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3253}, |
92 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3254}, | 92 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3254}, |
93 | #define PCI_DEVICE_ID_HP_CISSF 0x333f | 93 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
94 | {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x333F}, | ||
95 | {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
96 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | ||
97 | {PCI_VENDOR_ID_COMPAQ, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
98 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, | 94 | PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, |
99 | {0,} | 95 | {0,} |
100 | }; | 96 | }; |
@@ -113,8 +109,6 @@ static struct board_type products[] = { | |||
113 | {0x3249103C, "Smart Array P812", &SA5_access}, | 109 | {0x3249103C, "Smart Array P812", &SA5_access}, |
114 | {0x324a103C, "Smart Array P712m", &SA5_access}, | 110 | {0x324a103C, "Smart Array P712m", &SA5_access}, |
115 | {0x324b103C, "Smart Array P711m", &SA5_access}, | 111 | {0x324b103C, "Smart Array P711m", &SA5_access}, |
116 | {0x3233103C, "StorageWorks P1210m", &SA5_access}, | ||
117 | {0x333F103C, "StorageWorks P1210m", &SA5_access}, | ||
118 | {0x3250103C, "Smart Array", &SA5_access}, | 112 | {0x3250103C, "Smart Array", &SA5_access}, |
119 | {0x3250113C, "Smart Array", &SA5_access}, | 113 | {0x3250113C, "Smart Array", &SA5_access}, |
120 | {0x3250123C, "Smart Array", &SA5_access}, | 114 | {0x3250123C, "Smart Array", &SA5_access}, |
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index 0433ea6f27c9..b37c8a3c1bb0 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c | |||
@@ -951,8 +951,8 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key) | |||
951 | /* create a bio for continuation segment */ | 951 | /* create a bio for continuation segment */ |
952 | bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes, | 952 | bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes, |
953 | GFP_KERNEL); | 953 | GFP_KERNEL); |
954 | if (unlikely(!bio)) | 954 | if (IS_ERR(bio)) |
955 | return -ENOMEM; | 955 | return PTR_ERR(bio); |
956 | 956 | ||
957 | bio->bi_rw |= REQ_WRITE; | 957 | bio->bi_rw |= REQ_WRITE; |
958 | 958 | ||
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 5e76a624cb08..300d59f389da 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -62,6 +62,7 @@ | |||
62 | static unsigned int pmcraid_debug_log; | 62 | static unsigned int pmcraid_debug_log; |
63 | static unsigned int pmcraid_disable_aen; | 63 | static unsigned int pmcraid_disable_aen; |
64 | static unsigned int pmcraid_log_level = IOASC_LOG_LEVEL_MUST; | 64 | static unsigned int pmcraid_log_level = IOASC_LOG_LEVEL_MUST; |
65 | static unsigned int pmcraid_enable_msix; | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * Data structures to support multiple adapters by the LLD. | 68 | * Data structures to support multiple adapters by the LLD. |
@@ -4691,7 +4692,8 @@ pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance) | |||
4691 | int rc; | 4692 | int rc; |
4692 | struct pci_dev *pdev = pinstance->pdev; | 4693 | struct pci_dev *pdev = pinstance->pdev; |
4693 | 4694 | ||
4694 | if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) { | 4695 | if ((pmcraid_enable_msix) && |
4696 | (pci_find_capability(pdev, PCI_CAP_ID_MSIX))) { | ||
4695 | int num_hrrq = PMCRAID_NUM_MSIX_VECTORS; | 4697 | int num_hrrq = PMCRAID_NUM_MSIX_VECTORS; |
4696 | struct msix_entry entries[PMCRAID_NUM_MSIX_VECTORS]; | 4698 | struct msix_entry entries[PMCRAID_NUM_MSIX_VECTORS]; |
4697 | int i; | 4699 | int i; |
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h index 1134279604e8..4db210d93947 100644 --- a/drivers/scsi/pmcraid.h +++ b/drivers/scsi/pmcraid.h | |||
@@ -42,7 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | #define PMCRAID_DRIVER_NAME "PMC MaxRAID" | 43 | #define PMCRAID_DRIVER_NAME "PMC MaxRAID" |
44 | #define PMCRAID_DEVFILE "pmcsas" | 44 | #define PMCRAID_DEVFILE "pmcsas" |
45 | #define PMCRAID_DRIVER_VERSION "2.0.3" | 45 | #define PMCRAID_DRIVER_VERSION "1.0.3" |
46 | #define PMCRAID_DRIVER_DATE __DATE__ | 46 | #define PMCRAID_DRIVER_DATE __DATE__ |
47 | 47 | ||
48 | #define PMCRAID_FW_VERSION_1 0x002 | 48 | #define PMCRAID_FW_VERSION_1 0x002 |
@@ -333,11 +333,9 @@ struct pmcraid_config_table_entry { | |||
333 | __u8 lun[PMCRAID_LUN_LEN]; | 333 | __u8 lun[PMCRAID_LUN_LEN]; |
334 | } __attribute__((packed, aligned(4))); | 334 | } __attribute__((packed, aligned(4))); |
335 | 335 | ||
336 | /* extended configuration table sizes are of 64 bytes in size */ | 336 | /* extended configuration table sizes are also of 32 bytes in size */ |
337 | #define PMCRAID_CFGTE_EXT_SIZE 32 | ||
338 | struct pmcraid_config_table_entry_ext { | 337 | struct pmcraid_config_table_entry_ext { |
339 | struct pmcraid_config_table_entry cfgte; | 338 | struct pmcraid_config_table_entry cfgte; |
340 | __u8 cfgte_ext[PMCRAID_CFGTE_EXT_SIZE]; | ||
341 | }; | 339 | }; |
342 | 340 | ||
343 | /* resource types (config_table_entry.resource_type values) */ | 341 | /* resource types (config_table_entry.resource_type values) */ |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 3a22effced5f..9ce539d4557e 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2409,7 +2409,6 @@ struct qla_hw_data { | |||
2409 | uint32_t enable_target_reset :1; | 2409 | uint32_t enable_target_reset :1; |
2410 | uint32_t enable_lip_full_login :1; | 2410 | uint32_t enable_lip_full_login :1; |
2411 | uint32_t enable_led_scheme :1; | 2411 | uint32_t enable_led_scheme :1; |
2412 | uint32_t inta_enabled :1; | ||
2413 | uint32_t msi_enabled :1; | 2412 | uint32_t msi_enabled :1; |
2414 | uint32_t msix_enabled :1; | 2413 | uint32_t msix_enabled :1; |
2415 | uint32_t disable_serdes :1; | 2414 | uint32_t disable_serdes :1; |
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 5f94430b42f0..4c1ba6263eb3 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -1061,6 +1061,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
1061 | fcp_cmnd->additional_cdb_len |= 2; | 1061 | fcp_cmnd->additional_cdb_len |= 2; |
1062 | 1062 | ||
1063 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); | 1063 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); |
1064 | host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun)); | ||
1064 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); | 1065 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); |
1065 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); | 1066 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); |
1066 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( | 1067 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 1f06ddd9bdd1..7f77898486a9 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -2491,14 +2491,15 @@ skip_msix: | |||
2491 | skip_msi: | 2491 | skip_msi: |
2492 | 2492 | ||
2493 | ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler, | 2493 | ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler, |
2494 | IRQF_SHARED, QLA2XXX_DRIVER_NAME, rsp); | 2494 | ha->flags.msi_enabled ? 0 : IRQF_SHARED, |
2495 | QLA2XXX_DRIVER_NAME, rsp); | ||
2495 | if (ret) { | 2496 | if (ret) { |
2496 | qla_printk(KERN_WARNING, ha, | 2497 | qla_printk(KERN_WARNING, ha, |
2497 | "Failed to reserve interrupt %d already in use.\n", | 2498 | "Failed to reserve interrupt %d already in use.\n", |
2498 | ha->pdev->irq); | 2499 | ha->pdev->irq); |
2499 | goto fail; | 2500 | goto fail; |
2500 | } | 2501 | } |
2501 | ha->flags.inta_enabled = 1; | 2502 | |
2502 | clear_risc_ints: | 2503 | clear_risc_ints: |
2503 | 2504 | ||
2504 | /* | 2505 | /* |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 8d9edfb39803..ae2acacc0003 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
@@ -2749,6 +2749,7 @@ sufficient_dsds: | |||
2749 | goto queuing_error_fcp_cmnd; | 2749 | goto queuing_error_fcp_cmnd; |
2750 | 2750 | ||
2751 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); | 2751 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); |
2752 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); | ||
2752 | 2753 | ||
2753 | /* build FCP_CMND IU */ | 2754 | /* build FCP_CMND IU */ |
2754 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); | 2755 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 1644eabaafeb..2c0876c81a3f 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -829,7 +829,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) | |||
829 | { | 829 | { |
830 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); | 830 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
831 | srb_t *sp; | 831 | srb_t *sp; |
832 | int ret; | 832 | int ret = SUCCESS; |
833 | unsigned int id, lun; | 833 | unsigned int id, lun; |
834 | unsigned long flags; | 834 | unsigned long flags; |
835 | int wait = 0; | 835 | int wait = 0; |
@@ -2064,6 +2064,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2064 | ha->init_cb_size = sizeof(struct mid_init_cb_81xx); | 2064 | ha->init_cb_size = sizeof(struct mid_init_cb_81xx); |
2065 | ha->gid_list_info_size = 8; | 2065 | ha->gid_list_info_size = 8; |
2066 | ha->optrom_size = OPTROM_SIZE_82XX; | 2066 | ha->optrom_size = OPTROM_SIZE_82XX; |
2067 | ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; | ||
2067 | ha->isp_ops = &qla82xx_isp_ops; | 2068 | ha->isp_ops = &qla82xx_isp_ops; |
2068 | ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; | 2069 | ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; |
2069 | ha->flash_data_off = FARX_ACCESS_FLASH_DATA; | 2070 | ha->flash_data_off = FARX_ACCESS_FLASH_DATA; |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 8edbccb3232d..cf0075a2d0c2 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,9 +7,9 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.03.04-k0" | 10 | #define QLA2XXX_VERSION "8.03.05-k0" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
14 | #define QLA_DRIVER_PATCH_VER 4 | 14 | #define QLA_DRIVER_PATCH_VER 5 |
15 | #define QLA_DRIVER_BETA_VER 0 | 15 | #define QLA_DRIVER_BETA_VER 0 |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 824b8fc03ce5..30ac116186f5 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -615,7 +615,7 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) | |||
615 | return rtn; | 615 | return rtn; |
616 | } | 616 | } |
617 | 617 | ||
618 | static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | 618 | static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) |
619 | { | 619 | { |
620 | if (!scmd->device->host->hostt->eh_abort_handler) | 620 | if (!scmd->device->host->hostt->eh_abort_handler) |
621 | return FAILED; | 621 | return FAILED; |
@@ -623,31 +623,9 @@ static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | |||
623 | return scmd->device->host->hostt->eh_abort_handler(scmd); | 623 | return scmd->device->host->hostt->eh_abort_handler(scmd); |
624 | } | 624 | } |
625 | 625 | ||
626 | /** | ||
627 | * scsi_try_to_abort_cmd - Ask host to abort a running command. | ||
628 | * @scmd: SCSI cmd to abort from Lower Level. | ||
629 | * | ||
630 | * Notes: | ||
631 | * This function will not return until the user's completion function | ||
632 | * has been called. there is no timeout on this operation. if the | ||
633 | * author of the low-level driver wishes this operation to be timed, | ||
634 | * they can provide this facility themselves. helper functions in | ||
635 | * scsi_error.c can be supplied to make this easier to do. | ||
636 | */ | ||
637 | static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | ||
638 | { | ||
639 | /* | ||
640 | * scsi_done was called just after the command timed out and before | ||
641 | * we had a chance to process it. (db) | ||
642 | */ | ||
643 | if (scmd->serial_number == 0) | ||
644 | return SUCCESS; | ||
645 | return __scsi_try_to_abort_cmd(scmd); | ||
646 | } | ||
647 | |||
648 | static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) | 626 | static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) |
649 | { | 627 | { |
650 | if (__scsi_try_to_abort_cmd(scmd) != SUCCESS) | 628 | if (scsi_try_to_abort_cmd(scmd) != SUCCESS) |
651 | if (scsi_try_bus_device_reset(scmd) != SUCCESS) | 629 | if (scsi_try_bus_device_reset(scmd) != SUCCESS) |
652 | if (scsi_try_target_reset(scmd) != SUCCESS) | 630 | if (scsi_try_target_reset(scmd) != SUCCESS) |
653 | if (scsi_try_bus_reset(scmd) != SUCCESS) | 631 | if (scsi_try_bus_reset(scmd) != SUCCESS) |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index eafeeda6e194..4a3842212c50 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1403,11 +1403,6 @@ static void scsi_softirq_done(struct request *rq) | |||
1403 | 1403 | ||
1404 | INIT_LIST_HEAD(&cmd->eh_entry); | 1404 | INIT_LIST_HEAD(&cmd->eh_entry); |
1405 | 1405 | ||
1406 | /* | ||
1407 | * Set the serial numbers back to zero | ||
1408 | */ | ||
1409 | cmd->serial_number = 0; | ||
1410 | |||
1411 | atomic_inc(&cmd->device->iodone_cnt); | 1406 | atomic_inc(&cmd->device->iodone_cnt); |
1412 | if (cmd->result) | 1407 | if (cmd->result) |
1413 | atomic_inc(&cmd->device->ioerr_cnt); | 1408 | atomic_inc(&cmd->device->ioerr_cnt); |
@@ -1642,9 +1637,8 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
1642 | 1637 | ||
1643 | blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); | 1638 | blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); |
1644 | 1639 | ||
1645 | /* New queue, no concurrency on queue_flags */ | ||
1646 | if (!shost->use_clustering) | 1640 | if (!shost->use_clustering) |
1647 | queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q); | 1641 | q->limits.cluster = 0; |
1648 | 1642 | ||
1649 | /* | 1643 | /* |
1650 | * set a reasonable default alignment on word boundaries: the | 1644 | * set a reasonable default alignment on word boundaries: the |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 4d8e14b7aa93..09a550860dcf 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2872,7 +2872,7 @@ static struct console serial8250_console = { | |||
2872 | .device = uart_console_device, | 2872 | .device = uart_console_device, |
2873 | .setup = serial8250_console_setup, | 2873 | .setup = serial8250_console_setup, |
2874 | .early_setup = serial8250_console_early_setup, | 2874 | .early_setup = serial8250_console_early_setup, |
2875 | .flags = CON_PRINTBUFFER, | 2875 | .flags = CON_PRINTBUFFER | CON_ANYTIME, |
2876 | .index = -1, | 2876 | .index = -1, |
2877 | .data = &serial8250_reg, | 2877 | .data = &serial8250_reg, |
2878 | }; | 2878 | }; |
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c index 3374618300af..25a8bc565f40 100644 --- a/drivers/serial/kgdboc.c +++ b/drivers/serial/kgdboc.c | |||
@@ -90,7 +90,8 @@ static DECLARE_WORK(kgdboc_restore_input_work, kgdboc_restore_input_helper); | |||
90 | 90 | ||
91 | static void kgdboc_restore_input(void) | 91 | static void kgdboc_restore_input(void) |
92 | { | 92 | { |
93 | schedule_work(&kgdboc_restore_input_work); | 93 | if (likely(system_state == SYSTEM_RUNNING)) |
94 | schedule_work(&kgdboc_restore_input_work); | ||
94 | } | 95 | } |
95 | 96 | ||
96 | static int kgdboc_register_kbd(char **cptr) | 97 | static int kgdboc_register_kbd(char **cptr) |
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c index 5fc699e929dc..d40010a22ecd 100644 --- a/drivers/serial/mfd.c +++ b/drivers/serial/mfd.c | |||
@@ -900,8 +900,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
900 | unsigned char cval, fcr = 0; | 900 | unsigned char cval, fcr = 0; |
901 | unsigned long flags; | 901 | unsigned long flags; |
902 | unsigned int baud, quot; | 902 | unsigned int baud, quot; |
903 | u32 mul = 0x3600; | 903 | u32 ps, mul; |
904 | u32 ps = 0x10; | ||
905 | 904 | ||
906 | switch (termios->c_cflag & CSIZE) { | 905 | switch (termios->c_cflag & CSIZE) { |
907 | case CS5: | 906 | case CS5: |
@@ -943,31 +942,24 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
943 | baud = uart_get_baud_rate(port, termios, old, 0, 4000000); | 942 | baud = uart_get_baud_rate(port, termios, old, 0, 4000000); |
944 | 943 | ||
945 | quot = 1; | 944 | quot = 1; |
945 | ps = 0x10; | ||
946 | mul = 0x3600; | ||
946 | switch (baud) { | 947 | switch (baud) { |
947 | case 3500000: | 948 | case 3500000: |
948 | mul = 0x3345; | 949 | mul = 0x3345; |
949 | ps = 0xC; | 950 | ps = 0xC; |
950 | break; | 951 | break; |
951 | case 3000000: | ||
952 | mul = 0x2EE0; | ||
953 | break; | ||
954 | case 2500000: | ||
955 | mul = 0x2710; | ||
956 | break; | ||
957 | case 2000000: | ||
958 | mul = 0x1F40; | ||
959 | break; | ||
960 | case 1843200: | 952 | case 1843200: |
961 | mul = 0x2400; | 953 | mul = 0x2400; |
962 | break; | 954 | break; |
955 | case 3000000: | ||
956 | case 2500000: | ||
957 | case 2000000: | ||
963 | case 1500000: | 958 | case 1500000: |
964 | mul = 0x1770; | ||
965 | break; | ||
966 | case 1000000: | 959 | case 1000000: |
967 | mul = 0xFA0; | ||
968 | break; | ||
969 | case 500000: | 960 | case 500000: |
970 | mul = 0x7D0; | 961 | /* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */ |
962 | mul = baud / 500000 * 0x9C4; | ||
971 | break; | 963 | break; |
972 | default: | 964 | default: |
973 | /* Use uart_get_divisor to get quot for other baud rates */ | 965 | /* Use uart_get_divisor to get quot for other baud rates */ |
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index e5e9e6735f7d..9739431092d1 100644 --- a/drivers/sh/intc/core.c +++ b/drivers/sh/intc/core.c | |||
@@ -198,6 +198,7 @@ int __init register_intc_controller(struct intc_desc *desc) | |||
198 | list_add_tail(&d->list, &intc_list); | 198 | list_add_tail(&d->list, &intc_list); |
199 | 199 | ||
200 | raw_spin_lock_init(&d->lock); | 200 | raw_spin_lock_init(&d->lock); |
201 | INIT_RADIX_TREE(&d->tree, GFP_ATOMIC); | ||
201 | 202 | ||
202 | d->index = nr_intc_controllers; | 203 | d->index = nr_intc_controllers; |
203 | 204 | ||
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 154529aacc03..a067046c9da2 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -352,8 +352,12 @@ atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer) | |||
352 | 352 | ||
353 | xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS; | 353 | xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS; |
354 | if (xfer->tx_buf) { | 354 | if (xfer->tx_buf) { |
355 | /* tx_buf is a const void* where we need a void * for the dma | ||
356 | * mapping */ | ||
357 | void *nonconst_tx = (void *)xfer->tx_buf; | ||
358 | |||
355 | xfer->tx_dma = dma_map_single(dev, | 359 | xfer->tx_dma = dma_map_single(dev, |
356 | (void *) xfer->tx_buf, xfer->len, | 360 | nonconst_tx, xfer->len, |
357 | DMA_TO_DEVICE); | 361 | DMA_TO_DEVICE); |
358 | if (dma_mapping_error(dev, xfer->tx_dma)) | 362 | if (dma_mapping_error(dev, xfer->tx_dma)) |
359 | return -ENOMEM; | 363 | return -ENOMEM; |
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c index 90439314cf67..0838c79861e4 100644 --- a/drivers/spi/dw_spi.c +++ b/drivers/spi/dw_spi.c | |||
@@ -413,6 +413,11 @@ static void poll_transfer(struct dw_spi *dws) | |||
413 | { | 413 | { |
414 | while (dws->write(dws)) | 414 | while (dws->write(dws)) |
415 | dws->read(dws); | 415 | dws->read(dws); |
416 | /* | ||
417 | * There is a possibility that the last word of a transaction | ||
418 | * will be lost if data is not ready. Re-read to solve this issue. | ||
419 | */ | ||
420 | dws->read(dws); | ||
416 | 421 | ||
417 | transfer_complete(dws); | 422 | transfer_complete(dws); |
418 | } | 423 | } |
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index ec9f0b1bf864..84439f655601 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c | |||
@@ -563,7 +563,7 @@ static struct of_platform_driver mpc52xx_spi_of_driver = { | |||
563 | .of_match_table = mpc52xx_spi_match, | 563 | .of_match_table = mpc52xx_spi_match, |
564 | }, | 564 | }, |
565 | .probe = mpc52xx_spi_probe, | 565 | .probe = mpc52xx_spi_probe, |
566 | .remove = __exit_p(mpc52xx_spi_remove), | 566 | .remove = __devexit_p(mpc52xx_spi_remove), |
567 | }; | 567 | }; |
568 | 568 | ||
569 | static int __init mpc52xx_spi_init(void) | 569 | static int __init mpc52xx_spi_init(void) |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 709c836607de..b02d0cbce890 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -584,8 +584,7 @@ void spi_unregister_master(struct spi_master *master) | |||
584 | list_del(&master->list); | 584 | list_del(&master->list); |
585 | mutex_unlock(&board_lock); | 585 | mutex_unlock(&board_lock); |
586 | 586 | ||
587 | dummy = device_for_each_child(master->dev.parent, &master->dev, | 587 | dummy = device_for_each_child(&master->dev, NULL, __unregister); |
588 | __unregister); | ||
589 | device_unregister(&master->dev); | 588 | device_unregister(&master->dev); |
590 | } | 589 | } |
591 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 590 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
diff --git a/drivers/spi/spi_fsl_espi.c b/drivers/spi/spi_fsl_espi.c index e3b4f6451966..a99e2333b949 100644 --- a/drivers/spi/spi_fsl_espi.c +++ b/drivers/spi/spi_fsl_espi.c | |||
@@ -258,18 +258,18 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
258 | return mpc8xxx_spi->count; | 258 | return mpc8xxx_spi->count; |
259 | } | 259 | } |
260 | 260 | ||
261 | static void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd) | 261 | static inline void fsl_espi_addr2cmd(unsigned int addr, u8 *cmd) |
262 | { | 262 | { |
263 | if (cmd[1] && cmd[2] && cmd[3]) { | 263 | if (cmd) { |
264 | cmd[1] = (u8)(addr >> 16); | 264 | cmd[1] = (u8)(addr >> 16); |
265 | cmd[2] = (u8)(addr >> 8); | 265 | cmd[2] = (u8)(addr >> 8); |
266 | cmd[3] = (u8)(addr >> 0); | 266 | cmd[3] = (u8)(addr >> 0); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | static unsigned int fsl_espi_cmd2addr(u8 *cmd) | 270 | static inline unsigned int fsl_espi_cmd2addr(u8 *cmd) |
271 | { | 271 | { |
272 | if (cmd[1] && cmd[2] && cmd[3]) | 272 | if (cmd) |
273 | return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0; | 273 | return cmd[1] << 16 | cmd[2] << 8 | cmd[3] << 0; |
274 | 274 | ||
275 | return 0; | 275 | return 0; |
@@ -395,9 +395,11 @@ static void fsl_espi_rw_trans(struct spi_message *m, | |||
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | addr = fsl_espi_cmd2addr(local_buf); | 398 | if (pos > 0) { |
399 | addr += pos; | 399 | addr = fsl_espi_cmd2addr(local_buf); |
400 | fsl_espi_addr2cmd(addr, local_buf); | 400 | addr += pos; |
401 | fsl_espi_addr2cmd(addr, local_buf); | ||
402 | } | ||
401 | 403 | ||
402 | espi_trans->n_tx = n_tx; | 404 | espi_trans->n_tx = n_tx; |
403 | espi_trans->n_rx = trans_len; | 405 | espi_trans->n_rx = trans_len; |
@@ -507,16 +509,29 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | |||
507 | 509 | ||
508 | /* We need handle RX first */ | 510 | /* We need handle RX first */ |
509 | if (events & SPIE_NE) { | 511 | if (events & SPIE_NE) { |
510 | u32 rx_data; | 512 | u32 rx_data, tmp; |
513 | u8 rx_data_8; | ||
511 | 514 | ||
512 | /* Spin until RX is done */ | 515 | /* Spin until RX is done */ |
513 | while (SPIE_RXCNT(events) < min(4, mspi->len)) { | 516 | while (SPIE_RXCNT(events) < min(4, mspi->len)) { |
514 | cpu_relax(); | 517 | cpu_relax(); |
515 | events = mpc8xxx_spi_read_reg(®_base->event); | 518 | events = mpc8xxx_spi_read_reg(®_base->event); |
516 | } | 519 | } |
517 | mspi->len -= 4; | ||
518 | 520 | ||
519 | rx_data = mpc8xxx_spi_read_reg(®_base->receive); | 521 | if (mspi->len >= 4) { |
522 | rx_data = mpc8xxx_spi_read_reg(®_base->receive); | ||
523 | } else { | ||
524 | tmp = mspi->len; | ||
525 | rx_data = 0; | ||
526 | while (tmp--) { | ||
527 | rx_data_8 = in_8((u8 *)®_base->receive); | ||
528 | rx_data |= (rx_data_8 << (tmp * 8)); | ||
529 | } | ||
530 | |||
531 | rx_data <<= (4 - mspi->len) * 8; | ||
532 | } | ||
533 | |||
534 | mspi->len -= 4; | ||
520 | 535 | ||
521 | if (mspi->rx) | 536 | if (mspi->rx) |
522 | mspi->get_rx(rx_data, mspi); | 537 | mspi->get_rx(rx_data, mspi); |
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c index ef9c6a04ad8f..744d3f6e4709 100644 --- a/drivers/ssb/b43_pci_bridge.c +++ b/drivers/ssb/b43_pci_bridge.c | |||
@@ -24,6 +24,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { | |||
24 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, | 24 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, |
25 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, | 25 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, |
26 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, | 26 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, |
27 | { PCI_DEVICE(PCI_VENDOR_ID_BCM_GVC, 0x4318) }, | ||
27 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, | 28 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, |
28 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, | 29 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, |
29 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) }, | 30 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) }, |
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index 8c95d8c2a4f4..016c6f7f8630 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
@@ -620,13 +620,13 @@ static ssize_t class_set_picture(struct device *device, | |||
620 | 620 | ||
621 | #define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file | 621 | #define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file |
622 | 622 | ||
623 | static DEVICE_ATTR(asus_oled_enabled, S_IWUGO | S_IRUGO, | 623 | static DEVICE_ATTR(asus_oled_enabled, S_IWUSR | S_IRUGO, |
624 | get_enabled, set_enabled); | 624 | get_enabled, set_enabled); |
625 | static DEVICE_ATTR(asus_oled_picture, S_IWUGO , NULL, set_picture); | 625 | static DEVICE_ATTR(asus_oled_picture, S_IWUSR , NULL, set_picture); |
626 | 626 | ||
627 | static DEVICE_ATTR(enabled, S_IWUGO | S_IRUGO, | 627 | static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO, |
628 | class_get_enabled, class_set_enabled); | 628 | class_get_enabled, class_set_enabled); |
629 | static DEVICE_ATTR(picture, S_IWUGO, NULL, class_set_picture); | 629 | static DEVICE_ATTR(picture, S_IWUSR, NULL, class_set_picture); |
630 | 630 | ||
631 | static int asus_oled_probe(struct usb_interface *interface, | 631 | static int asus_oled_probe(struct usb_interface *interface, |
632 | const struct usb_device_id *id) | 632 | const struct usb_device_id *id) |
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c index b68a7e5173be..d85de82f941a 100644 --- a/drivers/staging/batman-adv/hard-interface.c +++ b/drivers/staging/batman-adv/hard-interface.c | |||
@@ -463,9 +463,6 @@ static void hardif_remove_interface(struct batman_if *batman_if) | |||
463 | return; | 463 | return; |
464 | 464 | ||
465 | batman_if->if_status = IF_TO_BE_REMOVED; | 465 | batman_if->if_status = IF_TO_BE_REMOVED; |
466 | |||
467 | /* caller must take if_list_lock */ | ||
468 | list_del_rcu(&batman_if->list); | ||
469 | synchronize_rcu(); | 466 | synchronize_rcu(); |
470 | sysfs_del_hardif(&batman_if->hardif_obj); | 467 | sysfs_del_hardif(&batman_if->hardif_obj); |
471 | hardif_put(batman_if); | 468 | hardif_put(batman_if); |
@@ -474,13 +471,21 @@ static void hardif_remove_interface(struct batman_if *batman_if) | |||
474 | void hardif_remove_interfaces(void) | 471 | void hardif_remove_interfaces(void) |
475 | { | 472 | { |
476 | struct batman_if *batman_if, *batman_if_tmp; | 473 | struct batman_if *batman_if, *batman_if_tmp; |
474 | struct list_head if_queue; | ||
475 | |||
476 | INIT_LIST_HEAD(&if_queue); | ||
477 | 477 | ||
478 | rtnl_lock(); | ||
479 | spin_lock(&if_list_lock); | 478 | spin_lock(&if_list_lock); |
480 | list_for_each_entry_safe(batman_if, batman_if_tmp, &if_list, list) { | 479 | list_for_each_entry_safe(batman_if, batman_if_tmp, &if_list, list) { |
481 | hardif_remove_interface(batman_if); | 480 | list_del_rcu(&batman_if->list); |
481 | list_add_tail(&batman_if->list, &if_queue); | ||
482 | } | 482 | } |
483 | spin_unlock(&if_list_lock); | 483 | spin_unlock(&if_list_lock); |
484 | |||
485 | rtnl_lock(); | ||
486 | list_for_each_entry_safe(batman_if, batman_if_tmp, &if_queue, list) { | ||
487 | hardif_remove_interface(batman_if); | ||
488 | } | ||
484 | rtnl_unlock(); | 489 | rtnl_unlock(); |
485 | } | 490 | } |
486 | 491 | ||
@@ -507,8 +512,10 @@ static int hard_if_event(struct notifier_block *this, | |||
507 | break; | 512 | break; |
508 | case NETDEV_UNREGISTER: | 513 | case NETDEV_UNREGISTER: |
509 | spin_lock(&if_list_lock); | 514 | spin_lock(&if_list_lock); |
510 | hardif_remove_interface(batman_if); | 515 | list_del_rcu(&batman_if->list); |
511 | spin_unlock(&if_list_lock); | 516 | spin_unlock(&if_list_lock); |
517 | |||
518 | hardif_remove_interface(batman_if); | ||
512 | break; | 519 | break; |
513 | case NETDEV_CHANGEMTU: | 520 | case NETDEV_CHANGEMTU: |
514 | if (batman_if->soft_iface) | 521 | if (batman_if->soft_iface) |
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c index 3904db9ce7b1..0e996181daf7 100644 --- a/drivers/staging/batman-adv/soft-interface.c +++ b/drivers/staging/batman-adv/soft-interface.c | |||
@@ -194,14 +194,15 @@ void interface_rx(struct net_device *soft_iface, | |||
194 | struct bat_priv *priv = netdev_priv(soft_iface); | 194 | struct bat_priv *priv = netdev_priv(soft_iface); |
195 | 195 | ||
196 | /* check if enough space is available for pulling, and pull */ | 196 | /* check if enough space is available for pulling, and pull */ |
197 | if (!pskb_may_pull(skb, hdr_size)) { | 197 | if (!pskb_may_pull(skb, hdr_size)) |
198 | kfree_skb(skb); | 198 | goto dropped; |
199 | return; | 199 | |
200 | } | ||
201 | skb_pull_rcsum(skb, hdr_size); | 200 | skb_pull_rcsum(skb, hdr_size); |
202 | /* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ | 201 | /* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ |
203 | 202 | ||
204 | /* skb->dev & skb->pkt_type are set here */ | 203 | /* skb->dev & skb->pkt_type are set here */ |
204 | if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) | ||
205 | goto dropped; | ||
205 | skb->protocol = eth_type_trans(skb, soft_iface); | 206 | skb->protocol = eth_type_trans(skb, soft_iface); |
206 | 207 | ||
207 | /* should not be neccesary anymore as we use skb_pull_rcsum() | 208 | /* should not be neccesary anymore as we use skb_pull_rcsum() |
@@ -216,6 +217,11 @@ void interface_rx(struct net_device *soft_iface, | |||
216 | soft_iface->last_rx = jiffies; | 217 | soft_iface->last_rx = jiffies; |
217 | 218 | ||
218 | netif_rx(skb); | 219 | netif_rx(skb); |
220 | return; | ||
221 | |||
222 | dropped: | ||
223 | kfree_skb(skb); | ||
224 | return; | ||
219 | } | 225 | } |
220 | 226 | ||
221 | #ifdef HAVE_NET_DEVICE_OPS | 227 | #ifdef HAVE_NET_DEVICE_OPS |
diff --git a/drivers/staging/brcm80211/README b/drivers/staging/brcm80211/README index c8f1cf1b4409..a27bb0b4f581 100644 --- a/drivers/staging/brcm80211/README +++ b/drivers/staging/brcm80211/README | |||
@@ -88,7 +88,9 @@ with the driver. | |||
88 | 88 | ||
89 | Contact Info: | 89 | Contact Info: |
90 | ============= | 90 | ============= |
91 | Brett Rudley brudley@broadcom.com | 91 | Brett Rudley brudley@broadcom.com |
92 | Henry Ptasinski henryp@broadcom.com | 92 | Henry Ptasinski henryp@broadcom.com |
93 | Dowan Kim dowan@broadcom.com | 93 | Dowan Kim dowan@broadcom.com |
94 | Roland Vossen rvossen@broadcom.com | ||
95 | Arend van Spriel arend@broadcom.com | ||
94 | 96 | ||
diff --git a/drivers/staging/brcm80211/TODO b/drivers/staging/brcm80211/TODO index dbf904184899..24ebadbe4241 100644 --- a/drivers/staging/brcm80211/TODO +++ b/drivers/staging/brcm80211/TODO | |||
@@ -46,4 +46,6 @@ Contact | |||
46 | Brett Rudley <brudley@broadcom.com> | 46 | Brett Rudley <brudley@broadcom.com> |
47 | Henry Ptasinski <henryp@broadcom.com> | 47 | Henry Ptasinski <henryp@broadcom.com> |
48 | Dowan Kim <dowan@broadcom.com> | 48 | Dowan Kim <dowan@broadcom.com> |
49 | Roland Vossen <rvossen@broadcom.com> | ||
50 | Arend van Spriel <arend@broadcom.com> | ||
49 | 51 | ||
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 1f177a67ff11..de784ff08caa 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c | |||
@@ -2295,8 +2295,8 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) | |||
2295 | usbduxsub_tmp->inBuffer = NULL; | 2295 | usbduxsub_tmp->inBuffer = NULL; |
2296 | kfree(usbduxsub_tmp->insnBuffer); | 2296 | kfree(usbduxsub_tmp->insnBuffer); |
2297 | usbduxsub_tmp->insnBuffer = NULL; | 2297 | usbduxsub_tmp->insnBuffer = NULL; |
2298 | kfree(usbduxsub_tmp->inBuffer); | 2298 | kfree(usbduxsub_tmp->outBuffer); |
2299 | usbduxsub_tmp->inBuffer = NULL; | 2299 | usbduxsub_tmp->outBuffer = NULL; |
2300 | kfree(usbduxsub_tmp->dac_commands); | 2300 | kfree(usbduxsub_tmp->dac_commands); |
2301 | usbduxsub_tmp->dac_commands = NULL; | 2301 | usbduxsub_tmp->dac_commands = NULL; |
2302 | kfree(usbduxsub_tmp->dux_commands); | 2302 | kfree(usbduxsub_tmp->dux_commands); |
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index e7f1d5778cec..52389308f333 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c | |||
@@ -92,7 +92,7 @@ int cx25821_get_format_size(void) | |||
92 | return ARRAY_SIZE(formats); | 92 | return ARRAY_SIZE(formats); |
93 | } | 93 | } |
94 | 94 | ||
95 | struct cx25821_fmt *format_by_fourcc(unsigned int fourcc) | 95 | struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc) |
96 | { | 96 | { |
97 | unsigned int i; | 97 | unsigned int i; |
98 | 98 | ||
@@ -848,7 +848,7 @@ static int video_open(struct file *file) | |||
848 | pix_format = | 848 | pix_format = |
849 | (dev->channels[ch_id].pixel_formats == | 849 | (dev->channels[ch_id].pixel_formats == |
850 | PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; | 850 | PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; |
851 | fh->fmt = format_by_fourcc(pix_format); | 851 | fh->fmt = cx25821_format_by_fourcc(pix_format); |
852 | 852 | ||
853 | v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); | 853 | v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); |
854 | 854 | ||
@@ -1010,7 +1010,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1010 | if (0 != err) | 1010 | if (0 != err) |
1011 | return err; | 1011 | return err; |
1012 | 1012 | ||
1013 | fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 1013 | fh->fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); |
1014 | fh->vidq.field = f->fmt.pix.field; | 1014 | fh->vidq.field = f->fmt.pix.field; |
1015 | 1015 | ||
1016 | /* check if width and height is valid based on set standard */ | 1016 | /* check if width and height is valid based on set standard */ |
@@ -1119,7 +1119,7 @@ int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fo | |||
1119 | enum v4l2_field field; | 1119 | enum v4l2_field field; |
1120 | unsigned int maxw, maxh; | 1120 | unsigned int maxw, maxh; |
1121 | 1121 | ||
1122 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 1122 | fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); |
1123 | if (NULL == fmt) | 1123 | if (NULL == fmt) |
1124 | return -EINVAL; | 1124 | return -EINVAL; |
1125 | 1125 | ||
diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h index cc6034b1a95d..a2415d33235b 100644 --- a/drivers/staging/cx25821/cx25821-video.h +++ b/drivers/staging/cx25821/cx25821-video.h | |||
@@ -87,7 +87,7 @@ extern unsigned int vid_limit; | |||
87 | 87 | ||
88 | #define FORMAT_FLAGS_PACKED 0x01 | 88 | #define FORMAT_FLAGS_PACKED 0x01 |
89 | extern struct cx25821_fmt formats[]; | 89 | extern struct cx25821_fmt formats[]; |
90 | extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc); | 90 | extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc); |
91 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; | 91 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; |
92 | 92 | ||
93 | extern void cx25821_dump_video_queue(struct cx25821_dev *dev, | 93 | extern void cx25821_dump_video_queue(struct cx25821_dev *dev, |
diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h index 25961c23dc0f..884263b2775d 100644 --- a/drivers/staging/easycap/easycap.h +++ b/drivers/staging/easycap/easycap.h | |||
@@ -75,6 +75,7 @@ | |||
75 | #include <linux/errno.h> | 75 | #include <linux/errno.h> |
76 | #include <linux/init.h> | 76 | #include <linux/init.h> |
77 | #include <linux/slab.h> | 77 | #include <linux/slab.h> |
78 | #include <linux/smp_lock.h> | ||
78 | #include <linux/module.h> | 79 | #include <linux/module.h> |
79 | #include <linux/kref.h> | 80 | #include <linux/kref.h> |
80 | #include <linux/usb.h> | 81 | #include <linux/usb.h> |
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index a145a15cfdb3..8894ab14f167 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c | |||
@@ -204,7 +204,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) | |||
204 | t->value = temp; \ | 204 | t->value = temp; \ |
205 | return count; \ | 205 | return count; \ |
206 | } \ | 206 | } \ |
207 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); | 207 | static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value); |
208 | 208 | ||
209 | show_int(enable); | 209 | show_int(enable); |
210 | show_int(offline); | 210 | show_int(offline); |
diff --git a/drivers/staging/go7007/go7007-driver.c b/drivers/staging/go7007/go7007-driver.c index b3f42f37a313..48d4e483d8a4 100644 --- a/drivers/staging/go7007/go7007-driver.c +++ b/drivers/staging/go7007/go7007-driver.c | |||
@@ -199,7 +199,7 @@ static int init_i2c_module(struct i2c_adapter *adapter, const char *type, | |||
199 | struct go7007 *go = i2c_get_adapdata(adapter); | 199 | struct go7007 *go = i2c_get_adapdata(adapter); |
200 | struct v4l2_device *v4l2_dev = &go->v4l2_dev; | 200 | struct v4l2_device *v4l2_dev = &go->v4l2_dev; |
201 | 201 | ||
202 | if (v4l2_i2c_new_subdev(v4l2_dev, adapter, NULL, type, addr, NULL)) | 202 | if (v4l2_i2c_new_subdev(v4l2_dev, adapter, type, addr, NULL)) |
203 | return 0; | 203 | return 0; |
204 | 204 | ||
205 | printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", type); | 205 | printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", type); |
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index c86d1498737d..1c1e98aee2d9 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c | |||
@@ -507,7 +507,7 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, | |||
507 | adis16220_write_reset, 0); | 507 | adis16220_write_reset, 0); |
508 | 508 | ||
509 | #define IIO_DEV_ATTR_CAPTURE(_store) \ | 509 | #define IIO_DEV_ATTR_CAPTURE(_store) \ |
510 | IIO_DEVICE_ATTR(capture, S_IWUGO, NULL, _store, 0) | 510 | IIO_DEVICE_ATTR(capture, S_IWUSR, NULL, _store, 0) |
511 | 511 | ||
512 | static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture); | 512 | static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture); |
513 | 513 | ||
diff --git a/drivers/staging/intel_sst/intel_sst_stream_encoded.c b/drivers/staging/intel_sst/intel_sst_stream_encoded.c index fbae39fda5c0..5c455608b024 100644 --- a/drivers/staging/intel_sst/intel_sst_stream_encoded.c +++ b/drivers/staging/intel_sst/intel_sst_stream_encoded.c | |||
@@ -1269,7 +1269,7 @@ finish: | |||
1269 | dbufs->output_bytes_produced = total_output; | 1269 | dbufs->output_bytes_produced = total_output; |
1270 | str_info->status = str_info->prev; | 1270 | str_info->status = str_info->prev; |
1271 | str_info->prev = STREAM_DECODE; | 1271 | str_info->prev = STREAM_DECODE; |
1272 | str_info->decode_ibuf = NULL; | ||
1273 | kfree(str_info->decode_ibuf); | 1272 | kfree(str_info->decode_ibuf); |
1273 | str_info->decode_ibuf = NULL; | ||
1274 | return retval; | 1274 | return retval; |
1275 | } | 1275 | } |
diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c index 040e25ca6d33..67e23b6e2d35 100644 --- a/drivers/staging/line6/control.c +++ b/drivers/staging/line6/control.c | |||
@@ -266,210 +266,210 @@ VARIAX_PARAM_R(float, mix2); | |||
266 | VARIAX_PARAM_R(float, mix1); | 266 | VARIAX_PARAM_R(float, mix1); |
267 | VARIAX_PARAM_R(int, pickup_wiring); | 267 | VARIAX_PARAM_R(int, pickup_wiring); |
268 | 268 | ||
269 | static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak); | 269 | static DEVICE_ATTR(tweak, S_IWUSR | S_IRUGO, pod_get_tweak, pod_set_tweak); |
270 | static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, | 270 | static DEVICE_ATTR(wah_position, S_IWUSR | S_IRUGO, pod_get_wah_position, |
271 | pod_set_wah_position); | 271 | pod_set_wah_position); |
272 | static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, | 272 | static DEVICE_ATTR(compression_gain, S_IWUSR | S_IRUGO, |
273 | pod_get_compression_gain, pod_set_compression_gain); | 273 | pod_get_compression_gain, pod_set_compression_gain); |
274 | static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, | 274 | static DEVICE_ATTR(vol_pedal_position, S_IWUSR | S_IRUGO, |
275 | pod_get_vol_pedal_position, pod_set_vol_pedal_position); | 275 | pod_get_vol_pedal_position, pod_set_vol_pedal_position); |
276 | static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, | 276 | static DEVICE_ATTR(compression_threshold, S_IWUSR | S_IRUGO, |
277 | pod_get_compression_threshold, | 277 | pod_get_compression_threshold, |
278 | pod_set_compression_threshold); | 278 | pod_set_compression_threshold); |
279 | static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan); | 279 | static DEVICE_ATTR(pan, S_IWUSR | S_IRUGO, pod_get_pan, pod_set_pan); |
280 | static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, | 280 | static DEVICE_ATTR(amp_model_setup, S_IWUSR | S_IRUGO, pod_get_amp_model_setup, |
281 | pod_set_amp_model_setup); | 281 | pod_set_amp_model_setup); |
282 | static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, | 282 | static DEVICE_ATTR(amp_model, S_IWUSR | S_IRUGO, pod_get_amp_model, |
283 | pod_set_amp_model); | 283 | pod_set_amp_model); |
284 | static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive); | 284 | static DEVICE_ATTR(drive, S_IWUSR | S_IRUGO, pod_get_drive, pod_set_drive); |
285 | static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass); | 285 | static DEVICE_ATTR(bass, S_IWUSR | S_IRUGO, pod_get_bass, pod_set_bass); |
286 | static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid); | 286 | static DEVICE_ATTR(mid, S_IWUSR | S_IRUGO, pod_get_mid, pod_set_mid); |
287 | static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid); | 287 | static DEVICE_ATTR(lowmid, S_IWUSR | S_IRUGO, pod_get_lowmid, pod_set_lowmid); |
288 | static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble); | 288 | static DEVICE_ATTR(treble, S_IWUSR | S_IRUGO, pod_get_treble, pod_set_treble); |
289 | static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, | 289 | static DEVICE_ATTR(highmid, S_IWUSR | S_IRUGO, pod_get_highmid, |
290 | pod_set_highmid); | 290 | pod_set_highmid); |
291 | static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, | 291 | static DEVICE_ATTR(chan_vol, S_IWUSR | S_IRUGO, pod_get_chan_vol, |
292 | pod_set_chan_vol); | 292 | pod_set_chan_vol); |
293 | static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, | 293 | static DEVICE_ATTR(reverb_mix, S_IWUSR | S_IRUGO, pod_get_reverb_mix, |
294 | pod_set_reverb_mix); | 294 | pod_set_reverb_mix); |
295 | static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, | 295 | static DEVICE_ATTR(effect_setup, S_IWUSR | S_IRUGO, pod_get_effect_setup, |
296 | pod_set_effect_setup); | 296 | pod_set_effect_setup); |
297 | static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, | 297 | static DEVICE_ATTR(band_1_frequency, S_IWUSR | S_IRUGO, |
298 | pod_get_band_1_frequency, pod_set_band_1_frequency); | 298 | pod_get_band_1_frequency, pod_set_band_1_frequency); |
299 | static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, | 299 | static DEVICE_ATTR(presence, S_IWUSR | S_IRUGO, pod_get_presence, |
300 | pod_set_presence); | 300 | pod_set_presence); |
301 | static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, | 301 | static DEVICE_ATTR2(treble__bass, treble, S_IWUSR | S_IRUGO, |
302 | pod_get_treble__bass, pod_set_treble__bass); | 302 | pod_get_treble__bass, pod_set_treble__bass); |
303 | static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, | 303 | static DEVICE_ATTR(noise_gate_enable, S_IWUSR | S_IRUGO, |
304 | pod_get_noise_gate_enable, pod_set_noise_gate_enable); | 304 | pod_get_noise_gate_enable, pod_set_noise_gate_enable); |
305 | static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, | 305 | static DEVICE_ATTR(gate_threshold, S_IWUSR | S_IRUGO, pod_get_gate_threshold, |
306 | pod_set_gate_threshold); | 306 | pod_set_gate_threshold); |
307 | static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, | 307 | static DEVICE_ATTR(gate_decay_time, S_IWUSR | S_IRUGO, pod_get_gate_decay_time, |
308 | pod_set_gate_decay_time); | 308 | pod_set_gate_decay_time); |
309 | static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, | 309 | static DEVICE_ATTR(stomp_enable, S_IWUSR | S_IRUGO, pod_get_stomp_enable, |
310 | pod_set_stomp_enable); | 310 | pod_set_stomp_enable); |
311 | static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, | 311 | static DEVICE_ATTR(comp_enable, S_IWUSR | S_IRUGO, pod_get_comp_enable, |
312 | pod_set_comp_enable); | 312 | pod_set_comp_enable); |
313 | static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, | 313 | static DEVICE_ATTR(stomp_time, S_IWUSR | S_IRUGO, pod_get_stomp_time, |
314 | pod_set_stomp_time); | 314 | pod_set_stomp_time); |
315 | static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, | 315 | static DEVICE_ATTR(delay_enable, S_IWUSR | S_IRUGO, pod_get_delay_enable, |
316 | pod_set_delay_enable); | 316 | pod_set_delay_enable); |
317 | static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, | 317 | static DEVICE_ATTR(mod_param_1, S_IWUSR | S_IRUGO, pod_get_mod_param_1, |
318 | pod_set_mod_param_1); | 318 | pod_set_mod_param_1); |
319 | static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, | 319 | static DEVICE_ATTR(delay_param_1, S_IWUSR | S_IRUGO, pod_get_delay_param_1, |
320 | pod_set_delay_param_1); | 320 | pod_set_delay_param_1); |
321 | static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, | 321 | static DEVICE_ATTR(delay_param_1_note_value, S_IWUSR | S_IRUGO, |
322 | pod_get_delay_param_1_note_value, | 322 | pod_get_delay_param_1_note_value, |
323 | pod_set_delay_param_1_note_value); | 323 | pod_set_delay_param_1_note_value); |
324 | static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, | 324 | static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUSR | S_IRUGO, |
325 | pod_get_band_2_frequency__bass, | 325 | pod_get_band_2_frequency__bass, |
326 | pod_set_band_2_frequency__bass); | 326 | pod_set_band_2_frequency__bass); |
327 | static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, | 327 | static DEVICE_ATTR(delay_param_2, S_IWUSR | S_IRUGO, pod_get_delay_param_2, |
328 | pod_set_delay_param_2); | 328 | pod_set_delay_param_2); |
329 | static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, | 329 | static DEVICE_ATTR(delay_volume_mix, S_IWUSR | S_IRUGO, |
330 | pod_get_delay_volume_mix, pod_set_delay_volume_mix); | 330 | pod_get_delay_volume_mix, pod_set_delay_volume_mix); |
331 | static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, | 331 | static DEVICE_ATTR(delay_param_3, S_IWUSR | S_IRUGO, pod_get_delay_param_3, |
332 | pod_set_delay_param_3); | 332 | pod_set_delay_param_3); |
333 | static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, | 333 | static DEVICE_ATTR(reverb_enable, S_IWUSR | S_IRUGO, pod_get_reverb_enable, |
334 | pod_set_reverb_enable); | 334 | pod_set_reverb_enable); |
335 | static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, | 335 | static DEVICE_ATTR(reverb_type, S_IWUSR | S_IRUGO, pod_get_reverb_type, |
336 | pod_set_reverb_type); | 336 | pod_set_reverb_type); |
337 | static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, | 337 | static DEVICE_ATTR(reverb_decay, S_IWUSR | S_IRUGO, pod_get_reverb_decay, |
338 | pod_set_reverb_decay); | 338 | pod_set_reverb_decay); |
339 | static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, | 339 | static DEVICE_ATTR(reverb_tone, S_IWUSR | S_IRUGO, pod_get_reverb_tone, |
340 | pod_set_reverb_tone); | 340 | pod_set_reverb_tone); |
341 | static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, | 341 | static DEVICE_ATTR(reverb_pre_delay, S_IWUSR | S_IRUGO, |
342 | pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); | 342 | pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); |
343 | static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, | 343 | static DEVICE_ATTR(reverb_pre_post, S_IWUSR | S_IRUGO, pod_get_reverb_pre_post, |
344 | pod_set_reverb_pre_post); | 344 | pod_set_reverb_pre_post); |
345 | static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, | 345 | static DEVICE_ATTR(band_2_frequency, S_IWUSR | S_IRUGO, |
346 | pod_get_band_2_frequency, pod_set_band_2_frequency); | 346 | pod_get_band_2_frequency, pod_set_band_2_frequency); |
347 | static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, | 347 | static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUSR | S_IRUGO, |
348 | pod_get_band_3_frequency__bass, | 348 | pod_get_band_3_frequency__bass, |
349 | pod_set_band_3_frequency__bass); | 349 | pod_set_band_3_frequency__bass); |
350 | static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, | 350 | static DEVICE_ATTR(wah_enable, S_IWUSR | S_IRUGO, pod_get_wah_enable, |
351 | pod_set_wah_enable); | 351 | pod_set_wah_enable); |
352 | static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, | 352 | static DEVICE_ATTR(modulation_lo_cut, S_IWUSR | S_IRUGO, |
353 | pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); | 353 | pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); |
354 | static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, | 354 | static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUSR | S_IRUGO, |
355 | pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); | 355 | pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); |
356 | static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, | 356 | static DEVICE_ATTR(volume_pedal_minimum, S_IWUSR | S_IRUGO, |
357 | pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); | 357 | pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); |
358 | static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, | 358 | static DEVICE_ATTR(eq_pre_post, S_IWUSR | S_IRUGO, pod_get_eq_pre_post, |
359 | pod_set_eq_pre_post); | 359 | pod_set_eq_pre_post); |
360 | static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, | 360 | static DEVICE_ATTR(volume_pre_post, S_IWUSR | S_IRUGO, pod_get_volume_pre_post, |
361 | pod_set_volume_pre_post); | 361 | pod_set_volume_pre_post); |
362 | static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, | 362 | static DEVICE_ATTR(di_model, S_IWUSR | S_IRUGO, pod_get_di_model, |
363 | pod_set_di_model); | 363 | pod_set_di_model); |
364 | static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, | 364 | static DEVICE_ATTR(di_delay, S_IWUSR | S_IRUGO, pod_get_di_delay, |
365 | pod_set_di_delay); | 365 | pod_set_di_delay); |
366 | static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, | 366 | static DEVICE_ATTR(mod_enable, S_IWUSR | S_IRUGO, pod_get_mod_enable, |
367 | pod_set_mod_enable); | 367 | pod_set_mod_enable); |
368 | static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, | 368 | static DEVICE_ATTR(mod_param_1_note_value, S_IWUSR | S_IRUGO, |
369 | pod_get_mod_param_1_note_value, | 369 | pod_get_mod_param_1_note_value, |
370 | pod_set_mod_param_1_note_value); | 370 | pod_set_mod_param_1_note_value); |
371 | static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, | 371 | static DEVICE_ATTR(mod_param_2, S_IWUSR | S_IRUGO, pod_get_mod_param_2, |
372 | pod_set_mod_param_2); | 372 | pod_set_mod_param_2); |
373 | static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, | 373 | static DEVICE_ATTR(mod_param_3, S_IWUSR | S_IRUGO, pod_get_mod_param_3, |
374 | pod_set_mod_param_3); | 374 | pod_set_mod_param_3); |
375 | static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, | 375 | static DEVICE_ATTR(mod_param_4, S_IWUSR | S_IRUGO, pod_get_mod_param_4, |
376 | pod_set_mod_param_4); | 376 | pod_set_mod_param_4); |
377 | static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, | 377 | static DEVICE_ATTR(mod_param_5, S_IWUSR | S_IRUGO, pod_get_mod_param_5, |
378 | pod_set_mod_param_5); | 378 | pod_set_mod_param_5); |
379 | static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, | 379 | static DEVICE_ATTR(mod_volume_mix, S_IWUSR | S_IRUGO, pod_get_mod_volume_mix, |
380 | pod_set_mod_volume_mix); | 380 | pod_set_mod_volume_mix); |
381 | static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, | 381 | static DEVICE_ATTR(mod_pre_post, S_IWUSR | S_IRUGO, pod_get_mod_pre_post, |
382 | pod_set_mod_pre_post); | 382 | pod_set_mod_pre_post); |
383 | static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, | 383 | static DEVICE_ATTR(modulation_model, S_IWUSR | S_IRUGO, |
384 | pod_get_modulation_model, pod_set_modulation_model); | 384 | pod_get_modulation_model, pod_set_modulation_model); |
385 | static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, | 385 | static DEVICE_ATTR(band_3_frequency, S_IWUSR | S_IRUGO, |
386 | pod_get_band_3_frequency, pod_set_band_3_frequency); | 386 | pod_get_band_3_frequency, pod_set_band_3_frequency); |
387 | static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, | 387 | static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUSR | S_IRUGO, |
388 | pod_get_band_4_frequency__bass, | 388 | pod_get_band_4_frequency__bass, |
389 | pod_set_band_4_frequency__bass); | 389 | pod_set_band_4_frequency__bass); |
390 | static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, | 390 | static DEVICE_ATTR(mod_param_1_double_precision, S_IWUSR | S_IRUGO, |
391 | pod_get_mod_param_1_double_precision, | 391 | pod_get_mod_param_1_double_precision, |
392 | pod_set_mod_param_1_double_precision); | 392 | pod_set_mod_param_1_double_precision); |
393 | static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, | 393 | static DEVICE_ATTR(delay_param_1_double_precision, S_IWUSR | S_IRUGO, |
394 | pod_get_delay_param_1_double_precision, | 394 | pod_get_delay_param_1_double_precision, |
395 | pod_set_delay_param_1_double_precision); | 395 | pod_set_delay_param_1_double_precision); |
396 | static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, | 396 | static DEVICE_ATTR(eq_enable, S_IWUSR | S_IRUGO, pod_get_eq_enable, |
397 | pod_set_eq_enable); | 397 | pod_set_eq_enable); |
398 | static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap); | 398 | static DEVICE_ATTR(tap, S_IWUSR | S_IRUGO, pod_get_tap, pod_set_tap); |
399 | static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, | 399 | static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUSR | S_IRUGO, |
400 | pod_get_volume_tweak_pedal_assign, | 400 | pod_get_volume_tweak_pedal_assign, |
401 | pod_set_volume_tweak_pedal_assign); | 401 | pod_set_volume_tweak_pedal_assign); |
402 | static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, | 402 | static DEVICE_ATTR(band_5_frequency, S_IWUSR | S_IRUGO, |
403 | pod_get_band_5_frequency, pod_set_band_5_frequency); | 403 | pod_get_band_5_frequency, pod_set_band_5_frequency); |
404 | static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner); | 404 | static DEVICE_ATTR(tuner, S_IWUSR | S_IRUGO, pod_get_tuner, pod_set_tuner); |
405 | static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, | 405 | static DEVICE_ATTR(mic_selection, S_IWUSR | S_IRUGO, pod_get_mic_selection, |
406 | pod_set_mic_selection); | 406 | pod_set_mic_selection); |
407 | static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, | 407 | static DEVICE_ATTR(cabinet_model, S_IWUSR | S_IRUGO, pod_get_cabinet_model, |
408 | pod_set_cabinet_model); | 408 | pod_set_cabinet_model); |
409 | static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, | 409 | static DEVICE_ATTR(stomp_model, S_IWUSR | S_IRUGO, pod_get_stomp_model, |
410 | pod_set_stomp_model); | 410 | pod_set_stomp_model); |
411 | static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, | 411 | static DEVICE_ATTR(roomlevel, S_IWUSR | S_IRUGO, pod_get_roomlevel, |
412 | pod_set_roomlevel); | 412 | pod_set_roomlevel); |
413 | static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, | 413 | static DEVICE_ATTR(band_4_frequency, S_IWUSR | S_IRUGO, |
414 | pod_get_band_4_frequency, pod_set_band_4_frequency); | 414 | pod_get_band_4_frequency, pod_set_band_4_frequency); |
415 | static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, | 415 | static DEVICE_ATTR(band_6_frequency, S_IWUSR | S_IRUGO, |
416 | pod_get_band_6_frequency, pod_set_band_6_frequency); | 416 | pod_get_band_6_frequency, pod_set_band_6_frequency); |
417 | static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, | 417 | static DEVICE_ATTR(stomp_param_1_note_value, S_IWUSR | S_IRUGO, |
418 | pod_get_stomp_param_1_note_value, | 418 | pod_get_stomp_param_1_note_value, |
419 | pod_set_stomp_param_1_note_value); | 419 | pod_set_stomp_param_1_note_value); |
420 | static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, | 420 | static DEVICE_ATTR(stomp_param_2, S_IWUSR | S_IRUGO, pod_get_stomp_param_2, |
421 | pod_set_stomp_param_2); | 421 | pod_set_stomp_param_2); |
422 | static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, | 422 | static DEVICE_ATTR(stomp_param_3, S_IWUSR | S_IRUGO, pod_get_stomp_param_3, |
423 | pod_set_stomp_param_3); | 423 | pod_set_stomp_param_3); |
424 | static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, | 424 | static DEVICE_ATTR(stomp_param_4, S_IWUSR | S_IRUGO, pod_get_stomp_param_4, |
425 | pod_set_stomp_param_4); | 425 | pod_set_stomp_param_4); |
426 | static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, | 426 | static DEVICE_ATTR(stomp_param_5, S_IWUSR | S_IRUGO, pod_get_stomp_param_5, |
427 | pod_set_stomp_param_5); | 427 | pod_set_stomp_param_5); |
428 | static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, | 428 | static DEVICE_ATTR(stomp_param_6, S_IWUSR | S_IRUGO, pod_get_stomp_param_6, |
429 | pod_set_stomp_param_6); | 429 | pod_set_stomp_param_6); |
430 | static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, | 430 | static DEVICE_ATTR(amp_switch_select, S_IWUSR | S_IRUGO, |
431 | pod_get_amp_switch_select, pod_set_amp_switch_select); | 431 | pod_get_amp_switch_select, pod_set_amp_switch_select); |
432 | static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, | 432 | static DEVICE_ATTR(delay_param_4, S_IWUSR | S_IRUGO, pod_get_delay_param_4, |
433 | pod_set_delay_param_4); | 433 | pod_set_delay_param_4); |
434 | static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, | 434 | static DEVICE_ATTR(delay_param_5, S_IWUSR | S_IRUGO, pod_get_delay_param_5, |
435 | pod_set_delay_param_5); | 435 | pod_set_delay_param_5); |
436 | static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, | 436 | static DEVICE_ATTR(delay_pre_post, S_IWUSR | S_IRUGO, pod_get_delay_pre_post, |
437 | pod_set_delay_pre_post); | 437 | pod_set_delay_pre_post); |
438 | static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, | 438 | static DEVICE_ATTR(delay_model, S_IWUSR | S_IRUGO, pod_get_delay_model, |
439 | pod_set_delay_model); | 439 | pod_set_delay_model); |
440 | static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, | 440 | static DEVICE_ATTR(delay_verb_model, S_IWUSR | S_IRUGO, |
441 | pod_get_delay_verb_model, pod_set_delay_verb_model); | 441 | pod_get_delay_verb_model, pod_set_delay_verb_model); |
442 | static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, | 442 | static DEVICE_ATTR(tempo_msb, S_IWUSR | S_IRUGO, pod_get_tempo_msb, |
443 | pod_set_tempo_msb); | 443 | pod_set_tempo_msb); |
444 | static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, | 444 | static DEVICE_ATTR(tempo_lsb, S_IWUSR | S_IRUGO, pod_get_tempo_lsb, |
445 | pod_set_tempo_lsb); | 445 | pod_set_tempo_lsb); |
446 | static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, | 446 | static DEVICE_ATTR(wah_model, S_IWUSR | S_IRUGO, pod_get_wah_model, |
447 | pod_set_wah_model); | 447 | pod_set_wah_model); |
448 | static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, | 448 | static DEVICE_ATTR(bypass_volume, S_IWUSR | S_IRUGO, pod_get_bypass_volume, |
449 | pod_set_bypass_volume); | 449 | pod_set_bypass_volume); |
450 | static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, | 450 | static DEVICE_ATTR(fx_loop_on_off, S_IWUSR | S_IRUGO, pod_get_fx_loop_on_off, |
451 | pod_set_fx_loop_on_off); | 451 | pod_set_fx_loop_on_off); |
452 | static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, | 452 | static DEVICE_ATTR(tweak_param_select, S_IWUSR | S_IRUGO, |
453 | pod_get_tweak_param_select, pod_set_tweak_param_select); | 453 | pod_get_tweak_param_select, pod_set_tweak_param_select); |
454 | static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, | 454 | static DEVICE_ATTR(amp1_engage, S_IWUSR | S_IRUGO, pod_get_amp1_engage, |
455 | pod_set_amp1_engage); | 455 | pod_set_amp1_engage); |
456 | static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, | 456 | static DEVICE_ATTR(band_1_gain, S_IWUSR | S_IRUGO, pod_get_band_1_gain, |
457 | pod_set_band_1_gain); | 457 | pod_set_band_1_gain); |
458 | static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, | 458 | static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUSR | S_IRUGO, |
459 | pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); | 459 | pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); |
460 | static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, | 460 | static DEVICE_ATTR(band_2_gain, S_IWUSR | S_IRUGO, pod_get_band_2_gain, |
461 | pod_set_band_2_gain); | 461 | pod_set_band_2_gain); |
462 | static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, | 462 | static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUSR | S_IRUGO, |
463 | pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); | 463 | pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); |
464 | static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, | 464 | static DEVICE_ATTR(band_3_gain, S_IWUSR | S_IRUGO, pod_get_band_3_gain, |
465 | pod_set_band_3_gain); | 465 | pod_set_band_3_gain); |
466 | static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, | 466 | static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUSR | S_IRUGO, |
467 | pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); | 467 | pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); |
468 | static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, | 468 | static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUSR | S_IRUGO, |
469 | pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); | 469 | pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); |
470 | static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, | 470 | static DEVICE_ATTR(band_4_gain, S_IWUSR | S_IRUGO, pod_get_band_4_gain, |
471 | pod_set_band_4_gain); | 471 | pod_set_band_4_gain); |
472 | static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, | 472 | static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUSR | S_IRUGO, |
473 | pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); | 473 | pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); |
474 | static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); | 474 | static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); |
475 | static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, | 475 | static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, |
diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c index 4304dfe6c166..ab67e889d2c4 100644 --- a/drivers/staging/line6/midi.c +++ b/drivers/staging/line6/midi.c | |||
@@ -350,9 +350,9 @@ static ssize_t midi_set_midi_mask_receive(struct device *dev, | |||
350 | return count; | 350 | return count; |
351 | } | 351 | } |
352 | 352 | ||
353 | static DEVICE_ATTR(midi_mask_transmit, S_IWUGO | S_IRUGO, | 353 | static DEVICE_ATTR(midi_mask_transmit, S_IWUSR | S_IRUGO, |
354 | midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); | 354 | midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); |
355 | static DEVICE_ATTR(midi_mask_receive, S_IWUGO | S_IRUGO, | 355 | static DEVICE_ATTR(midi_mask_receive, S_IWUSR | S_IRUGO, |
356 | midi_get_midi_mask_receive, midi_set_midi_mask_receive); | 356 | midi_get_midi_mask_receive, midi_set_midi_mask_receive); |
357 | 357 | ||
358 | /* MIDI device destructor */ | 358 | /* MIDI device destructor */ |
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c index e54770e34d2e..b9c55f9eb501 100644 --- a/drivers/staging/line6/pcm.c +++ b/drivers/staging/line6/pcm.c | |||
@@ -79,9 +79,9 @@ static ssize_t pcm_set_impulse_period(struct device *dev, | |||
79 | return count; | 79 | return count; |
80 | } | 80 | } |
81 | 81 | ||
82 | static DEVICE_ATTR(impulse_volume, S_IWUGO | S_IRUGO, pcm_get_impulse_volume, | 82 | static DEVICE_ATTR(impulse_volume, S_IWUSR | S_IRUGO, pcm_get_impulse_volume, |
83 | pcm_set_impulse_volume); | 83 | pcm_set_impulse_volume); |
84 | static DEVICE_ATTR(impulse_period, S_IWUGO | S_IRUGO, pcm_get_impulse_period, | 84 | static DEVICE_ATTR(impulse_period, S_IWUSR | S_IRUGO, pcm_get_impulse_period, |
85 | pcm_set_impulse_period); | 85 | pcm_set_impulse_period); |
86 | 86 | ||
87 | #endif | 87 | #endif |
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 22e2cedcacf7..d9b30212585c 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c | |||
@@ -1051,48 +1051,48 @@ POD_GET_SYSTEM_PARAM(tuner_pitch, 1); | |||
1051 | #undef GET_SYSTEM_PARAM | 1051 | #undef GET_SYSTEM_PARAM |
1052 | 1052 | ||
1053 | /* POD special files: */ | 1053 | /* POD special files: */ |
1054 | static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, | 1054 | static DEVICE_ATTR(channel, S_IWUSR | S_IRUGO, pod_get_channel, |
1055 | pod_set_channel); | 1055 | pod_set_channel); |
1056 | static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); | 1056 | static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); |
1057 | static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); | 1057 | static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); |
1058 | static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); | 1058 | static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); |
1059 | static DEVICE_ATTR(dump, S_IWUGO | S_IRUGO, pod_get_dump, pod_set_dump); | 1059 | static DEVICE_ATTR(dump, S_IWUSR | S_IRUGO, pod_get_dump, pod_set_dump); |
1060 | static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, | 1060 | static DEVICE_ATTR(dump_buf, S_IWUSR | S_IRUGO, pod_get_dump_buf, |
1061 | pod_set_dump_buf); | 1061 | pod_set_dump_buf); |
1062 | static DEVICE_ATTR(finish, S_IWUGO, line6_nop_read, pod_set_finish); | 1062 | static DEVICE_ATTR(finish, S_IWUSR, line6_nop_read, pod_set_finish); |
1063 | static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, | 1063 | static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, |
1064 | line6_nop_write); | 1064 | line6_nop_write); |
1065 | static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, | 1065 | static DEVICE_ATTR(midi_postprocess, S_IWUSR | S_IRUGO, |
1066 | pod_get_midi_postprocess, pod_set_midi_postprocess); | 1066 | pod_get_midi_postprocess, pod_set_midi_postprocess); |
1067 | static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, | 1067 | static DEVICE_ATTR(monitor_level, S_IWUSR | S_IRUGO, pod_get_monitor_level, |
1068 | pod_set_monitor_level); | 1068 | pod_set_monitor_level); |
1069 | static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); | 1069 | static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); |
1070 | static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); | 1070 | static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); |
1071 | static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, | 1071 | static DEVICE_ATTR(retrieve_amp_setup, S_IWUSR, line6_nop_read, |
1072 | pod_set_retrieve_amp_setup); | 1072 | pod_set_retrieve_amp_setup); |
1073 | static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, | 1073 | static DEVICE_ATTR(retrieve_channel, S_IWUSR, line6_nop_read, |
1074 | pod_set_retrieve_channel); | 1074 | pod_set_retrieve_channel); |
1075 | static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, | 1075 | static DEVICE_ATTR(retrieve_effects_setup, S_IWUSR, line6_nop_read, |
1076 | pod_set_retrieve_effects_setup); | 1076 | pod_set_retrieve_effects_setup); |
1077 | static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, | 1077 | static DEVICE_ATTR(routing, S_IWUSR | S_IRUGO, pod_get_routing, |
1078 | pod_set_routing); | 1078 | pod_set_routing); |
1079 | static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, | 1079 | static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, |
1080 | line6_nop_write); | 1080 | line6_nop_write); |
1081 | static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, | 1081 | static DEVICE_ATTR(store_amp_setup, S_IWUSR, line6_nop_read, |
1082 | pod_set_store_amp_setup); | 1082 | pod_set_store_amp_setup); |
1083 | static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, | 1083 | static DEVICE_ATTR(store_channel, S_IWUSR, line6_nop_read, |
1084 | pod_set_store_channel); | 1084 | pod_set_store_channel); |
1085 | static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, | 1085 | static DEVICE_ATTR(store_effects_setup, S_IWUSR, line6_nop_read, |
1086 | pod_set_store_effects_setup); | 1086 | pod_set_store_effects_setup); |
1087 | static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, | 1087 | static DEVICE_ATTR(tuner_freq, S_IWUSR | S_IRUGO, pod_get_tuner_freq, |
1088 | pod_set_tuner_freq); | 1088 | pod_set_tuner_freq); |
1089 | static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, | 1089 | static DEVICE_ATTR(tuner_mute, S_IWUSR | S_IRUGO, pod_get_tuner_mute, |
1090 | pod_set_tuner_mute); | 1090 | pod_set_tuner_mute); |
1091 | static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); | 1091 | static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); |
1092 | static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); | 1092 | static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); |
1093 | 1093 | ||
1094 | #ifdef CONFIG_LINE6_USB_RAW | 1094 | #ifdef CONFIG_LINE6_USB_RAW |
1095 | static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); | 1095 | static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw); |
1096 | #endif | 1096 | #endif |
1097 | 1097 | ||
1098 | /* control info callback */ | 1098 | /* control info callback */ |
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index 6a10b0f9749a..879e6992bbc6 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c | |||
@@ -154,9 +154,9 @@ static ssize_t toneport_set_led_green(struct device *dev, | |||
154 | return count; | 154 | return count; |
155 | } | 155 | } |
156 | 156 | ||
157 | static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read, | 157 | static DEVICE_ATTR(led_red, S_IWUSR | S_IRUGO, line6_nop_read, |
158 | toneport_set_led_red); | 158 | toneport_set_led_red); |
159 | static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, | 159 | static DEVICE_ATTR(led_green, S_IWUSR | S_IRUGO, line6_nop_read, |
160 | toneport_set_led_green); | 160 | toneport_set_led_green); |
161 | 161 | ||
162 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) | 162 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) |
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c index 894eee7f2317..81241cdf1be9 100644 --- a/drivers/staging/line6/variax.c +++ b/drivers/staging/line6/variax.c | |||
@@ -549,21 +549,21 @@ static ssize_t variax_set_raw2(struct device *dev, | |||
549 | #endif | 549 | #endif |
550 | 550 | ||
551 | /* Variax workbench special files: */ | 551 | /* Variax workbench special files: */ |
552 | static DEVICE_ATTR(model, S_IWUGO | S_IRUGO, variax_get_model, | 552 | static DEVICE_ATTR(model, S_IWUSR | S_IRUGO, variax_get_model, |
553 | variax_set_model); | 553 | variax_set_model); |
554 | static DEVICE_ATTR(volume, S_IWUGO | S_IRUGO, variax_get_volume, | 554 | static DEVICE_ATTR(volume, S_IWUSR | S_IRUGO, variax_get_volume, |
555 | variax_set_volume); | 555 | variax_set_volume); |
556 | static DEVICE_ATTR(tone, S_IWUGO | S_IRUGO, variax_get_tone, variax_set_tone); | 556 | static DEVICE_ATTR(tone, S_IWUSR | S_IRUGO, variax_get_tone, variax_set_tone); |
557 | static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); | 557 | static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); |
558 | static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); | 558 | static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); |
559 | static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); | 559 | static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); |
560 | static DEVICE_ATTR(active, S_IWUGO | S_IRUGO, variax_get_active, | 560 | static DEVICE_ATTR(active, S_IWUSR | S_IRUGO, variax_get_active, |
561 | variax_set_active); | 561 | variax_set_active); |
562 | static DEVICE_ATTR(guitar, S_IRUGO, variax_get_guitar, line6_nop_write); | 562 | static DEVICE_ATTR(guitar, S_IRUGO, variax_get_guitar, line6_nop_write); |
563 | 563 | ||
564 | #ifdef CONFIG_LINE6_USB_RAW | 564 | #ifdef CONFIG_LINE6_USB_RAW |
565 | static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); | 565 | static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw); |
566 | static DEVICE_ATTR(raw2, S_IWUGO, line6_nop_read, variax_set_raw2); | 566 | static DEVICE_ATTR(raw2, S_IWUSR, line6_nop_read, variax_set_raw2); |
567 | #endif | 567 | #endif |
568 | 568 | ||
569 | /* | 569 | /* |
diff --git a/drivers/staging/quickstart/quickstart.c b/drivers/staging/quickstart/quickstart.c index d746715d3d89..d83bec876d2e 100644 --- a/drivers/staging/quickstart/quickstart.c +++ b/drivers/staging/quickstart/quickstart.c | |||
@@ -355,7 +355,6 @@ static int quickstart_acpi_remove(struct acpi_device *device, int type) | |||
355 | static void quickstart_exit(void) | 355 | static void quickstart_exit(void) |
356 | { | 356 | { |
357 | input_unregister_device(quickstart_input); | 357 | input_unregister_device(quickstart_input); |
358 | input_free_device(quickstart_input); | ||
359 | 358 | ||
360 | device_remove_file(&pf_device->dev, &dev_attr_pressed_button); | 359 | device_remove_file(&pf_device->dev, &dev_attr_pressed_button); |
361 | device_remove_file(&pf_device->dev, &dev_attr_buttons); | 360 | device_remove_file(&pf_device->dev, &dev_attr_buttons); |
@@ -375,6 +374,7 @@ static int __init quickstart_init_input(void) | |||
375 | { | 374 | { |
376 | struct quickstart_btn **ptr = &quickstart_data.btn_lst; | 375 | struct quickstart_btn **ptr = &quickstart_data.btn_lst; |
377 | int count; | 376 | int count; |
377 | int ret; | ||
378 | 378 | ||
379 | quickstart_input = input_allocate_device(); | 379 | quickstart_input = input_allocate_device(); |
380 | 380 | ||
@@ -391,7 +391,13 @@ static int __init quickstart_init_input(void) | |||
391 | ptr = &((*ptr)->next); | 391 | ptr = &((*ptr)->next); |
392 | } | 392 | } |
393 | 393 | ||
394 | return input_register_device(quickstart_input); | 394 | ret = input_register_device(quickstart_input); |
395 | if (ret) { | ||
396 | input_free_device(quickstart_input); | ||
397 | return ret; | ||
398 | } | ||
399 | |||
400 | return 0; | ||
395 | } | 401 | } |
396 | 402 | ||
397 | static int __init quickstart_init(void) | 403 | static int __init quickstart_init(void) |
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index ddacfc6c4861..cd15daae5412 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c | |||
@@ -182,6 +182,7 @@ struct usb_device_id rtusb_usb_id[] = { | |||
182 | {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ | 182 | {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ |
183 | {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ | 183 | {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ |
184 | {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ | 184 | {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ |
185 | {USB_DEVICE(0x0411, 0x015D)}, /* Buffalo Airstation WLI-UC-GN */ | ||
185 | {} /* Terminating entry */ | 186 | {} /* Terminating entry */ |
186 | }; | 187 | }; |
187 | 188 | ||
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c index 46000d72f4c4..3bdf9b31cc4e 100644 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ b/drivers/staging/rtl8187se/r8185b_init.c | |||
@@ -264,8 +264,12 @@ HwHSSIThreeWire( | |||
264 | 264 | ||
265 | udelay(10); | 265 | udelay(10); |
266 | } | 266 | } |
267 | if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) | 267 | if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { |
268 | panic("HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n", u1bTmp); | 268 | printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" |
269 | " %#X RE|WE bits are not clear!!\n", u1bTmp); | ||
270 | dump_stack(); | ||
271 | return 0; | ||
272 | } | ||
269 | 273 | ||
270 | /* RTL8187S HSSI Read/Write Function */ | 274 | /* RTL8187S HSSI Read/Write Function */ |
271 | u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); | 275 | u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); |
@@ -298,13 +302,23 @@ HwHSSIThreeWire( | |||
298 | int idx; | 302 | int idx; |
299 | int ByteCnt = nDataBufBitCnt / 8; | 303 | int ByteCnt = nDataBufBitCnt / 8; |
300 | /* printk("%d\n",nDataBufBitCnt); */ | 304 | /* printk("%d\n",nDataBufBitCnt); */ |
301 | if ((nDataBufBitCnt % 8) != 0) | 305 | if ((nDataBufBitCnt % 8) != 0) { |
302 | panic("HwThreeWire(): nDataBufBitCnt(%d) should be multiple of 8!!!\n", | 306 | printk(KERN_ERR "rtl8187se: " |
303 | nDataBufBitCnt); | 307 | "HwThreeWire(): nDataBufBitCnt(%d)" |
308 | " should be multiple of 8!!!\n", | ||
309 | nDataBufBitCnt); | ||
310 | dump_stack(); | ||
311 | nDataBufBitCnt += 8; | ||
312 | nDataBufBitCnt &= ~7; | ||
313 | } | ||
304 | 314 | ||
305 | if (nDataBufBitCnt > 64) | 315 | if (nDataBufBitCnt > 64) { |
306 | panic("HwThreeWire(): nDataBufBitCnt(%d) should <= 64!!!\n", | 316 | printk(KERN_ERR "rtl8187se: HwThreeWire():" |
307 | nDataBufBitCnt); | 317 | " nDataBufBitCnt(%d) should <= 64!!!\n", |
318 | nDataBufBitCnt); | ||
319 | dump_stack(); | ||
320 | nDataBufBitCnt = 64; | ||
321 | } | ||
308 | 322 | ||
309 | for (idx = 0; idx < ByteCnt; idx++) | 323 | for (idx = 0; idx < ByteCnt; idx++) |
310 | write_nic_byte(dev, (SW_3W_DB0+idx), *(pDataBuf+idx)); | 324 | write_nic_byte(dev, (SW_3W_DB0+idx), *(pDataBuf+idx)); |
diff --git a/drivers/staging/rtl8712/usb_halinit.c b/drivers/staging/rtl8712/usb_halinit.c index f6569dce3012..0e9483bbabe1 100644 --- a/drivers/staging/rtl8712/usb_halinit.c +++ b/drivers/staging/rtl8712/usb_halinit.c | |||
@@ -37,7 +37,7 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter) | |||
37 | { | 37 | { |
38 | u8 val8 = 0; | 38 | u8 val8 = 0; |
39 | u8 ret = _SUCCESS; | 39 | u8 ret = _SUCCESS; |
40 | u8 PollingCnt = 20; | 40 | int PollingCnt = 20; |
41 | struct registry_priv *pregistrypriv = &padapter->registrypriv; | 41 | struct registry_priv *pregistrypriv = &padapter->registrypriv; |
42 | 42 | ||
43 | if (pregistrypriv->chip_version == RTL8712_FPGA) { | 43 | if (pregistrypriv->chip_version == RTL8712_FPGA) { |
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c index eb44b60e1eb5..ac2bf11e1119 100644 --- a/drivers/staging/samsung-laptop/samsung-laptop.c +++ b/drivers/staging/samsung-laptop/samsung-laptop.c | |||
@@ -356,7 +356,7 @@ static ssize_t set_silent_state(struct device *dev, | |||
356 | } | 356 | } |
357 | return count; | 357 | return count; |
358 | } | 358 | } |
359 | static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO, | 359 | static DEVICE_ATTR(silent, S_IWUSR | S_IRUGO, |
360 | get_silent_state, set_silent_state); | 360 | get_silent_state, set_silent_state); |
361 | 361 | ||
362 | 362 | ||
diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c index adb93f21c0d6..65b231178f05 100644 --- a/drivers/staging/speakup/fakekey.c +++ b/drivers/staging/speakup/fakekey.c | |||
@@ -62,7 +62,6 @@ void speakup_remove_virtual_keyboard(void) | |||
62 | { | 62 | { |
63 | if (virt_keyboard != NULL) { | 63 | if (virt_keyboard != NULL) { |
64 | input_unregister_device(virt_keyboard); | 64 | input_unregister_device(virt_keyboard); |
65 | input_free_device(virt_keyboard); | ||
66 | virt_keyboard = NULL; | 65 | virt_keyboard = NULL; |
67 | } | 66 | } |
68 | } | 67 | } |
diff --git a/drivers/staging/spectra/ffsport.c b/drivers/staging/spectra/ffsport.c index c7932da03c56..63a9d0adf32d 100644 --- a/drivers/staging/spectra/ffsport.c +++ b/drivers/staging/spectra/ffsport.c | |||
@@ -656,7 +656,7 @@ static int SBD_setup_device(struct spectra_nand_dev *dev, int which) | |||
656 | /* Here we force report 512 byte hardware sector size to Kernel */ | 656 | /* Here we force report 512 byte hardware sector size to Kernel */ |
657 | blk_queue_logical_block_size(dev->queue, 512); | 657 | blk_queue_logical_block_size(dev->queue, 512); |
658 | 658 | ||
659 | blk_queue_ordered(dev->queue, QUEUE_ORDERED_DRAIN_FLUSH); | 659 | blk_queue_flush(dev->queue, REQ_FLUSH); |
660 | 660 | ||
661 | dev->thread = kthread_run(spectra_trans_thread, dev, "nand_thd"); | 661 | dev->thread = kthread_run(spectra_trans_thread, dev, "nand_thd"); |
662 | if (IS_ERR(dev->thread)) { | 662 | if (IS_ERR(dev->thread)) { |
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 664e6038090d..b143258f094a 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c | |||
@@ -545,7 +545,7 @@ static void tm6000_config_tuner(struct tm6000_core *dev) | |||
545 | 545 | ||
546 | /* Load tuner module */ | 546 | /* Load tuner module */ |
547 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 547 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
548 | NULL, "tuner", dev->tuner_addr, NULL); | 548 | "tuner", dev->tuner_addr, NULL); |
549 | 549 | ||
550 | memset(&tun_setup, 0, sizeof(tun_setup)); | 550 | memset(&tun_setup, 0, sizeof(tun_setup)); |
551 | tun_setup.type = dev->tuner_type; | 551 | tun_setup.type = dev->tuner_type; |
@@ -683,7 +683,7 @@ static int tm6000_init_dev(struct tm6000_core *dev) | |||
683 | 683 | ||
684 | if (dev->caps.has_tda9874) | 684 | if (dev->caps.has_tda9874) |
685 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 685 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
686 | NULL, "tvaudio", I2C_ADDR_TDA9874, NULL); | 686 | "tvaudio", I2C_ADDR_TDA9874, NULL); |
687 | 687 | ||
688 | /* register and initialize V4L2 */ | 688 | /* register and initialize V4L2 */ |
689 | rc = tm6000_v4l2_register(dev); | 689 | rc = tm6000_v4l2_register(dev); |
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c index fed25105970a..b7ac16005265 100644 --- a/drivers/staging/udlfb/udlfb.c +++ b/drivers/staging/udlfb/udlfb.c | |||
@@ -1441,7 +1441,7 @@ static struct device_attribute fb_device_attrs[] = { | |||
1441 | __ATTR_RO(metrics_bytes_identical), | 1441 | __ATTR_RO(metrics_bytes_identical), |
1442 | __ATTR_RO(metrics_bytes_sent), | 1442 | __ATTR_RO(metrics_bytes_sent), |
1443 | __ATTR_RO(metrics_cpu_kcycles_used), | 1443 | __ATTR_RO(metrics_cpu_kcycles_used), |
1444 | __ATTR(metrics_reset, S_IWUGO, NULL, metrics_reset_store), | 1444 | __ATTR(metrics_reset, S_IWUSR, NULL, metrics_reset_store), |
1445 | }; | 1445 | }; |
1446 | 1446 | ||
1447 | /* | 1447 | /* |
diff --git a/drivers/staging/winbond/sysdef.h b/drivers/staging/winbond/sysdef.h index 9195adf98e14..d0d71f69bc8c 100644 --- a/drivers/staging/winbond/sysdef.h +++ b/drivers/staging/winbond/sysdef.h | |||
@@ -2,6 +2,9 @@ | |||
2 | 2 | ||
3 | #ifndef SYS_DEF_H | 3 | #ifndef SYS_DEF_H |
4 | #define SYS_DEF_H | 4 | #define SYS_DEF_H |
5 | |||
6 | #include <linux/delay.h> | ||
7 | |||
5 | #define WB_LINUX | 8 | #define WB_LINUX |
6 | #define WB_LINUX_WPA_PSK | 9 | #define WB_LINUX_WPA_PSK |
7 | 10 | ||
diff --git a/drivers/staging/zram/zram_sysfs.c b/drivers/staging/zram/zram_sysfs.c index 6c574a994d11..6b3cf00b0ff4 100644 --- a/drivers/staging/zram/zram_sysfs.c +++ b/drivers/staging/zram/zram_sysfs.c | |||
@@ -189,10 +189,10 @@ static ssize_t mem_used_total_show(struct device *dev, | |||
189 | return sprintf(buf, "%llu\n", val); | 189 | return sprintf(buf, "%llu\n", val); |
190 | } | 190 | } |
191 | 191 | ||
192 | static DEVICE_ATTR(disksize, S_IRUGO | S_IWUGO, | 192 | static DEVICE_ATTR(disksize, S_IRUGO | S_IWUSR, |
193 | disksize_show, disksize_store); | 193 | disksize_show, disksize_store); |
194 | static DEVICE_ATTR(initstate, S_IRUGO, initstate_show, NULL); | 194 | static DEVICE_ATTR(initstate, S_IRUGO, initstate_show, NULL); |
195 | static DEVICE_ATTR(reset, S_IWUGO, NULL, reset_store); | 195 | static DEVICE_ATTR(reset, S_IWUSR, NULL, reset_store); |
196 | static DEVICE_ATTR(num_reads, S_IRUGO, num_reads_show, NULL); | 196 | static DEVICE_ATTR(num_reads, S_IRUGO, num_reads_show, NULL); |
197 | static DEVICE_ATTR(num_writes, S_IRUGO, num_writes_show, NULL); | 197 | static DEVICE_ATTR(num_writes, S_IRUGO, num_writes_show, NULL); |
198 | static DEVICE_ATTR(invalid_io, S_IRUGO, invalid_io_show, NULL); | 198 | static DEVICE_ATTR(invalid_io, S_IRUGO, invalid_io_show, NULL); |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 81b46585edf7..c5f8e5bda2b2 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -716,8 +716,8 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) | |||
716 | if (msg->len < 128) | 716 | if (msg->len < 128) |
717 | *--dp = (msg->len << 1) | EA; | 717 | *--dp = (msg->len << 1) | EA; |
718 | else { | 718 | else { |
719 | *--dp = ((msg->len & 127) << 1) | EA; | 719 | *--dp = (msg->len >> 7); /* bits 7 - 15 */ |
720 | *--dp = (msg->len >> 6) & 0xfe; | 720 | *--dp = (msg->len & 127) << 1; /* bits 0 - 6 */ |
721 | } | 721 | } |
722 | } | 722 | } |
723 | 723 | ||
@@ -968,6 +968,8 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data, | |||
968 | { | 968 | { |
969 | struct gsm_msg *msg; | 969 | struct gsm_msg *msg; |
970 | msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype); | 970 | msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype); |
971 | if (msg == NULL) | ||
972 | return; | ||
971 | msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ | 973 | msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ |
972 | msg->data[1] = (dlen << 1) | EA; | 974 | msg->data[1] = (dlen << 1) | EA; |
973 | memcpy(msg->data + 2, data, dlen); | 975 | memcpy(msg->data + 2, data, dlen); |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index c05c5af5aa04..35480dd57a30 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -559,6 +559,9 @@ void __tty_hangup(struct tty_struct *tty) | |||
559 | 559 | ||
560 | tty_lock(); | 560 | tty_lock(); |
561 | 561 | ||
562 | /* some functions below drop BTM, so we need this bit */ | ||
563 | set_bit(TTY_HUPPING, &tty->flags); | ||
564 | |||
562 | /* inuse_filps is protected by the single tty lock, | 565 | /* inuse_filps is protected by the single tty lock, |
563 | this really needs to change if we want to flush the | 566 | this really needs to change if we want to flush the |
564 | workqueue with the lock held */ | 567 | workqueue with the lock held */ |
@@ -578,6 +581,10 @@ void __tty_hangup(struct tty_struct *tty) | |||
578 | } | 581 | } |
579 | spin_unlock(&tty_files_lock); | 582 | spin_unlock(&tty_files_lock); |
580 | 583 | ||
584 | /* | ||
585 | * it drops BTM and thus races with reopen | ||
586 | * we protect the race by TTY_HUPPING | ||
587 | */ | ||
581 | tty_ldisc_hangup(tty); | 588 | tty_ldisc_hangup(tty); |
582 | 589 | ||
583 | read_lock(&tasklist_lock); | 590 | read_lock(&tasklist_lock); |
@@ -615,7 +622,6 @@ void __tty_hangup(struct tty_struct *tty) | |||
615 | tty->session = NULL; | 622 | tty->session = NULL; |
616 | tty->pgrp = NULL; | 623 | tty->pgrp = NULL; |
617 | tty->ctrl_status = 0; | 624 | tty->ctrl_status = 0; |
618 | set_bit(TTY_HUPPED, &tty->flags); | ||
619 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 625 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
620 | 626 | ||
621 | /* Account for the p->signal references we killed */ | 627 | /* Account for the p->signal references we killed */ |
@@ -641,6 +647,7 @@ void __tty_hangup(struct tty_struct *tty) | |||
641 | * can't yet guarantee all that. | 647 | * can't yet guarantee all that. |
642 | */ | 648 | */ |
643 | set_bit(TTY_HUPPED, &tty->flags); | 649 | set_bit(TTY_HUPPED, &tty->flags); |
650 | clear_bit(TTY_HUPPING, &tty->flags); | ||
644 | tty_ldisc_enable(tty); | 651 | tty_ldisc_enable(tty); |
645 | 652 | ||
646 | tty_unlock(); | 653 | tty_unlock(); |
@@ -1310,7 +1317,9 @@ static int tty_reopen(struct tty_struct *tty) | |||
1310 | { | 1317 | { |
1311 | struct tty_driver *driver = tty->driver; | 1318 | struct tty_driver *driver = tty->driver; |
1312 | 1319 | ||
1313 | if (test_bit(TTY_CLOSING, &tty->flags)) | 1320 | if (test_bit(TTY_CLOSING, &tty->flags) || |
1321 | test_bit(TTY_HUPPING, &tty->flags) || | ||
1322 | test_bit(TTY_LDISC_CHANGING, &tty->flags)) | ||
1314 | return -EIO; | 1323 | return -EIO; |
1315 | 1324 | ||
1316 | if (driver->type == TTY_DRIVER_TYPE_PTY && | 1325 | if (driver->type == TTY_DRIVER_TYPE_PTY && |
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index d8e96b005023..4214d58276f7 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -454,6 +454,8 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld) | |||
454 | /* BTM here locks versus a hangup event */ | 454 | /* BTM here locks versus a hangup event */ |
455 | WARN_ON(!tty_locked()); | 455 | WARN_ON(!tty_locked()); |
456 | ret = ld->ops->open(tty); | 456 | ret = ld->ops->open(tty); |
457 | if (ret) | ||
458 | clear_bit(TTY_LDISC_OPEN, &tty->flags); | ||
457 | return ret; | 459 | return ret; |
458 | } | 460 | } |
459 | return 0; | 461 | return 0; |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index a858d2b87b94..51fe1795d5a8 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright(C) 2005, Benedikt Spranger <b.spranger@linutronix.de> | 4 | * Copyright(C) 2005, Benedikt Spranger <b.spranger@linutronix.de> |
5 | * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de> | 5 | * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de> |
6 | * Copyright(C) 2006, Hans J. Koch <hjk@linutronix.de> | 6 | * Copyright(C) 2006, Hans J. Koch <hjk@hansjkoch.de> |
7 | * Copyright(C) 2006, Greg Kroah-Hartman <greg@kroah.com> | 7 | * Copyright(C) 2006, Greg Kroah-Hartman <greg@kroah.com> |
8 | * | 8 | * |
9 | * Userspace IO | 9 | * Userspace IO |
diff --git a/drivers/uio/uio_cif.c b/drivers/uio/uio_cif.c index a8ea2f19a0cc..a84a451159ed 100644 --- a/drivers/uio/uio_cif.c +++ b/drivers/uio/uio_cif.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * UIO Hilscher CIF card driver | 2 | * UIO Hilscher CIF card driver |
3 | * | 3 | * |
4 | * (C) 2007 Hans J. Koch <hjk@linutronix.de> | 4 | * (C) 2007 Hans J. Koch <hjk@hansjkoch.de> |
5 | * Original code (C) 2005 Benedikt Spranger <b.spranger@linutronix.de> | 5 | * Original code (C) 2005 Benedikt Spranger <b.spranger@linutronix.de> |
6 | * | 6 | * |
7 | * Licensed under GPL version 2 only. | 7 | * Licensed under GPL version 2 only. |
diff --git a/drivers/uio/uio_netx.c b/drivers/uio/uio_netx.c index 5a18e9f7b836..5ffdb483b015 100644 --- a/drivers/uio/uio_netx.c +++ b/drivers/uio/uio_netx.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * UIO driver for Hilscher NetX based fieldbus cards (cifX, comX). | 2 | * UIO driver for Hilscher NetX based fieldbus cards (cifX, comX). |
3 | * See http://www.hilscher.com for details. | 3 | * See http://www.hilscher.com for details. |
4 | * | 4 | * |
5 | * (C) 2007 Hans J. Koch <hjk@linutronix.de> | 5 | * (C) 2007 Hans J. Koch <hjk@hansjkoch.de> |
6 | * (C) 2008 Manuel Traut <manut@linutronix.de> | 6 | * (C) 2008 Manuel Traut <manut@linutronix.de> |
7 | * | 7 | * |
8 | * Licensed under GPL version 2 only. | 8 | * Licensed under GPL version 2 only. |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 05bf5a27b5b0..989e16e4ab5c 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -951,7 +951,9 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
951 | * condition: callbacks we register can be executed at once, before we have | 951 | * condition: callbacks we register can be executed at once, before we have |
952 | * initialized the struct atm_dev. To protect against this, all callbacks | 952 | * initialized the struct atm_dev. To protect against this, all callbacks |
953 | * abort if atm_dev->dev_data is NULL. */ | 953 | * abort if atm_dev->dev_data is NULL. */ |
954 | atm_dev = atm_dev_register(instance->driver_name, &usbatm_atm_devops, -1, NULL); | 954 | atm_dev = atm_dev_register(instance->driver_name, |
955 | &instance->usb_intf->dev, &usbatm_atm_devops, | ||
956 | -1, NULL); | ||
955 | if (!atm_dev) { | 957 | if (!atm_dev) { |
956 | usb_err(instance, "%s: failed to register ATM device!\n", __func__); | 958 | usb_err(instance, "%s: failed to register ATM device!\n", __func__); |
957 | return -1; | 959 | return -1; |
@@ -966,14 +968,6 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
966 | /* temp init ATM device, set to 128kbit */ | 968 | /* temp init ATM device, set to 128kbit */ |
967 | atm_dev->link_rate = 128 * 1000 / 424; | 969 | atm_dev->link_rate = 128 * 1000 / 424; |
968 | 970 | ||
969 | ret = sysfs_create_link(&atm_dev->class_dev.kobj, | ||
970 | &instance->usb_intf->dev.kobj, "device"); | ||
971 | if (ret) { | ||
972 | atm_err(instance, "%s: sysfs_create_link failed: %d\n", | ||
973 | __func__, ret); | ||
974 | goto fail_sysfs; | ||
975 | } | ||
976 | |||
977 | if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { | 971 | if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { |
978 | atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); | 972 | atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); |
979 | goto fail; | 973 | goto fail; |
@@ -992,8 +986,6 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
992 | return 0; | 986 | return 0; |
993 | 987 | ||
994 | fail: | 988 | fail: |
995 | sysfs_remove_link(&atm_dev->class_dev.kobj, "device"); | ||
996 | fail_sysfs: | ||
997 | instance->atm_dev = NULL; | 989 | instance->atm_dev = NULL; |
998 | atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ | 990 | atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ |
999 | return ret; | 991 | return ret; |
@@ -1329,7 +1321,6 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1329 | 1321 | ||
1330 | /* ATM finalize */ | 1322 | /* ATM finalize */ |
1331 | if (instance->atm_dev) { | 1323 | if (instance->atm_dev) { |
1332 | sysfs_remove_link(&instance->atm_dev->class_dev.kobj, "device"); | ||
1333 | atm_dev_deregister(instance->atm_dev); | 1324 | atm_dev_deregister(instance->atm_dev); |
1334 | instance->atm_dev = NULL; | 1325 | instance->atm_dev = NULL; |
1335 | } | 1326 | } |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 9eed5b52d9de..bcc24779ba0e 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -107,11 +107,19 @@ config USB_SUSPEND | |||
107 | If you are unsure about this, say N here. | 107 | If you are unsure about this, say N here. |
108 | 108 | ||
109 | config USB_OTG | 109 | config USB_OTG |
110 | bool | 110 | bool "OTG support" |
111 | depends on USB && EXPERIMENTAL | 111 | depends on USB && EXPERIMENTAL |
112 | depends on USB_SUSPEND | 112 | depends on USB_SUSPEND |
113 | default n | 113 | default n |
114 | 114 | help | |
115 | The most notable feature of USB OTG is support for a | ||
116 | "Dual-Role" device, which can act as either a device | ||
117 | or a host. The initial role is decided by the type of | ||
118 | plug inserted and can be changed later when two dual | ||
119 | role devices talk to each other. | ||
120 | |||
121 | Select this only if your board has Mini-AB/Micro-AB | ||
122 | connector. | ||
115 | 123 | ||
116 | config USB_OTG_WHITELIST | 124 | config USB_OTG_WHITELIST |
117 | bool "Rely on OTG Targeted Peripherals List" | 125 | bool "Rely on OTG Targeted Peripherals List" |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 61800f77dac8..ced846ac4141 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1330,6 +1330,8 @@ static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | |||
1330 | */ | 1330 | */ |
1331 | 1331 | ||
1332 | if (usb_endpoint_xfer_control(&urb->ep->desc)) { | 1332 | if (usb_endpoint_xfer_control(&urb->ep->desc)) { |
1333 | if (hcd->self.uses_pio_for_control) | ||
1334 | return ret; | ||
1333 | if (hcd->self.uses_dma) { | 1335 | if (hcd->self.uses_dma) { |
1334 | urb->setup_dma = dma_map_single( | 1336 | urb->setup_dma = dma_map_single( |
1335 | hcd->self.controller, | 1337 | hcd->self.controller, |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 7b5cc16e4a0b..8572dad5ecbb 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -1047,9 +1047,9 @@ composite_unbind(struct usb_gadget *gadget) | |||
1047 | kfree(cdev->req->buf); | 1047 | kfree(cdev->req->buf); |
1048 | usb_ep_free_request(gadget->ep0, cdev->req); | 1048 | usb_ep_free_request(gadget->ep0, cdev->req); |
1049 | } | 1049 | } |
1050 | device_remove_file(&gadget->dev, &dev_attr_suspended); | ||
1050 | kfree(cdev); | 1051 | kfree(cdev); |
1051 | set_gadget_data(gadget, NULL); | 1052 | set_gadget_data(gadget, NULL); |
1052 | device_remove_file(&gadget->dev, &dev_attr_suspended); | ||
1053 | composite = NULL; | 1053 | composite = NULL; |
1054 | } | 1054 | } |
1055 | 1055 | ||
@@ -1107,14 +1107,6 @@ static int composite_bind(struct usb_gadget *gadget) | |||
1107 | */ | 1107 | */ |
1108 | usb_ep_autoconfig_reset(cdev->gadget); | 1108 | usb_ep_autoconfig_reset(cdev->gadget); |
1109 | 1109 | ||
1110 | /* standardized runtime overrides for device ID data */ | ||
1111 | if (idVendor) | ||
1112 | cdev->desc.idVendor = cpu_to_le16(idVendor); | ||
1113 | if (idProduct) | ||
1114 | cdev->desc.idProduct = cpu_to_le16(idProduct); | ||
1115 | if (bcdDevice) | ||
1116 | cdev->desc.bcdDevice = cpu_to_le16(bcdDevice); | ||
1117 | |||
1118 | /* composite gadget needs to assign strings for whole device (like | 1110 | /* composite gadget needs to assign strings for whole device (like |
1119 | * serial number), register function drivers, potentially update | 1111 | * serial number), register function drivers, potentially update |
1120 | * power state and consumption, etc | 1112 | * power state and consumption, etc |
@@ -1126,6 +1118,14 @@ static int composite_bind(struct usb_gadget *gadget) | |||
1126 | cdev->desc = *composite->dev; | 1118 | cdev->desc = *composite->dev; |
1127 | cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; | 1119 | cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; |
1128 | 1120 | ||
1121 | /* standardized runtime overrides for device ID data */ | ||
1122 | if (idVendor) | ||
1123 | cdev->desc.idVendor = cpu_to_le16(idVendor); | ||
1124 | if (idProduct) | ||
1125 | cdev->desc.idProduct = cpu_to_le16(idProduct); | ||
1126 | if (bcdDevice) | ||
1127 | cdev->desc.bcdDevice = cpu_to_le16(bcdDevice); | ||
1128 | |||
1129 | /* stirng overrides */ | 1129 | /* stirng overrides */ |
1130 | if (iManufacturer || !cdev->desc.iManufacturer) { | 1130 | if (iManufacturer || !cdev->desc.iManufacturer) { |
1131 | if (!iManufacturer && !composite->iManufacturer && | 1131 | if (!iManufacturer && !composite->iManufacturer && |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 01bb72b71832..655f3c9f88bf 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -161,6 +161,18 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
161 | if (pdev->revision < 0xa4) | 161 | if (pdev->revision < 0xa4) |
162 | ehci->no_selective_suspend = 1; | 162 | ehci->no_selective_suspend = 1; |
163 | break; | 163 | break; |
164 | |||
165 | /* MCP89 chips on the MacBookAir3,1 give EPROTO when | ||
166 | * fetching device descriptors unless LPM is disabled. | ||
167 | * There are also intermittent problems enumerating | ||
168 | * devices with PPCD enabled. | ||
169 | */ | ||
170 | case 0x0d9d: | ||
171 | ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89"); | ||
172 | ehci->has_lpm = 0; | ||
173 | ehci->has_ppcd = 0; | ||
174 | ehci->command &= ~CMD_PPCEE; | ||
175 | break; | ||
164 | } | 176 | } |
165 | break; | 177 | break; |
166 | case PCI_VENDOR_ID_VIA: | 178 | case PCI_VENDOR_ID_VIA: |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index fef5a1f9d483..5d963e350494 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -229,6 +229,13 @@ void xhci_ring_device(struct xhci_hcd *xhci, int slot_id) | |||
229 | static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, | 229 | static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, |
230 | u32 __iomem *addr, u32 port_status) | 230 | u32 __iomem *addr, u32 port_status) |
231 | { | 231 | { |
232 | /* Don't allow the USB core to disable SuperSpeed ports. */ | ||
233 | if (xhci->port_array[wIndex] == 0x03) { | ||
234 | xhci_dbg(xhci, "Ignoring request to disable " | ||
235 | "SuperSpeed port.\n"); | ||
236 | return; | ||
237 | } | ||
238 | |||
232 | /* Write 1 to disable the port */ | 239 | /* Write 1 to disable the port */ |
233 | xhci_writel(xhci, port_status | PORT_PE, addr); | 240 | xhci_writel(xhci, port_status | PORT_PE, addr); |
234 | port_status = xhci_readl(xhci, addr); | 241 | port_status = xhci_readl(xhci, addr); |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index d178761c3981..1d0f45f0e7a6 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1443,6 +1443,13 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1443 | xhci->dcbaa = NULL; | 1443 | xhci->dcbaa = NULL; |
1444 | 1444 | ||
1445 | scratchpad_free(xhci); | 1445 | scratchpad_free(xhci); |
1446 | |||
1447 | xhci->num_usb2_ports = 0; | ||
1448 | xhci->num_usb3_ports = 0; | ||
1449 | kfree(xhci->usb2_ports); | ||
1450 | kfree(xhci->usb3_ports); | ||
1451 | kfree(xhci->port_array); | ||
1452 | |||
1446 | xhci->page_size = 0; | 1453 | xhci->page_size = 0; |
1447 | xhci->page_shift = 0; | 1454 | xhci->page_shift = 0; |
1448 | xhci->bus_suspended = 0; | 1455 | xhci->bus_suspended = 0; |
@@ -1627,6 +1634,166 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) | |||
1627 | &xhci->ir_set->erst_dequeue); | 1634 | &xhci->ir_set->erst_dequeue); |
1628 | } | 1635 | } |
1629 | 1636 | ||
1637 | static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, | ||
1638 | u32 __iomem *addr, u8 major_revision) | ||
1639 | { | ||
1640 | u32 temp, port_offset, port_count; | ||
1641 | int i; | ||
1642 | |||
1643 | if (major_revision > 0x03) { | ||
1644 | xhci_warn(xhci, "Ignoring unknown port speed, " | ||
1645 | "Ext Cap %p, revision = 0x%x\n", | ||
1646 | addr, major_revision); | ||
1647 | /* Ignoring port protocol we can't understand. FIXME */ | ||
1648 | return; | ||
1649 | } | ||
1650 | |||
1651 | /* Port offset and count in the third dword, see section 7.2 */ | ||
1652 | temp = xhci_readl(xhci, addr + 2); | ||
1653 | port_offset = XHCI_EXT_PORT_OFF(temp); | ||
1654 | port_count = XHCI_EXT_PORT_COUNT(temp); | ||
1655 | xhci_dbg(xhci, "Ext Cap %p, port offset = %u, " | ||
1656 | "count = %u, revision = 0x%x\n", | ||
1657 | addr, port_offset, port_count, major_revision); | ||
1658 | /* Port count includes the current port offset */ | ||
1659 | if (port_offset == 0 || (port_offset + port_count - 1) > num_ports) | ||
1660 | /* WTF? "Valid values are ‘1’ to MaxPorts" */ | ||
1661 | return; | ||
1662 | port_offset--; | ||
1663 | for (i = port_offset; i < (port_offset + port_count); i++) { | ||
1664 | /* Duplicate entry. Ignore the port if the revisions differ. */ | ||
1665 | if (xhci->port_array[i] != 0) { | ||
1666 | xhci_warn(xhci, "Duplicate port entry, Ext Cap %p," | ||
1667 | " port %u\n", addr, i); | ||
1668 | xhci_warn(xhci, "Port was marked as USB %u, " | ||
1669 | "duplicated as USB %u\n", | ||
1670 | xhci->port_array[i], major_revision); | ||
1671 | /* Only adjust the roothub port counts if we haven't | ||
1672 | * found a similar duplicate. | ||
1673 | */ | ||
1674 | if (xhci->port_array[i] != major_revision && | ||
1675 | xhci->port_array[i] != (u8) -1) { | ||
1676 | if (xhci->port_array[i] == 0x03) | ||
1677 | xhci->num_usb3_ports--; | ||
1678 | else | ||
1679 | xhci->num_usb2_ports--; | ||
1680 | xhci->port_array[i] = (u8) -1; | ||
1681 | } | ||
1682 | /* FIXME: Should we disable the port? */ | ||
1683 | continue; | ||
1684 | } | ||
1685 | xhci->port_array[i] = major_revision; | ||
1686 | if (major_revision == 0x03) | ||
1687 | xhci->num_usb3_ports++; | ||
1688 | else | ||
1689 | xhci->num_usb2_ports++; | ||
1690 | } | ||
1691 | /* FIXME: Should we disable ports not in the Extended Capabilities? */ | ||
1692 | } | ||
1693 | |||
1694 | /* | ||
1695 | * Scan the Extended Capabilities for the "Supported Protocol Capabilities" that | ||
1696 | * specify what speeds each port is supposed to be. We can't count on the port | ||
1697 | * speed bits in the PORTSC register being correct until a device is connected, | ||
1698 | * but we need to set up the two fake roothubs with the correct number of USB | ||
1699 | * 3.0 and USB 2.0 ports at host controller initialization time. | ||
1700 | */ | ||
1701 | static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) | ||
1702 | { | ||
1703 | u32 __iomem *addr; | ||
1704 | u32 offset; | ||
1705 | unsigned int num_ports; | ||
1706 | int i, port_index; | ||
1707 | |||
1708 | addr = &xhci->cap_regs->hcc_params; | ||
1709 | offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr)); | ||
1710 | if (offset == 0) { | ||
1711 | xhci_err(xhci, "No Extended Capability registers, " | ||
1712 | "unable to set up roothub.\n"); | ||
1713 | return -ENODEV; | ||
1714 | } | ||
1715 | |||
1716 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | ||
1717 | xhci->port_array = kzalloc(sizeof(*xhci->port_array)*num_ports, flags); | ||
1718 | if (!xhci->port_array) | ||
1719 | return -ENOMEM; | ||
1720 | |||
1721 | /* | ||
1722 | * For whatever reason, the first capability offset is from the | ||
1723 | * capability register base, not from the HCCPARAMS register. | ||
1724 | * See section 5.3.6 for offset calculation. | ||
1725 | */ | ||
1726 | addr = &xhci->cap_regs->hc_capbase + offset; | ||
1727 | while (1) { | ||
1728 | u32 cap_id; | ||
1729 | |||
1730 | cap_id = xhci_readl(xhci, addr); | ||
1731 | if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) | ||
1732 | xhci_add_in_port(xhci, num_ports, addr, | ||
1733 | (u8) XHCI_EXT_PORT_MAJOR(cap_id)); | ||
1734 | offset = XHCI_EXT_CAPS_NEXT(cap_id); | ||
1735 | if (!offset || (xhci->num_usb2_ports + xhci->num_usb3_ports) | ||
1736 | == num_ports) | ||
1737 | break; | ||
1738 | /* | ||
1739 | * Once you're into the Extended Capabilities, the offset is | ||
1740 | * always relative to the register holding the offset. | ||
1741 | */ | ||
1742 | addr += offset; | ||
1743 | } | ||
1744 | |||
1745 | if (xhci->num_usb2_ports == 0 && xhci->num_usb3_ports == 0) { | ||
1746 | xhci_warn(xhci, "No ports on the roothubs?\n"); | ||
1747 | return -ENODEV; | ||
1748 | } | ||
1749 | xhci_dbg(xhci, "Found %u USB 2.0 ports and %u USB 3.0 ports.\n", | ||
1750 | xhci->num_usb2_ports, xhci->num_usb3_ports); | ||
1751 | /* | ||
1752 | * Note we could have all USB 3.0 ports, or all USB 2.0 ports. | ||
1753 | * Not sure how the USB core will handle a hub with no ports... | ||
1754 | */ | ||
1755 | if (xhci->num_usb2_ports) { | ||
1756 | xhci->usb2_ports = kmalloc(sizeof(*xhci->usb2_ports)* | ||
1757 | xhci->num_usb2_ports, flags); | ||
1758 | if (!xhci->usb2_ports) | ||
1759 | return -ENOMEM; | ||
1760 | |||
1761 | port_index = 0; | ||
1762 | for (i = 0; i < num_ports; i++) { | ||
1763 | if (xhci->port_array[i] == 0x03 || | ||
1764 | xhci->port_array[i] == 0 || | ||
1765 | xhci->port_array[i] == -1) | ||
1766 | continue; | ||
1767 | |||
1768 | xhci->usb2_ports[port_index] = | ||
1769 | &xhci->op_regs->port_status_base + | ||
1770 | NUM_PORT_REGS*i; | ||
1771 | xhci_dbg(xhci, "USB 2.0 port at index %u, " | ||
1772 | "addr = %p\n", i, | ||
1773 | xhci->usb2_ports[port_index]); | ||
1774 | port_index++; | ||
1775 | } | ||
1776 | } | ||
1777 | if (xhci->num_usb3_ports) { | ||
1778 | xhci->usb3_ports = kmalloc(sizeof(*xhci->usb3_ports)* | ||
1779 | xhci->num_usb3_ports, flags); | ||
1780 | if (!xhci->usb3_ports) | ||
1781 | return -ENOMEM; | ||
1782 | |||
1783 | port_index = 0; | ||
1784 | for (i = 0; i < num_ports; i++) | ||
1785 | if (xhci->port_array[i] == 0x03) { | ||
1786 | xhci->usb3_ports[port_index] = | ||
1787 | &xhci->op_regs->port_status_base + | ||
1788 | NUM_PORT_REGS*i; | ||
1789 | xhci_dbg(xhci, "USB 3.0 port at index %u, " | ||
1790 | "addr = %p\n", i, | ||
1791 | xhci->usb3_ports[port_index]); | ||
1792 | port_index++; | ||
1793 | } | ||
1794 | } | ||
1795 | return 0; | ||
1796 | } | ||
1630 | 1797 | ||
1631 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | 1798 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
1632 | { | 1799 | { |
@@ -1809,6 +1976,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1809 | 1976 | ||
1810 | if (scratchpad_alloc(xhci, flags)) | 1977 | if (scratchpad_alloc(xhci, flags)) |
1811 | goto fail; | 1978 | goto fail; |
1979 | if (xhci_setup_port_arrays(xhci, flags)) | ||
1980 | goto fail; | ||
1812 | 1981 | ||
1813 | return 0; | 1982 | return 0; |
1814 | 1983 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 06fca0835b52..45e4a3108cc3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1549,6 +1549,15 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | |||
1549 | cmd_completion = command->completion; | 1549 | cmd_completion = command->completion; |
1550 | cmd_status = &command->status; | 1550 | cmd_status = &command->status; |
1551 | command->command_trb = xhci->cmd_ring->enqueue; | 1551 | command->command_trb = xhci->cmd_ring->enqueue; |
1552 | |||
1553 | /* Enqueue pointer can be left pointing to the link TRB, | ||
1554 | * we must handle that | ||
1555 | */ | ||
1556 | if ((command->command_trb->link.control & TRB_TYPE_BITMASK) | ||
1557 | == TRB_TYPE(TRB_LINK)) | ||
1558 | command->command_trb = | ||
1559 | xhci->cmd_ring->enq_seg->next->trbs; | ||
1560 | |||
1552 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); | 1561 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); |
1553 | } else { | 1562 | } else { |
1554 | in_ctx = virt_dev->in_ctx; | 1563 | in_ctx = virt_dev->in_ctx; |
@@ -2272,6 +2281,15 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
2272 | /* Attempt to submit the Reset Device command to the command ring */ | 2281 | /* Attempt to submit the Reset Device command to the command ring */ |
2273 | spin_lock_irqsave(&xhci->lock, flags); | 2282 | spin_lock_irqsave(&xhci->lock, flags); |
2274 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; | 2283 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; |
2284 | |||
2285 | /* Enqueue pointer can be left pointing to the link TRB, | ||
2286 | * we must handle that | ||
2287 | */ | ||
2288 | if ((reset_device_cmd->command_trb->link.control & TRB_TYPE_BITMASK) | ||
2289 | == TRB_TYPE(TRB_LINK)) | ||
2290 | reset_device_cmd->command_trb = | ||
2291 | xhci->cmd_ring->enq_seg->next->trbs; | ||
2292 | |||
2275 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); | 2293 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); |
2276 | ret = xhci_queue_reset_device(xhci, slot_id); | 2294 | ret = xhci_queue_reset_device(xhci, slot_id); |
2277 | if (ret) { | 2295 | if (ret) { |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 85e65647d445..170c367112d2 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -454,6 +454,24 @@ struct xhci_doorbell_array { | |||
454 | 454 | ||
455 | 455 | ||
456 | /** | 456 | /** |
457 | * struct xhci_protocol_caps | ||
458 | * @revision: major revision, minor revision, capability ID, | ||
459 | * and next capability pointer. | ||
460 | * @name_string: Four ASCII characters to say which spec this xHC | ||
461 | * follows, typically "USB ". | ||
462 | * @port_info: Port offset, count, and protocol-defined information. | ||
463 | */ | ||
464 | struct xhci_protocol_caps { | ||
465 | u32 revision; | ||
466 | u32 name_string; | ||
467 | u32 port_info; | ||
468 | }; | ||
469 | |||
470 | #define XHCI_EXT_PORT_MAJOR(x) (((x) >> 24) & 0xff) | ||
471 | #define XHCI_EXT_PORT_OFF(x) ((x) & 0xff) | ||
472 | #define XHCI_EXT_PORT_COUNT(x) (((x) >> 8) & 0xff) | ||
473 | |||
474 | /** | ||
457 | * struct xhci_container_ctx | 475 | * struct xhci_container_ctx |
458 | * @type: Type of context. Used to calculated offsets to contained contexts. | 476 | * @type: Type of context. Used to calculated offsets to contained contexts. |
459 | * @size: Size of the context data | 477 | * @size: Size of the context data |
@@ -1240,6 +1258,14 @@ struct xhci_hcd { | |||
1240 | u32 suspended_ports[8]; /* which ports are | 1258 | u32 suspended_ports[8]; /* which ports are |
1241 | suspended */ | 1259 | suspended */ |
1242 | unsigned long resume_done[MAX_HC_PORTS]; | 1260 | unsigned long resume_done[MAX_HC_PORTS]; |
1261 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ | ||
1262 | u8 *port_array; | ||
1263 | /* Array of pointers to USB 3.0 PORTSC registers */ | ||
1264 | u32 __iomem **usb3_ports; | ||
1265 | unsigned int num_usb3_ports; | ||
1266 | /* Array of pointers to USB 2.0 PORTSC registers */ | ||
1267 | u32 __iomem **usb2_ports; | ||
1268 | unsigned int num_usb2_ports; | ||
1243 | }; | 1269 | }; |
1244 | 1270 | ||
1245 | /* For testing purposes */ | 1271 | /* For testing purposes */ |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 796e2f68f749..4ff21587ab03 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -3,7 +3,7 @@ | |||
3 | /* | 3 | /* |
4 | * uss720.c -- USS720 USB Parport Cable. | 4 | * uss720.c -- USS720 USB Parport Cable. |
5 | * | 5 | * |
6 | * Copyright (C) 1999, 2005 | 6 | * Copyright (C) 1999, 2005, 2010 |
7 | * Thomas Sailer (t.sailer@alumni.ethz.ch) | 7 | * Thomas Sailer (t.sailer@alumni.ethz.ch) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
@@ -776,6 +776,8 @@ static const struct usb_device_id uss720_table[] = { | |||
776 | { USB_DEVICE(0x0557, 0x2001) }, | 776 | { USB_DEVICE(0x0557, 0x2001) }, |
777 | { USB_DEVICE(0x0729, 0x1284) }, | 777 | { USB_DEVICE(0x0729, 0x1284) }, |
778 | { USB_DEVICE(0x1293, 0x0002) }, | 778 | { USB_DEVICE(0x1293, 0x0002) }, |
779 | { USB_DEVICE(0x1293, 0x0002) }, | ||
780 | { USB_DEVICE(0x050d, 0x0002) }, | ||
779 | { } /* Terminating entry */ | 781 | { } /* Terminating entry */ |
780 | }; | 782 | }; |
781 | 783 | ||
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 719c6180b31f..ac5bfd619e62 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -536,6 +536,7 @@ static const struct file_operations yurex_fops = { | |||
536 | .open = yurex_open, | 536 | .open = yurex_open, |
537 | .release = yurex_release, | 537 | .release = yurex_release, |
538 | .fasync = yurex_fasync, | 538 | .fasync = yurex_fasync, |
539 | .llseek = default_llseek, | ||
539 | }; | 540 | }; |
540 | 541 | ||
541 | 542 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index e6669fc3b804..99beebce8550 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2116,12 +2116,15 @@ bad_config: | |||
2116 | * Otherwise, wait till the gadget driver hooks up. | 2116 | * Otherwise, wait till the gadget driver hooks up. |
2117 | */ | 2117 | */ |
2118 | if (!is_otg_enabled(musb) && is_host_enabled(musb)) { | 2118 | if (!is_otg_enabled(musb) && is_host_enabled(musb)) { |
2119 | struct usb_hcd *hcd = musb_to_hcd(musb); | ||
2120 | |||
2119 | MUSB_HST_MODE(musb); | 2121 | MUSB_HST_MODE(musb); |
2120 | musb->xceiv->default_a = 1; | 2122 | musb->xceiv->default_a = 1; |
2121 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2123 | musb->xceiv->state = OTG_STATE_A_IDLE; |
2122 | 2124 | ||
2123 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 2125 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
2124 | 2126 | ||
2127 | hcd->self.uses_pio_for_control = 1; | ||
2125 | DBG(1, "%s mode, status %d, devctl %02x %c\n", | 2128 | DBG(1, "%s mode, status %d, devctl %02x %c\n", |
2126 | "HOST", status, | 2129 | "HOST", status, |
2127 | musb_readb(musb->mregs, MUSB_DEVCTL), | 2130 | musb_readb(musb->mregs, MUSB_DEVCTL), |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 36cfd060dbe5..9d6ade82b9f2 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -92,6 +92,59 @@ | |||
92 | 92 | ||
93 | /* ----------------------------------------------------------------------- */ | 93 | /* ----------------------------------------------------------------------- */ |
94 | 94 | ||
95 | /* Maps the buffer to dma */ | ||
96 | |||
97 | static inline void map_dma_buffer(struct musb_request *request, | ||
98 | struct musb *musb) | ||
99 | { | ||
100 | if (request->request.dma == DMA_ADDR_INVALID) { | ||
101 | request->request.dma = dma_map_single( | ||
102 | musb->controller, | ||
103 | request->request.buf, | ||
104 | request->request.length, | ||
105 | request->tx | ||
106 | ? DMA_TO_DEVICE | ||
107 | : DMA_FROM_DEVICE); | ||
108 | request->mapped = 1; | ||
109 | } else { | ||
110 | dma_sync_single_for_device(musb->controller, | ||
111 | request->request.dma, | ||
112 | request->request.length, | ||
113 | request->tx | ||
114 | ? DMA_TO_DEVICE | ||
115 | : DMA_FROM_DEVICE); | ||
116 | request->mapped = 0; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /* Unmap the buffer from dma and maps it back to cpu */ | ||
121 | static inline void unmap_dma_buffer(struct musb_request *request, | ||
122 | struct musb *musb) | ||
123 | { | ||
124 | if (request->request.dma == DMA_ADDR_INVALID) { | ||
125 | DBG(20, "not unmapping a never mapped buffer\n"); | ||
126 | return; | ||
127 | } | ||
128 | if (request->mapped) { | ||
129 | dma_unmap_single(musb->controller, | ||
130 | request->request.dma, | ||
131 | request->request.length, | ||
132 | request->tx | ||
133 | ? DMA_TO_DEVICE | ||
134 | : DMA_FROM_DEVICE); | ||
135 | request->request.dma = DMA_ADDR_INVALID; | ||
136 | request->mapped = 0; | ||
137 | } else { | ||
138 | dma_sync_single_for_cpu(musb->controller, | ||
139 | request->request.dma, | ||
140 | request->request.length, | ||
141 | request->tx | ||
142 | ? DMA_TO_DEVICE | ||
143 | : DMA_FROM_DEVICE); | ||
144 | |||
145 | } | ||
146 | } | ||
147 | |||
95 | /* | 148 | /* |
96 | * Immediately complete a request. | 149 | * Immediately complete a request. |
97 | * | 150 | * |
@@ -119,24 +172,8 @@ __acquires(ep->musb->lock) | |||
119 | 172 | ||
120 | ep->busy = 1; | 173 | ep->busy = 1; |
121 | spin_unlock(&musb->lock); | 174 | spin_unlock(&musb->lock); |
122 | if (is_dma_capable()) { | 175 | if (is_dma_capable() && ep->dma) |
123 | if (req->mapped) { | 176 | unmap_dma_buffer(req, musb); |
124 | dma_unmap_single(musb->controller, | ||
125 | req->request.dma, | ||
126 | req->request.length, | ||
127 | req->tx | ||
128 | ? DMA_TO_DEVICE | ||
129 | : DMA_FROM_DEVICE); | ||
130 | req->request.dma = DMA_ADDR_INVALID; | ||
131 | req->mapped = 0; | ||
132 | } else if (req->request.dma != DMA_ADDR_INVALID) | ||
133 | dma_sync_single_for_cpu(musb->controller, | ||
134 | req->request.dma, | ||
135 | req->request.length, | ||
136 | req->tx | ||
137 | ? DMA_TO_DEVICE | ||
138 | : DMA_FROM_DEVICE); | ||
139 | } | ||
140 | if (request->status == 0) | 177 | if (request->status == 0) |
141 | DBG(5, "%s done request %p, %d/%d\n", | 178 | DBG(5, "%s done request %p, %d/%d\n", |
142 | ep->end_point.name, request, | 179 | ep->end_point.name, request, |
@@ -395,6 +432,13 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
395 | #endif | 432 | #endif |
396 | 433 | ||
397 | if (!use_dma) { | 434 | if (!use_dma) { |
435 | /* | ||
436 | * Unmap the dma buffer back to cpu if dma channel | ||
437 | * programming fails | ||
438 | */ | ||
439 | if (is_dma_capable() && musb_ep->dma) | ||
440 | unmap_dma_buffer(req, musb); | ||
441 | |||
398 | musb_write_fifo(musb_ep->hw_ep, fifo_count, | 442 | musb_write_fifo(musb_ep->hw_ep, fifo_count, |
399 | (u8 *) (request->buf + request->actual)); | 443 | (u8 *) (request->buf + request->actual)); |
400 | request->actual += fifo_count; | 444 | request->actual += fifo_count; |
@@ -713,6 +757,21 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
713 | return; | 757 | return; |
714 | } | 758 | } |
715 | #endif | 759 | #endif |
760 | /* | ||
761 | * Unmap the dma buffer back to cpu if dma channel | ||
762 | * programming fails. This buffer is mapped if the | ||
763 | * channel allocation is successful | ||
764 | */ | ||
765 | if (is_dma_capable() && musb_ep->dma) { | ||
766 | unmap_dma_buffer(req, musb); | ||
767 | |||
768 | /* | ||
769 | * Clear DMAENAB and AUTOCLEAR for the | ||
770 | * PIO mode transfer | ||
771 | */ | ||
772 | csr &= ~(MUSB_RXCSR_DMAENAB | MUSB_RXCSR_AUTOCLEAR); | ||
773 | musb_writew(epio, MUSB_RXCSR, csr); | ||
774 | } | ||
716 | 775 | ||
717 | musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) | 776 | musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) |
718 | (request->buf + request->actual)); | 777 | (request->buf + request->actual)); |
@@ -837,7 +896,9 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
837 | if (!request) | 896 | if (!request) |
838 | return; | 897 | return; |
839 | } | 898 | } |
899 | #if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) | ||
840 | exit: | 900 | exit: |
901 | #endif | ||
841 | /* Analyze request */ | 902 | /* Analyze request */ |
842 | rxstate(musb, to_musb_request(request)); | 903 | rxstate(musb, to_musb_request(request)); |
843 | } | 904 | } |
@@ -1150,26 +1211,9 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1150 | request->epnum = musb_ep->current_epnum; | 1211 | request->epnum = musb_ep->current_epnum; |
1151 | request->tx = musb_ep->is_in; | 1212 | request->tx = musb_ep->is_in; |
1152 | 1213 | ||
1153 | if (is_dma_capable() && musb_ep->dma) { | 1214 | if (is_dma_capable() && musb_ep->dma) |
1154 | if (request->request.dma == DMA_ADDR_INVALID) { | 1215 | map_dma_buffer(request, musb); |
1155 | request->request.dma = dma_map_single( | 1216 | else |
1156 | musb->controller, | ||
1157 | request->request.buf, | ||
1158 | request->request.length, | ||
1159 | request->tx | ||
1160 | ? DMA_TO_DEVICE | ||
1161 | : DMA_FROM_DEVICE); | ||
1162 | request->mapped = 1; | ||
1163 | } else { | ||
1164 | dma_sync_single_for_device(musb->controller, | ||
1165 | request->request.dma, | ||
1166 | request->request.length, | ||
1167 | request->tx | ||
1168 | ? DMA_TO_DEVICE | ||
1169 | : DMA_FROM_DEVICE); | ||
1170 | request->mapped = 0; | ||
1171 | } | ||
1172 | } else | ||
1173 | request->mapped = 0; | 1217 | request->mapped = 0; |
1174 | 1218 | ||
1175 | spin_lock_irqsave(&musb->lock, lockflags); | 1219 | spin_lock_irqsave(&musb->lock, lockflags); |
@@ -1789,6 +1833,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1789 | spin_unlock_irqrestore(&musb->lock, flags); | 1833 | spin_unlock_irqrestore(&musb->lock, flags); |
1790 | 1834 | ||
1791 | if (is_otg_enabled(musb)) { | 1835 | if (is_otg_enabled(musb)) { |
1836 | struct usb_hcd *hcd = musb_to_hcd(musb); | ||
1837 | |||
1792 | DBG(3, "OTG startup...\n"); | 1838 | DBG(3, "OTG startup...\n"); |
1793 | 1839 | ||
1794 | /* REVISIT: funcall to other code, which also | 1840 | /* REVISIT: funcall to other code, which also |
@@ -1803,6 +1849,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1803 | musb->gadget_driver = NULL; | 1849 | musb->gadget_driver = NULL; |
1804 | musb->g.dev.driver = NULL; | 1850 | musb->g.dev.driver = NULL; |
1805 | spin_unlock_irqrestore(&musb->lock, flags); | 1851 | spin_unlock_irqrestore(&musb->lock, flags); |
1852 | } else { | ||
1853 | hcd->self.uses_pio_for_control = 1; | ||
1806 | } | 1854 | } |
1807 | } | 1855 | } |
1808 | } | 1856 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 76f8b3556672..2dec50013528 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -201,6 +201,7 @@ static struct usb_device_id id_table_combined [] = { | |||
201 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, | 201 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
202 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 202 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
203 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, | 203 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, |
204 | { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, | ||
204 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, | 205 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, |
205 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, | 206 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, |
206 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, | 207 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, |
@@ -696,6 +697,7 @@ static struct usb_device_id id_table_combined [] = { | |||
696 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 697 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
697 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 698 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
698 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | 699 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, |
700 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, | ||
699 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 701 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
700 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 702 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
701 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 703 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
@@ -794,6 +796,7 @@ static struct usb_device_id id_table_combined [] = { | |||
794 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, | 796 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, |
795 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, | 797 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, |
796 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, | 798 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, |
799 | { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, | ||
797 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), | 800 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), |
798 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 801 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
799 | { }, /* Optional parameter entry */ | 802 | { }, /* Optional parameter entry */ |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 263f62551197..bf0867285481 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -114,6 +114,9 @@ | |||
114 | /* Lenz LI-USB Computer Interface. */ | 114 | /* Lenz LI-USB Computer Interface. */ |
115 | #define FTDI_LENZ_LIUSB_PID 0xD780 | 115 | #define FTDI_LENZ_LIUSB_PID 0xD780 |
116 | 116 | ||
117 | /* Vardaan Enterprises Serial Interface VEUSB422R3 */ | ||
118 | #define FTDI_VARDAAN_PID 0xF070 | ||
119 | |||
117 | /* | 120 | /* |
118 | * Xsens Technologies BV products (http://www.xsens.com). | 121 | * Xsens Technologies BV products (http://www.xsens.com). |
119 | */ | 122 | */ |
@@ -721,6 +724,7 @@ | |||
721 | */ | 724 | */ |
722 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 725 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
723 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | 726 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ |
727 | #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ | ||
724 | 728 | ||
725 | /* | 729 | /* |
726 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. | 730 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. |
@@ -1077,6 +1081,11 @@ | |||
1077 | #define MJSG_HD_RADIO_PID 0x937C | 1081 | #define MJSG_HD_RADIO_PID 0x937C |
1078 | 1082 | ||
1079 | /* | 1083 | /* |
1084 | * D.O.Tec products (http://www.directout.eu) | ||
1085 | */ | ||
1086 | #define FTDI_DOTEC_PID 0x9868 | ||
1087 | |||
1088 | /* | ||
1080 | * Xverve Signalyzer tools (http://www.signalyzer.com/) | 1089 | * Xverve Signalyzer tools (http://www.signalyzer.com/) |
1081 | */ | 1090 | */ |
1082 | #define XVERVE_SIGNALYZER_ST_PID 0xBCA0 | 1091 | #define XVERVE_SIGNALYZER_ST_PID 0xBCA0 |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 861223f2af6e..6954de50c0ff 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -51,6 +51,7 @@ static struct usb_driver usb_serial_driver = { | |||
51 | .suspend = usb_serial_suspend, | 51 | .suspend = usb_serial_suspend, |
52 | .resume = usb_serial_resume, | 52 | .resume = usb_serial_resume, |
53 | .no_dynamic_id = 1, | 53 | .no_dynamic_id = 1, |
54 | .supports_autosuspend = 1, | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead | 57 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead |
@@ -1343,6 +1344,8 @@ int usb_serial_register(struct usb_serial_driver *driver) | |||
1343 | return -ENODEV; | 1344 | return -ENODEV; |
1344 | 1345 | ||
1345 | fixup_generic(driver); | 1346 | fixup_generic(driver); |
1347 | if (driver->usb_driver) | ||
1348 | driver->usb_driver->supports_autosuspend = 1; | ||
1346 | 1349 | ||
1347 | if (!driver->description) | 1350 | if (!driver->description) |
1348 | driver->description = driver->driver.name; | 1351 | driver->description = driver->driver.name; |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 6ccdd3dd5259..fcc1e32ce256 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -481,6 +481,13 @@ UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220, | |||
481 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 481 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
482 | US_FL_MAX_SECTORS_64), | 482 | US_FL_MAX_SECTORS_64), |
483 | 483 | ||
484 | /* Reported by Vitaly Kuznetsov <vitty@altlinux.ru> */ | ||
485 | UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, | ||
486 | "Samsung", | ||
487 | "YP-CP3", | ||
488 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
489 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), | ||
490 | |||
484 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. | 491 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. |
485 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and | 492 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
486 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. | 493 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 4b4da5b86ff9..f442668a1e52 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -129,8 +129,9 @@ static void handle_tx(struct vhost_net *net) | |||
129 | size_t hdr_size; | 129 | size_t hdr_size; |
130 | struct socket *sock; | 130 | struct socket *sock; |
131 | 131 | ||
132 | sock = rcu_dereference_check(vq->private_data, | 132 | /* TODO: check that we are running from vhost_worker? |
133 | lockdep_is_held(&vq->mutex)); | 133 | * Not sure it's worth it, it's straight-forward enough. */ |
134 | sock = rcu_dereference_check(vq->private_data, 1); | ||
134 | if (!sock) | 135 | if (!sock) |
135 | return; | 136 | return; |
136 | 137 | ||
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 94701ff3a23a..159c77a5746f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -884,6 +884,7 @@ static int log_write(void __user *log_base, | |||
884 | int r; | 884 | int r; |
885 | if (!write_length) | 885 | if (!write_length) |
886 | return 0; | 886 | return 0; |
887 | write_length += write_address % VHOST_PAGE_SIZE; | ||
887 | write_address /= VHOST_PAGE_SIZE; | 888 | write_address /= VHOST_PAGE_SIZE; |
888 | for (;;) { | 889 | for (;;) { |
889 | u64 base = (u64)(unsigned long)log_base; | 890 | u64 base = (u64)(unsigned long)log_base; |
@@ -897,7 +898,7 @@ static int log_write(void __user *log_base, | |||
897 | if (write_length <= VHOST_PAGE_SIZE) | 898 | if (write_length <= VHOST_PAGE_SIZE) |
898 | break; | 899 | break; |
899 | write_length -= VHOST_PAGE_SIZE; | 900 | write_length -= VHOST_PAGE_SIZE; |
900 | write_address += VHOST_PAGE_SIZE; | 901 | write_address += 1; |
901 | } | 902 | } |
902 | return r; | 903 | return r; |
903 | } | 904 | } |
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index a4f4546f0be0..397d15eb1ea8 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c | |||
@@ -242,6 +242,7 @@ static int cr_backlight_remove(struct platform_device *pdev) | |||
242 | backlight_device_unregister(crp->cr_backlight_device); | 242 | backlight_device_unregister(crp->cr_backlight_device); |
243 | lcd_device_unregister(crp->cr_lcd_device); | 243 | lcd_device_unregister(crp->cr_lcd_device); |
244 | pci_dev_put(lpc_dev); | 244 | pci_dev_put(lpc_dev); |
245 | kfree(crp); | ||
245 | 246 | ||
246 | return 0; | 247 | return 0; |
247 | } | 248 | } |
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index cad7d45c8bac..c265aed09e04 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -1029,10 +1029,6 @@ static int __init fb_probe(struct platform_device *device) | |||
1029 | goto err_release_pl_mem; | 1029 | goto err_release_pl_mem; |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | ret = request_irq(par->irq, lcdc_irq_handler, 0, DRIVER_NAME, par); | ||
1033 | if (ret) | ||
1034 | goto err_release_pl_mem; | ||
1035 | |||
1036 | /* Initialize par */ | 1032 | /* Initialize par */ |
1037 | da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp; | 1033 | da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp; |
1038 | 1034 | ||
@@ -1060,7 +1056,7 @@ static int __init fb_probe(struct platform_device *device) | |||
1060 | 1056 | ||
1061 | ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); | 1057 | ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); |
1062 | if (ret) | 1058 | if (ret) |
1063 | goto err_free_irq; | 1059 | goto err_release_pl_mem; |
1064 | da8xx_fb_info->cmap.len = par->palette_sz; | 1060 | da8xx_fb_info->cmap.len = par->palette_sz; |
1065 | 1061 | ||
1066 | /* initialize var_screeninfo */ | 1062 | /* initialize var_screeninfo */ |
@@ -1088,8 +1084,13 @@ static int __init fb_probe(struct platform_device *device) | |||
1088 | goto err_cpu_freq; | 1084 | goto err_cpu_freq; |
1089 | } | 1085 | } |
1090 | #endif | 1086 | #endif |
1087 | |||
1088 | ret = request_irq(par->irq, lcdc_irq_handler, 0, DRIVER_NAME, par); | ||
1089 | if (ret) | ||
1090 | goto irq_freq; | ||
1091 | return 0; | 1091 | return 0; |
1092 | 1092 | ||
1093 | irq_freq: | ||
1093 | #ifdef CONFIG_CPU_FREQ | 1094 | #ifdef CONFIG_CPU_FREQ |
1094 | err_cpu_freq: | 1095 | err_cpu_freq: |
1095 | unregister_framebuffer(da8xx_fb_info); | 1096 | unregister_framebuffer(da8xx_fb_info); |
@@ -1098,9 +1099,6 @@ err_cpu_freq: | |||
1098 | err_dealloc_cmap: | 1099 | err_dealloc_cmap: |
1099 | fb_dealloc_cmap(&da8xx_fb_info->cmap); | 1100 | fb_dealloc_cmap(&da8xx_fb_info->cmap); |
1100 | 1101 | ||
1101 | err_free_irq: | ||
1102 | free_irq(par->irq, par); | ||
1103 | |||
1104 | err_release_pl_mem: | 1102 | err_release_pl_mem: |
1105 | dma_free_coherent(NULL, PALETTE_SIZE, par->v_palette_base, | 1103 | dma_free_coherent(NULL, PALETTE_SIZE, par->v_palette_base, |
1106 | par->p_palette_base); | 1104 | par->p_palette_base); |
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c index affdf3e32cf3..5c3960da755a 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbcmap.c | |||
@@ -80,6 +80,7 @@ static const struct fb_cmap default_16_colors = { | |||
80 | * @cmap: frame buffer colormap structure | 80 | * @cmap: frame buffer colormap structure |
81 | * @len: length of @cmap | 81 | * @len: length of @cmap |
82 | * @transp: boolean, 1 if there is transparency, 0 otherwise | 82 | * @transp: boolean, 1 if there is transparency, 0 otherwise |
83 | * @flags: flags for kmalloc memory allocation | ||
83 | * | 84 | * |
84 | * Allocates memory for a colormap @cmap. @len is the | 85 | * Allocates memory for a colormap @cmap. @len is the |
85 | * number of entries in the palette. | 86 | * number of entries in the palette. |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 0e6aa3d96a42..4ac1201ad6c2 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1458,7 +1458,7 @@ static bool apertures_overlap(struct aperture *gen, struct aperture *hw) | |||
1458 | if (gen->base == hw->base) | 1458 | if (gen->base == hw->base) |
1459 | return true; | 1459 | return true; |
1460 | /* is the generic aperture base inside the hw base->hw base+size */ | 1460 | /* is the generic aperture base inside the hw base->hw base+size */ |
1461 | if (gen->base > hw->base && gen->base <= hw->base + hw->size) | 1461 | if (gen->base > hw->base && gen->base < hw->base + hw->size) |
1462 | return true; | 1462 | return true; |
1463 | return false; | 1463 | return false; |
1464 | } | 1464 | } |
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h index e4c4d89b7860..be8ccb47ebe0 100644 --- a/drivers/video/geode/lxfb.h +++ b/drivers/video/geode/lxfb.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define DC_HFILT_COUNT 0x100 | 22 | #define DC_HFILT_COUNT 0x100 |
23 | #define DC_VFILT_COUNT 0x100 | 23 | #define DC_VFILT_COUNT 0x100 |
24 | #define VP_COEFF_SIZE 0x1000 | 24 | #define VP_COEFF_SIZE 0x1000 |
25 | #define VP_PAL_COUNT 0x100 | ||
25 | 26 | ||
26 | #define OUTPUT_CRT 0x01 | 27 | #define OUTPUT_CRT 0x01 |
27 | #define OUTPUT_PANEL 0x02 | 28 | #define OUTPUT_PANEL 0x02 |
@@ -48,7 +49,8 @@ struct lxfb_par { | |||
48 | uint64_t vp[VP_REG_COUNT]; | 49 | uint64_t vp[VP_REG_COUNT]; |
49 | uint64_t fp[FP_REG_COUNT]; | 50 | uint64_t fp[FP_REG_COUNT]; |
50 | 51 | ||
51 | uint32_t pal[DC_PAL_COUNT]; | 52 | uint32_t dc_pal[DC_PAL_COUNT]; |
53 | uint32_t vp_pal[VP_PAL_COUNT]; | ||
52 | uint32_t hcoeff[DC_HFILT_COUNT * 2]; | 54 | uint32_t hcoeff[DC_HFILT_COUNT * 2]; |
53 | uint32_t vcoeff[DC_VFILT_COUNT]; | 55 | uint32_t vcoeff[DC_VFILT_COUNT]; |
54 | uint32_t vp_coeff[VP_COEFF_SIZE / 4]; | 56 | uint32_t vp_coeff[VP_COEFF_SIZE / 4]; |
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c index 85ec7f64c42a..79e9abc72b83 100644 --- a/drivers/video/geode/lxfb_ops.c +++ b/drivers/video/geode/lxfb_ops.c | |||
@@ -610,10 +610,15 @@ static void lx_save_regs(struct lxfb_par *par) | |||
610 | memcpy(par->vp, par->vp_regs, sizeof(par->vp)); | 610 | memcpy(par->vp, par->vp_regs, sizeof(par->vp)); |
611 | memcpy(par->fp, par->vp_regs + VP_FP_START, sizeof(par->fp)); | 611 | memcpy(par->fp, par->vp_regs + VP_FP_START, sizeof(par->fp)); |
612 | 612 | ||
613 | /* save the palette */ | 613 | /* save the display controller palette */ |
614 | write_dc(par, DC_PAL_ADDRESS, 0); | 614 | write_dc(par, DC_PAL_ADDRESS, 0); |
615 | for (i = 0; i < ARRAY_SIZE(par->pal); i++) | 615 | for (i = 0; i < ARRAY_SIZE(par->dc_pal); i++) |
616 | par->pal[i] = read_dc(par, DC_PAL_DATA); | 616 | par->dc_pal[i] = read_dc(par, DC_PAL_DATA); |
617 | |||
618 | /* save the video processor palette */ | ||
619 | write_vp(par, VP_PAR, 0); | ||
620 | for (i = 0; i < ARRAY_SIZE(par->vp_pal); i++) | ||
621 | par->vp_pal[i] = read_vp(par, VP_PDR); | ||
617 | 622 | ||
618 | /* save the horizontal filter coefficients */ | 623 | /* save the horizontal filter coefficients */ |
619 | filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; | 624 | filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; |
@@ -706,8 +711,8 @@ static void lx_restore_display_ctlr(struct lxfb_par *par) | |||
706 | 711 | ||
707 | /* restore the palette */ | 712 | /* restore the palette */ |
708 | write_dc(par, DC_PAL_ADDRESS, 0); | 713 | write_dc(par, DC_PAL_ADDRESS, 0); |
709 | for (i = 0; i < ARRAY_SIZE(par->pal); i++) | 714 | for (i = 0; i < ARRAY_SIZE(par->dc_pal); i++) |
710 | write_dc(par, DC_PAL_DATA, par->pal[i]); | 715 | write_dc(par, DC_PAL_DATA, par->dc_pal[i]); |
711 | 716 | ||
712 | /* restore the horizontal filter coefficients */ | 717 | /* restore the horizontal filter coefficients */ |
713 | filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; | 718 | filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; |
@@ -751,6 +756,11 @@ static void lx_restore_video_proc(struct lxfb_par *par) | |||
751 | } | 756 | } |
752 | } | 757 | } |
753 | 758 | ||
759 | /* restore video processor palette */ | ||
760 | write_vp(par, VP_PAR, 0); | ||
761 | for (i = 0; i < ARRAY_SIZE(par->vp_pal); i++) | ||
762 | write_vp(par, VP_PDR, par->vp_pal[i]); | ||
763 | |||
754 | /* restore video coeff ram */ | 764 | /* restore video coeff ram */ |
755 | memcpy(par->vp_regs + VP_VCR, par->vp_coeff, sizeof(par->vp_coeff)); | 765 | memcpy(par->vp_regs + VP_VCR, par->vp_coeff, sizeof(par->vp_coeff)); |
756 | } | 766 | } |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 5c363d026f64..1ab2c2588675 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -53,11 +53,8 @@ | |||
53 | #define LCDC_SIZE 0x04 | 53 | #define LCDC_SIZE 0x04 |
54 | #define SIZE_XMAX(x) ((((x) >> 4) & 0x3f) << 20) | 54 | #define SIZE_XMAX(x) ((((x) >> 4) & 0x3f) << 20) |
55 | 55 | ||
56 | #ifdef CONFIG_ARCH_MX1 | 56 | #define YMAX_MASK (cpu_is_mx1() ? 0x1ff : 0x3ff) |
57 | #define SIZE_YMAX(y) ((y) & 0x1ff) | 57 | #define SIZE_YMAX(y) ((y) & YMAX_MASK) |
58 | #else | ||
59 | #define SIZE_YMAX(y) ((y) & 0x3ff) | ||
60 | #endif | ||
61 | 58 | ||
62 | #define LCDC_VPW 0x08 | 59 | #define LCDC_VPW 0x08 |
63 | #define VPW_VPW(x) ((x) & 0x3ff) | 60 | #define VPW_VPW(x) ((x) & 0x3ff) |
@@ -623,7 +620,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf | |||
623 | if (var->right_margin > 255) | 620 | if (var->right_margin > 255) |
624 | printk(KERN_ERR "%s: invalid right_margin %d\n", | 621 | printk(KERN_ERR "%s: invalid right_margin %d\n", |
625 | info->fix.id, var->right_margin); | 622 | info->fix.id, var->right_margin); |
626 | if (var->yres < 1 || var->yres > 511) | 623 | if (var->yres < 1 || var->yres > YMAX_MASK) |
627 | printk(KERN_ERR "%s: invalid yres %d\n", | 624 | printk(KERN_ERR "%s: invalid yres %d\n", |
628 | info->fix.id, var->yres); | 625 | info->fix.id, var->yres); |
629 | if (var->vsync_len > 100) | 626 | if (var->vsync_len > 100) |
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 0a4dbdc1693a..de450c1fb869 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c | |||
@@ -855,6 +855,7 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode, | |||
855 | abs(cmode->yres - mode->yres); | 855 | abs(cmode->yres - mode->yres); |
856 | if (diff > d) { | 856 | if (diff > d) { |
857 | diff = d; | 857 | diff = d; |
858 | diff_refresh = abs(cmode->refresh - mode->refresh); | ||
858 | best = cmode; | 859 | best = cmode; |
859 | } else if (diff == d) { | 860 | } else if (diff == d) { |
860 | d = abs(cmode->refresh - mode->refresh); | 861 | d = abs(cmode->refresh - mode->refresh); |
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig index 455c6055325d..083c8fe53e24 100644 --- a/drivers/video/omap/Kconfig +++ b/drivers/video/omap/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config FB_OMAP | 1 | config FB_OMAP |
2 | tristate "OMAP frame buffer support (EXPERIMENTAL)" | 2 | tristate "OMAP frame buffer support (EXPERIMENTAL)" |
3 | depends on FB && ARCH_OMAP && (OMAP2_DSS = "n") | 3 | depends on FB && (OMAP2_DSS = "n") |
4 | 4 | depends on ARCH_OMAP1 || ARCH_OMAP2 || ARCH_OMAP3 | |
5 | select FB_CFB_FILLRECT | 5 | select FB_CFB_FILLRECT |
6 | select FB_CFB_COPYAREA | 6 | select FB_CFB_COPYAREA |
7 | select FB_CFB_IMAGEBLIT | 7 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c index 2fd7e5271be9..9441e2eb3dee 100644 --- a/drivers/video/omap2/vram.c +++ b/drivers/video/omap2/vram.c | |||
@@ -551,7 +551,7 @@ void __init omap_vram_reserve_sdram_memblock(void) | |||
551 | if (!size) | 551 | if (!size) |
552 | return; | 552 | return; |
553 | 553 | ||
554 | size = PAGE_ALIGN(size); | 554 | size = ALIGN(size, SZ_2M); |
555 | 555 | ||
556 | if (paddr) { | 556 | if (paddr) { |
557 | if (paddr & ~PAGE_MASK) { | 557 | if (paddr & ~PAGE_MASK) { |
@@ -576,7 +576,7 @@ void __init omap_vram_reserve_sdram_memblock(void) | |||
576 | return; | 576 | return; |
577 | } | 577 | } |
578 | } else { | 578 | } else { |
579 | paddr = memblock_alloc(size, PAGE_SIZE); | 579 | paddr = memblock_alloc(size, SZ_2M); |
580 | } | 580 | } |
581 | 581 | ||
582 | memblock_free(paddr, size); | 582 | memblock_free(paddr, size); |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index d7df10315d8d..fcda0e970113 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -787,6 +787,9 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi) | |||
787 | found_rate_error = rate_error; | 787 | found_rate_error = rate_error; |
788 | } | 788 | } |
789 | 789 | ||
790 | hdmi->var.width = hdmi->monspec.max_x * 10; | ||
791 | hdmi->var.height = hdmi->monspec.max_y * 10; | ||
792 | |||
790 | /* | 793 | /* |
791 | * TODO 1: if no ->info is present, postpone running the config until | 794 | * TODO 1: if no ->info is present, postpone running the config until |
792 | * after ->info first gets registered. | 795 | * after ->info first gets registered. |
@@ -960,8 +963,12 @@ static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi) | |||
960 | dev_dbg(info->dev, "Old %ux%u, new %ux%u\n", | 963 | dev_dbg(info->dev, "Old %ux%u, new %ux%u\n", |
961 | mode1.xres, mode1.yres, mode2.xres, mode2.yres); | 964 | mode1.xres, mode1.yres, mode2.xres, mode2.yres); |
962 | 965 | ||
963 | if (fb_mode_is_equal(&mode1, &mode2)) | 966 | if (fb_mode_is_equal(&mode1, &mode2)) { |
967 | /* It can be a different monitor with an equal video-mode */ | ||
968 | old_var->width = new_var->width; | ||
969 | old_var->height = new_var->height; | ||
964 | return false; | 970 | return false; |
971 | } | ||
965 | 972 | ||
966 | dev_dbg(info->dev, "Switching %u -> %u lines\n", | 973 | dev_dbg(info->dev, "Switching %u -> %u lines\n", |
967 | mode1.yres, mode2.yres); | 974 | mode1.yres, mode2.yres); |
@@ -1057,8 +1064,11 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1057 | * on, if we run a resume here, the logo disappears | 1064 | * on, if we run a resume here, the logo disappears |
1058 | */ | 1065 | */ |
1059 | if (lock_fb_info(hdmi->info)) { | 1066 | if (lock_fb_info(hdmi->info)) { |
1060 | sh_hdmi_display_on(hdmi, hdmi->info); | 1067 | struct fb_info *info = hdmi->info; |
1061 | unlock_fb_info(hdmi->info); | 1068 | info->var.width = hdmi->var.width; |
1069 | info->var.height = hdmi->var.height; | ||
1070 | sh_hdmi_display_on(hdmi, info); | ||
1071 | unlock_fb_info(info); | ||
1062 | } | 1072 | } |
1063 | } else { | 1073 | } else { |
1064 | /* New monitor or have to wake up */ | 1074 | /* New monitor or have to wake up */ |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index b02d97a879d6..c05326b61235 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -54,8 +54,8 @@ static int lcdc_shared_regs[] = { | |||
54 | }; | 54 | }; |
55 | #define NR_SHARED_REGS ARRAY_SIZE(lcdc_shared_regs) | 55 | #define NR_SHARED_REGS ARRAY_SIZE(lcdc_shared_regs) |
56 | 56 | ||
57 | #define DEFAULT_XRES 1280 | 57 | #define MAX_XRES 1920 |
58 | #define DEFAULT_YRES 1024 | 58 | #define MAX_YRES 1080 |
59 | 59 | ||
60 | static unsigned long lcdc_offs_mainlcd[NR_CH_REGS] = { | 60 | static unsigned long lcdc_offs_mainlcd[NR_CH_REGS] = { |
61 | [LDDCKPAT1R] = 0x400, | 61 | [LDDCKPAT1R] = 0x400, |
@@ -914,22 +914,12 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in | |||
914 | { | 914 | { |
915 | struct sh_mobile_lcdc_chan *ch = info->par; | 915 | struct sh_mobile_lcdc_chan *ch = info->par; |
916 | 916 | ||
917 | if (var->xres < 160 || var->xres > 1920 || | 917 | if (var->xres > MAX_XRES || var->yres > MAX_YRES || |
918 | var->yres < 120 || var->yres > 1080 || | ||
919 | var->left_margin < 32 || var->left_margin > 320 || | ||
920 | var->right_margin < 12 || var->right_margin > 240 || | ||
921 | var->upper_margin < 12 || var->upper_margin > 120 || | ||
922 | var->lower_margin < 1 || var->lower_margin > 64 || | ||
923 | var->hsync_len < 32 || var->hsync_len > 240 || | ||
924 | var->vsync_len < 2 || var->vsync_len > 64 || | ||
925 | var->pixclock < 6000 || var->pixclock > 40000 || | ||
926 | var->xres * var->yres * (ch->cfg.bpp / 8) * 2 > info->fix.smem_len) { | 918 | var->xres * var->yres * (ch->cfg.bpp / 8) * 2 > info->fix.smem_len) { |
927 | dev_warn(info->dev, "Invalid info: %u %u %u %u %u %u %u %u %u!\n", | 919 | dev_warn(info->dev, "Invalid info: %u-%u-%u-%u x %u-%u-%u-%u @ %ukHz!\n", |
928 | var->xres, var->yres, | 920 | var->left_margin, var->xres, var->right_margin, var->hsync_len, |
929 | var->left_margin, var->right_margin, | 921 | var->upper_margin, var->yres, var->lower_margin, var->vsync_len, |
930 | var->upper_margin, var->lower_margin, | 922 | PICOS2KHZ(var->pixclock)); |
931 | var->hsync_len, var->vsync_len, | ||
932 | var->pixclock); | ||
933 | return -EINVAL; | 923 | return -EINVAL; |
934 | } | 924 | } |
935 | return 0; | 925 | return 0; |
@@ -1226,7 +1216,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1226 | } | 1216 | } |
1227 | 1217 | ||
1228 | if (!mode) | 1218 | if (!mode) |
1229 | max_size = DEFAULT_XRES * DEFAULT_YRES; | 1219 | max_size = MAX_XRES * MAX_YRES; |
1230 | else if (max_cfg) | 1220 | else if (max_cfg) |
1231 | dev_dbg(&pdev->dev, "Found largest videomode %ux%u\n", | 1221 | dev_dbg(&pdev->dev, "Found largest videomode %ux%u\n", |
1232 | max_cfg->xres, max_cfg->yres); | 1222 | max_cfg->xres, max_cfg->yres); |
@@ -1238,12 +1228,14 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1238 | mode = &default_720p; | 1228 | mode = &default_720p; |
1239 | num_cfg = 1; | 1229 | num_cfg = 1; |
1240 | } else { | 1230 | } else { |
1241 | num_cfg = ch->cfg.num_cfg; | 1231 | num_cfg = cfg->num_cfg; |
1242 | } | 1232 | } |
1243 | 1233 | ||
1244 | fb_videomode_to_modelist(mode, num_cfg, &info->modelist); | 1234 | fb_videomode_to_modelist(mode, num_cfg, &info->modelist); |
1245 | 1235 | ||
1246 | fb_videomode_to_var(var, mode); | 1236 | fb_videomode_to_var(var, mode); |
1237 | var->width = cfg->lcd_size_cfg.width; | ||
1238 | var->height = cfg->lcd_size_cfg.height; | ||
1247 | /* Default Y virtual resolution is 2x panel size */ | 1239 | /* Default Y virtual resolution is 2x panel size */ |
1248 | var->yres_virtual = var->yres * 2; | 1240 | var->yres_virtual = var->yres * 2; |
1249 | var->activate = FB_ACTIVATE_NOW; | 1241 | var->activate = FB_ACTIVATE_NOW; |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 4a291045ebac..a5ad77ef4266 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -558,6 +558,9 @@ config IT8712F_WDT | |||
558 | This is the driver for the built-in watchdog timer on the IT8712F | 558 | This is the driver for the built-in watchdog timer on the IT8712F |
559 | Super I/0 chipset used on many motherboards. | 559 | Super I/0 chipset used on many motherboards. |
560 | 560 | ||
561 | If the driver does not work, then make sure that the game port in | ||
562 | the BIOS is enabled. | ||
563 | |||
561 | To compile this driver as a module, choose M here: the | 564 | To compile this driver as a module, choose M here: the |
562 | module will be called it8712f_wdt. | 565 | module will be called it8712f_wdt. |
563 | 566 | ||
diff --git a/drivers/watchdog/bcm63xx_wdt.c b/drivers/watchdog/bcm63xx_wdt.c index a1debc89356b..3c5045a206dd 100644 --- a/drivers/watchdog/bcm63xx_wdt.c +++ b/drivers/watchdog/bcm63xx_wdt.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/moduleparam.h> | 20 | #include <linux/moduleparam.h> |
21 | #include <linux/reboot.h> | ||
22 | #include <linux/types.h> | 21 | #include <linux/types.h> |
23 | #include <linux/uaccess.h> | 22 | #include <linux/uaccess.h> |
24 | #include <linux/watchdog.h> | 23 | #include <linux/watchdog.h> |
@@ -220,14 +219,6 @@ static long bcm63xx_wdt_ioctl(struct file *file, unsigned int cmd, | |||
220 | } | 219 | } |
221 | } | 220 | } |
222 | 221 | ||
223 | static int bcm63xx_wdt_notify_sys(struct notifier_block *this, | ||
224 | unsigned long code, void *unused) | ||
225 | { | ||
226 | if (code == SYS_DOWN || code == SYS_HALT) | ||
227 | bcm63xx_wdt_pause(); | ||
228 | return NOTIFY_DONE; | ||
229 | } | ||
230 | |||
231 | static const struct file_operations bcm63xx_wdt_fops = { | 222 | static const struct file_operations bcm63xx_wdt_fops = { |
232 | .owner = THIS_MODULE, | 223 | .owner = THIS_MODULE, |
233 | .llseek = no_llseek, | 224 | .llseek = no_llseek, |
@@ -243,12 +234,8 @@ static struct miscdevice bcm63xx_wdt_miscdev = { | |||
243 | .fops = &bcm63xx_wdt_fops, | 234 | .fops = &bcm63xx_wdt_fops, |
244 | }; | 235 | }; |
245 | 236 | ||
246 | static struct notifier_block bcm63xx_wdt_notifier = { | ||
247 | .notifier_call = bcm63xx_wdt_notify_sys, | ||
248 | }; | ||
249 | 237 | ||
250 | 238 | static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev) | |
251 | static int bcm63xx_wdt_probe(struct platform_device *pdev) | ||
252 | { | 239 | { |
253 | int ret; | 240 | int ret; |
254 | struct resource *r; | 241 | struct resource *r; |
@@ -280,16 +267,10 @@ static int bcm63xx_wdt_probe(struct platform_device *pdev) | |||
280 | wdt_time); | 267 | wdt_time); |
281 | } | 268 | } |
282 | 269 | ||
283 | ret = register_reboot_notifier(&bcm63xx_wdt_notifier); | ||
284 | if (ret) { | ||
285 | dev_err(&pdev->dev, "failed to register reboot_notifier\n"); | ||
286 | goto unregister_timer; | ||
287 | } | ||
288 | |||
289 | ret = misc_register(&bcm63xx_wdt_miscdev); | 270 | ret = misc_register(&bcm63xx_wdt_miscdev); |
290 | if (ret < 0) { | 271 | if (ret < 0) { |
291 | dev_err(&pdev->dev, "failed to register watchdog device\n"); | 272 | dev_err(&pdev->dev, "failed to register watchdog device\n"); |
292 | goto unregister_reboot_notifier; | 273 | goto unregister_timer; |
293 | } | 274 | } |
294 | 275 | ||
295 | dev_info(&pdev->dev, " started, timer margin: %d sec\n", | 276 | dev_info(&pdev->dev, " started, timer margin: %d sec\n", |
@@ -297,8 +278,6 @@ static int bcm63xx_wdt_probe(struct platform_device *pdev) | |||
297 | 278 | ||
298 | return 0; | 279 | return 0; |
299 | 280 | ||
300 | unregister_reboot_notifier: | ||
301 | unregister_reboot_notifier(&bcm63xx_wdt_notifier); | ||
302 | unregister_timer: | 281 | unregister_timer: |
303 | bcm63xx_timer_unregister(TIMER_WDT_ID); | 282 | bcm63xx_timer_unregister(TIMER_WDT_ID); |
304 | unmap: | 283 | unmap: |
@@ -306,25 +285,28 @@ unmap: | |||
306 | return ret; | 285 | return ret; |
307 | } | 286 | } |
308 | 287 | ||
309 | static int bcm63xx_wdt_remove(struct platform_device *pdev) | 288 | static int __devexit bcm63xx_wdt_remove(struct platform_device *pdev) |
310 | { | 289 | { |
311 | if (!nowayout) | 290 | if (!nowayout) |
312 | bcm63xx_wdt_pause(); | 291 | bcm63xx_wdt_pause(); |
313 | 292 | ||
314 | misc_deregister(&bcm63xx_wdt_miscdev); | 293 | misc_deregister(&bcm63xx_wdt_miscdev); |
315 | |||
316 | iounmap(bcm63xx_wdt_device.regs); | ||
317 | |||
318 | unregister_reboot_notifier(&bcm63xx_wdt_notifier); | ||
319 | bcm63xx_timer_unregister(TIMER_WDT_ID); | 294 | bcm63xx_timer_unregister(TIMER_WDT_ID); |
320 | 295 | iounmap(bcm63xx_wdt_device.regs); | |
321 | return 0; | 296 | return 0; |
322 | } | 297 | } |
323 | 298 | ||
299 | static void bcm63xx_wdt_shutdown(struct platform_device *pdev) | ||
300 | { | ||
301 | bcm63xx_wdt_pause(); | ||
302 | } | ||
303 | |||
324 | static struct platform_driver bcm63xx_wdt = { | 304 | static struct platform_driver bcm63xx_wdt = { |
325 | .probe = bcm63xx_wdt_probe, | 305 | .probe = bcm63xx_wdt_probe, |
326 | .remove = bcm63xx_wdt_remove, | 306 | .remove = __devexit_p(bcm63xx_wdt_remove), |
307 | .shutdown = bcm63xx_wdt_shutdown, | ||
327 | .driver = { | 308 | .driver = { |
309 | .owner = THIS_MODULE, | ||
328 | .name = "bcm63xx-wdt", | 310 | .name = "bcm63xx-wdt", |
329 | } | 311 | } |
330 | }; | 312 | }; |
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index 9c21d19043a6..f6bd6f10fcec 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/miscdevice.h> | 31 | #include <linux/miscdevice.h> |
32 | #include <linux/watchdog.h> | 32 | #include <linux/watchdog.h> |
33 | #include <linux/fs.h> | ||
33 | #include <linux/of.h> | 34 | #include <linux/of.h> |
34 | #include <linux/of_platform.h> | 35 | #include <linux/of_platform.h> |
35 | #include <linux/io.h> | 36 | #include <linux/io.h> |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index f7e90fe47b71..b8838d2c67a6 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -32,6 +32,7 @@ | |||
32 | * document number 322169-001, 322170-003: 5 Series, 3400 Series (PCH) | 32 | * document number 322169-001, 322170-003: 5 Series, 3400 Series (PCH) |
33 | * document number 320066-003, 320257-008: EP80597 (IICH) | 33 | * document number 320066-003, 320257-008: EP80597 (IICH) |
34 | * document number TBD : Cougar Point (CPT) | 34 | * document number TBD : Cougar Point (CPT) |
35 | * document number TBD : Patsburg (PBG) | ||
35 | */ | 36 | */ |
36 | 37 | ||
37 | /* | 38 | /* |
@@ -146,7 +147,8 @@ enum iTCO_chipsets { | |||
146 | TCO_CPT29, /* Cougar Point */ | 147 | TCO_CPT29, /* Cougar Point */ |
147 | TCO_CPT30, /* Cougar Point */ | 148 | TCO_CPT30, /* Cougar Point */ |
148 | TCO_CPT31, /* Cougar Point */ | 149 | TCO_CPT31, /* Cougar Point */ |
149 | TCO_PBG, /* Patsburg */ | 150 | TCO_PBG1, /* Patsburg */ |
151 | TCO_PBG2, /* Patsburg */ | ||
150 | }; | 152 | }; |
151 | 153 | ||
152 | static struct { | 154 | static struct { |
@@ -235,6 +237,7 @@ static struct { | |||
235 | {"Cougar Point", 2}, | 237 | {"Cougar Point", 2}, |
236 | {"Cougar Point", 2}, | 238 | {"Cougar Point", 2}, |
237 | {"Patsburg", 2}, | 239 | {"Patsburg", 2}, |
240 | {"Patsburg", 2}, | ||
238 | {NULL, 0} | 241 | {NULL, 0} |
239 | }; | 242 | }; |
240 | 243 | ||
@@ -350,7 +353,8 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = { | |||
350 | { ITCO_PCI_DEVICE(0x1c5d, TCO_CPT29)}, | 353 | { ITCO_PCI_DEVICE(0x1c5d, TCO_CPT29)}, |
351 | { ITCO_PCI_DEVICE(0x1c5e, TCO_CPT30)}, | 354 | { ITCO_PCI_DEVICE(0x1c5e, TCO_CPT30)}, |
352 | { ITCO_PCI_DEVICE(0x1c5f, TCO_CPT31)}, | 355 | { ITCO_PCI_DEVICE(0x1c5f, TCO_CPT31)}, |
353 | { ITCO_PCI_DEVICE(0x1d40, TCO_PBG)}, | 356 | { ITCO_PCI_DEVICE(0x1d40, TCO_PBG1)}, |
357 | { ITCO_PCI_DEVICE(0x1d41, TCO_PBG2)}, | ||
354 | { 0, }, /* End of list */ | 358 | { 0, }, /* End of list */ |
355 | }; | 359 | }; |
356 | MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); | 360 | MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); |
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index 428f8a1583e8..3939e53f5f98 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c | |||
@@ -231,7 +231,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev) | |||
231 | struct resource *r; | 231 | struct resource *r; |
232 | struct rdc321x_wdt_pdata *pdata; | 232 | struct rdc321x_wdt_pdata *pdata; |
233 | 233 | ||
234 | pdata = pdev->dev.platform_data; | 234 | pdata = platform_get_drvdata(pdev); |
235 | if (!pdata) { | 235 | if (!pdata) { |
236 | dev_err(&pdev->dev, "no platform data supplied\n"); | 236 | dev_err(&pdev->dev, "no platform data supplied\n"); |
237 | return -ENODEV; | 237 | return -ENODEV; |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 2b17ad5b4b32..43f9f02c7db0 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -412,8 +412,16 @@ static int __init balloon_init(void) | |||
412 | 412 | ||
413 | register_balloon(&balloon_sysdev); | 413 | register_balloon(&balloon_sysdev); |
414 | 414 | ||
415 | /* Initialise the balloon with excess memory space. */ | 415 | /* |
416 | extra_pfn_end = min(e820_end_of_ram_pfn(), | 416 | * Initialise the balloon with excess memory space. We need |
417 | * to make sure we don't add memory which doesn't exist or | ||
418 | * logically exist. The E820 map can be trimmed to be smaller | ||
419 | * than the amount of physical memory due to the mem= command | ||
420 | * line parameter. And if this is a 32-bit non-HIGHMEM kernel | ||
421 | * on a system with memory which requires highmem to access, | ||
422 | * don't try to use it. | ||
423 | */ | ||
424 | extra_pfn_end = min(min(max_pfn, e820_end_of_ram_pfn()), | ||
417 | (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); | 425 | (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); |
418 | for (pfn = PFN_UP(xen_extra_mem_start); | 426 | for (pfn = PFN_UP(xen_extra_mem_start); |
419 | pfn < extra_pfn_end; | 427 | pfn < extra_pfn_end; |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 2811bb988ea0..31af0ac31a98 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -105,7 +105,6 @@ struct irq_info | |||
105 | 105 | ||
106 | static struct irq_info *irq_info; | 106 | static struct irq_info *irq_info; |
107 | static int *pirq_to_irq; | 107 | static int *pirq_to_irq; |
108 | static int nr_pirqs; | ||
109 | 108 | ||
110 | static int *evtchn_to_irq; | 109 | static int *evtchn_to_irq; |
111 | struct cpu_evtchn_s { | 110 | struct cpu_evtchn_s { |
@@ -385,12 +384,17 @@ static int get_nr_hw_irqs(void) | |||
385 | return ret; | 384 | return ret; |
386 | } | 385 | } |
387 | 386 | ||
388 | /* callers of this function should make sure that PHYSDEVOP_get_nr_pirqs | 387 | static int find_unbound_pirq(int type) |
389 | * succeeded otherwise nr_pirqs won't hold the right value */ | ||
390 | static int find_unbound_pirq(void) | ||
391 | { | 388 | { |
392 | int i; | 389 | int rc, i; |
393 | for (i = nr_pirqs-1; i >= 0; i--) { | 390 | struct physdev_get_free_pirq op_get_free_pirq; |
391 | op_get_free_pirq.type = type; | ||
392 | |||
393 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_free_pirq, &op_get_free_pirq); | ||
394 | if (!rc) | ||
395 | return op_get_free_pirq.pirq; | ||
396 | |||
397 | for (i = 0; i < nr_irqs; i++) { | ||
394 | if (pirq_to_irq[i] < 0) | 398 | if (pirq_to_irq[i] < 0) |
395 | return i; | 399 | return i; |
396 | } | 400 | } |
@@ -423,7 +427,7 @@ static int find_unbound_irq(void) | |||
423 | if (irq == start) | 427 | if (irq == start) |
424 | goto no_irqs; | 428 | goto no_irqs; |
425 | 429 | ||
426 | res = irq_alloc_desc_at(irq, 0); | 430 | res = irq_alloc_desc_at(irq, -1); |
427 | 431 | ||
428 | if (WARN_ON(res != irq)) | 432 | if (WARN_ON(res != irq)) |
429 | return -1; | 433 | return -1; |
@@ -611,10 +615,10 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name) | |||
611 | 615 | ||
612 | spin_lock(&irq_mapping_update_lock); | 616 | spin_lock(&irq_mapping_update_lock); |
613 | 617 | ||
614 | if ((pirq > nr_pirqs) || (gsi > nr_irqs)) { | 618 | if ((pirq > nr_irqs) || (gsi > nr_irqs)) { |
615 | printk(KERN_WARNING "xen_map_pirq_gsi: %s %s is incorrect!\n", | 619 | printk(KERN_WARNING "xen_map_pirq_gsi: %s %s is incorrect!\n", |
616 | pirq > nr_pirqs ? "nr_pirqs" :"", | 620 | pirq > nr_irqs ? "pirq" :"", |
617 | gsi > nr_irqs ? "nr_irqs" : ""); | 621 | gsi > nr_irqs ? "gsi" : ""); |
618 | goto out; | 622 | goto out; |
619 | } | 623 | } |
620 | 624 | ||
@@ -630,7 +634,7 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name) | |||
630 | if (identity_mapped_irq(gsi) || (!xen_initial_domain() && | 634 | if (identity_mapped_irq(gsi) || (!xen_initial_domain() && |
631 | xen_pv_domain())) { | 635 | xen_pv_domain())) { |
632 | irq = gsi; | 636 | irq = gsi; |
633 | irq_alloc_desc_at(irq, 0); | 637 | irq_alloc_desc_at(irq, -1); |
634 | } else | 638 | } else |
635 | irq = find_unbound_irq(); | 639 | irq = find_unbound_irq(); |
636 | 640 | ||
@@ -664,17 +668,21 @@ out: | |||
664 | #include <linux/msi.h> | 668 | #include <linux/msi.h> |
665 | #include "../pci/msi.h" | 669 | #include "../pci/msi.h" |
666 | 670 | ||
667 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq) | 671 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc) |
668 | { | 672 | { |
669 | spin_lock(&irq_mapping_update_lock); | 673 | spin_lock(&irq_mapping_update_lock); |
670 | 674 | ||
671 | *irq = find_unbound_irq(); | 675 | if (alloc & XEN_ALLOC_IRQ) { |
672 | if (*irq == -1) | 676 | *irq = find_unbound_irq(); |
673 | goto out; | 677 | if (*irq == -1) |
678 | goto out; | ||
679 | } | ||
674 | 680 | ||
675 | *pirq = find_unbound_pirq(); | 681 | if (alloc & XEN_ALLOC_PIRQ) { |
676 | if (*pirq == -1) | 682 | *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI); |
677 | goto out; | 683 | if (*pirq == -1) |
684 | goto out; | ||
685 | } | ||
678 | 686 | ||
679 | set_irq_chip_and_handler_name(*irq, &xen_pirq_chip, | 687 | set_irq_chip_and_handler_name(*irq, &xen_pirq_chip, |
680 | handle_level_irq, name); | 688 | handle_level_irq, name); |
@@ -762,6 +770,7 @@ int xen_destroy_irq(int irq) | |||
762 | printk(KERN_WARNING "unmap irq failed %d\n", rc); | 770 | printk(KERN_WARNING "unmap irq failed %d\n", rc); |
763 | goto out; | 771 | goto out; |
764 | } | 772 | } |
773 | pirq_to_irq[info->u.pirq.pirq] = -1; | ||
765 | } | 774 | } |
766 | irq_info[irq] = mk_unbound_info(); | 775 | irq_info[irq] = mk_unbound_info(); |
767 | 776 | ||
@@ -782,6 +791,11 @@ int xen_gsi_from_irq(unsigned irq) | |||
782 | return gsi_from_irq(irq); | 791 | return gsi_from_irq(irq); |
783 | } | 792 | } |
784 | 793 | ||
794 | int xen_irq_from_pirq(unsigned pirq) | ||
795 | { | ||
796 | return pirq_to_irq[pirq]; | ||
797 | } | ||
798 | |||
785 | int bind_evtchn_to_irq(unsigned int evtchn) | 799 | int bind_evtchn_to_irq(unsigned int evtchn) |
786 | { | 800 | { |
787 | int irq; | 801 | int irq; |
@@ -1279,6 +1293,42 @@ static int retrigger_dynirq(unsigned int irq) | |||
1279 | return ret; | 1293 | return ret; |
1280 | } | 1294 | } |
1281 | 1295 | ||
1296 | static void restore_cpu_pirqs(void) | ||
1297 | { | ||
1298 | int pirq, rc, irq, gsi; | ||
1299 | struct physdev_map_pirq map_irq; | ||
1300 | |||
1301 | for (pirq = 0; pirq < nr_irqs; pirq++) { | ||
1302 | irq = pirq_to_irq[pirq]; | ||
1303 | if (irq == -1) | ||
1304 | continue; | ||
1305 | |||
1306 | /* save/restore of PT devices doesn't work, so at this point the | ||
1307 | * only devices present are GSI based emulated devices */ | ||
1308 | gsi = gsi_from_irq(irq); | ||
1309 | if (!gsi) | ||
1310 | continue; | ||
1311 | |||
1312 | map_irq.domid = DOMID_SELF; | ||
1313 | map_irq.type = MAP_PIRQ_TYPE_GSI; | ||
1314 | map_irq.index = gsi; | ||
1315 | map_irq.pirq = pirq; | ||
1316 | |||
1317 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq); | ||
1318 | if (rc) { | ||
1319 | printk(KERN_WARNING "xen map irq failed gsi=%d irq=%d pirq=%d rc=%d\n", | ||
1320 | gsi, irq, pirq, rc); | ||
1321 | irq_info[irq] = mk_unbound_info(); | ||
1322 | pirq_to_irq[pirq] = -1; | ||
1323 | continue; | ||
1324 | } | ||
1325 | |||
1326 | printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq); | ||
1327 | |||
1328 | startup_pirq(irq); | ||
1329 | } | ||
1330 | } | ||
1331 | |||
1282 | static void restore_cpu_virqs(unsigned int cpu) | 1332 | static void restore_cpu_virqs(unsigned int cpu) |
1283 | { | 1333 | { |
1284 | struct evtchn_bind_virq bind_virq; | 1334 | struct evtchn_bind_virq bind_virq; |
@@ -1422,6 +1472,8 @@ void xen_irq_resume(void) | |||
1422 | 1472 | ||
1423 | unmask_evtchn(evtchn); | 1473 | unmask_evtchn(evtchn); |
1424 | } | 1474 | } |
1475 | |||
1476 | restore_cpu_pirqs(); | ||
1425 | } | 1477 | } |
1426 | 1478 | ||
1427 | static struct irq_chip xen_dynamic_chip __read_mostly = { | 1479 | static struct irq_chip xen_dynamic_chip __read_mostly = { |
@@ -1506,26 +1558,17 @@ void xen_callback_vector(void) {} | |||
1506 | 1558 | ||
1507 | void __init xen_init_IRQ(void) | 1559 | void __init xen_init_IRQ(void) |
1508 | { | 1560 | { |
1509 | int i, rc; | 1561 | int i; |
1510 | struct physdev_nr_pirqs op_nr_pirqs; | ||
1511 | 1562 | ||
1512 | cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), | 1563 | cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), |
1513 | GFP_KERNEL); | 1564 | GFP_KERNEL); |
1514 | irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL); | 1565 | irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL); |
1515 | 1566 | ||
1516 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_nr_pirqs, &op_nr_pirqs); | 1567 | /* We are using nr_irqs as the maximum number of pirq available but |
1517 | if (rc < 0) { | 1568 | * that number is actually chosen by Xen and we don't know exactly |
1518 | nr_pirqs = nr_irqs; | 1569 | * what it is. Be careful choosing high pirq numbers. */ |
1519 | if (rc != -ENOSYS) | 1570 | pirq_to_irq = kcalloc(nr_irqs, sizeof(*pirq_to_irq), GFP_KERNEL); |
1520 | printk(KERN_WARNING "PHYSDEVOP_get_nr_pirqs returned rc=%d\n", rc); | 1571 | for (i = 0; i < nr_irqs; i++) |
1521 | } else { | ||
1522 | if (xen_pv_domain() && !xen_initial_domain()) | ||
1523 | nr_pirqs = max((int)op_nr_pirqs.nr_pirqs, nr_irqs); | ||
1524 | else | ||
1525 | nr_pirqs = op_nr_pirqs.nr_pirqs; | ||
1526 | } | ||
1527 | pirq_to_irq = kcalloc(nr_pirqs, sizeof(*pirq_to_irq), GFP_KERNEL); | ||
1528 | for (i = 0; i < nr_pirqs; i++) | ||
1529 | pirq_to_irq[i] = -1; | 1572 | pirq_to_irq[i] = -1; |
1530 | 1573 | ||
1531 | evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq), | 1574 | evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq), |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index ef9c7db52077..db8c4c4ac880 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -49,6 +49,7 @@ static int xen_hvm_suspend(void *data) | |||
49 | 49 | ||
50 | if (!*cancelled) { | 50 | if (!*cancelled) { |
51 | xen_irq_resume(); | 51 | xen_irq_resume(); |
52 | xen_console_resume(); | ||
52 | xen_timer_resume(); | 53 | xen_timer_resume(); |
53 | } | 54 | } |
54 | 55 | ||