diff options
Diffstat (limited to 'drivers')
179 files changed, 1391 insertions, 1077 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/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/battery.c b/drivers/acpi/battery.c index 95649d373071..9fb9d5ac939d 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -130,6 +130,8 @@ struct acpi_battery { | |||
130 | unsigned long flags; | 130 | unsigned long flags; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static int acpi_battery_update(struct acpi_battery *battery); | ||
134 | |||
133 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 135 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
134 | 136 | ||
135 | inline int acpi_battery_present(struct acpi_battery *battery) | 137 | inline int acpi_battery_present(struct acpi_battery *battery) |
@@ -184,6 +186,9 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
184 | int ret = 0; | 186 | int ret = 0; |
185 | struct acpi_battery *battery = to_acpi_battery(psy); | 187 | struct acpi_battery *battery = to_acpi_battery(psy); |
186 | 188 | ||
189 | if (acpi_battery_update(battery)) | ||
190 | return -ENODEV; | ||
191 | |||
187 | if (acpi_battery_present(battery)) { | 192 | if (acpi_battery_present(battery)) { |
188 | /* run battery update only if it is present */ | 193 | /* run battery update only if it is present */ |
189 | acpi_battery_get_state(battery); | 194 | acpi_battery_get_state(battery); |
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/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/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/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/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/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/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/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/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/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_irq.c b/drivers/gpu/drm/drm_irq.c index 722700d5d73e..16d5155edad1 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -628,7 +628,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, | |||
628 | if ((seq - vblwait->request.sequence) <= (1 << 23)) { | 628 | if ((seq - vblwait->request.sequence) <= (1 << 23)) { |
629 | e->event.tv_sec = now.tv_sec; | 629 | e->event.tv_sec = now.tv_sec; |
630 | e->event.tv_usec = now.tv_usec; | 630 | e->event.tv_usec = now.tv_usec; |
631 | drm_vblank_put(dev, e->pipe); | 631 | drm_vblank_put(dev, pipe); |
632 | 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); |
633 | wake_up_interruptible(&e->base.file_priv->event_wait); | 633 | wake_up_interruptible(&e->base.file_priv->event_wait); |
634 | trace_drm_vblank_event_delivered(current->pid, pipe, | 634 | trace_drm_vblank_event_delivered(current->pid, pipe, |
@@ -645,7 +645,7 @@ err_unlock: | |||
645 | spin_unlock_irqrestore(&dev->event_lock, flags); | 645 | spin_unlock_irqrestore(&dev->event_lock, flags); |
646 | kfree(e); | 646 | kfree(e); |
647 | err_put: | 647 | err_put: |
648 | drm_vblank_put(dev, e->pipe); | 648 | drm_vblank_put(dev, pipe); |
649 | return ret; | 649 | return ret; |
650 | } | 650 | } |
651 | 651 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index a322d4f647bd..4d7a2e1bdb90 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); |
@@ -3485,10 +3488,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev) | |||
3485 | void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) | 3488 | void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) |
3486 | { | 3489 | { |
3487 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 3490 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
3488 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 3491 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL. |
3492 | * This seems to cause problems on some AGP cards. Just use the old | ||
3493 | * method for them. | ||
3489 | */ | 3494 | */ |
3490 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && | 3495 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
3491 | rdev->vram_scratch.ptr) { | 3496 | rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) { |
3492 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | 3497 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; |
3493 | u32 tmp; | 3498 | u32 tmp; |
3494 | 3499 | ||
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/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/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/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/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 4852b440960a..435b0af401e4 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1436,6 +1436,8 @@ 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 }; | ||
1439 | static struct wacom_features wacom_features_0xD8 = | 1441 | static struct wacom_features wacom_features_0xD8 = |
1440 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1442 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1441 | static struct wacom_features wacom_features_0xDA = | 1443 | static struct wacom_features wacom_features_0xDA = |
@@ -1510,6 +1512,7 @@ const struct usb_device_id wacom_ids[] = { | |||
1510 | { USB_DEVICE_WACOM(0xD1) }, | 1512 | { USB_DEVICE_WACOM(0xD1) }, |
1511 | { USB_DEVICE_WACOM(0xD2) }, | 1513 | { USB_DEVICE_WACOM(0xD2) }, |
1512 | { USB_DEVICE_WACOM(0xD3) }, | 1514 | { USB_DEVICE_WACOM(0xD3) }, |
1515 | { USB_DEVICE_WACOM(0xD4) }, | ||
1513 | { USB_DEVICE_WACOM(0xD8) }, | 1516 | { USB_DEVICE_WACOM(0xD8) }, |
1514 | { USB_DEVICE_WACOM(0xDA) }, | 1517 | { USB_DEVICE_WACOM(0xDA) }, |
1515 | { USB_DEVICE_WACOM(0xDB) }, | 1518 | { USB_DEVICE_WACOM(0xDB) }, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 84c46a161927..e71c5fa527f5 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 | ||
@@ -5160,7 +5159,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5160 | PTR_ERR(rdev)); | 5159 | PTR_ERR(rdev)); |
5161 | return PTR_ERR(rdev); | 5160 | return PTR_ERR(rdev); |
5162 | } | 5161 | } |
5163 | /* set save_raid_disk if appropriate */ | 5162 | /* set saved_raid_disk if appropriate */ |
5164 | if (!mddev->persistent) { | 5163 | if (!mddev->persistent) { |
5165 | if (info->state & (1<<MD_DISK_SYNC) && | 5164 | if (info->state & (1<<MD_DISK_SYNC) && |
5166 | info->raid_disk < mddev->raid_disks) | 5165 | info->raid_disk < mddev->raid_disks) |
@@ -5170,7 +5169,10 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5170 | } else | 5169 | } else |
5171 | super_types[mddev->major_version]. | 5170 | super_types[mddev->major_version]. |
5172 | validate_super(mddev, rdev); | 5171 | validate_super(mddev, rdev); |
5173 | rdev->saved_raid_disk = rdev->raid_disk; | 5172 | if (test_bit(In_sync, &rdev->flags)) |
5173 | rdev->saved_raid_disk = rdev->raid_disk; | ||
5174 | else | ||
5175 | rdev->saved_raid_disk = -1; | ||
5174 | 5176 | ||
5175 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ | 5177 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ |
5176 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) | 5178 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) |
@@ -6042,9 +6044,8 @@ static int md_thread(void * arg) | |||
6042 | || kthread_should_stop(), | 6044 | || kthread_should_stop(), |
6043 | thread->timeout); | 6045 | thread->timeout); |
6044 | 6046 | ||
6045 | clear_bit(THREAD_WAKEUP, &thread->flags); | 6047 | if (test_and_clear_bit(THREAD_WAKEUP, &thread->flags)) |
6046 | 6048 | thread->run(thread->mddev); | |
6047 | thread->run(thread->mddev); | ||
6048 | } | 6049 | } |
6049 | 6050 | ||
6050 | return 0; | 6051 | 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/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 03829e6818bd..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 */ |
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/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/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 260c666ce931..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 = { |
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-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/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/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/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/sh_vou.c b/drivers/media/video/sh_vou.c index 4e5a8cf76ded..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); |
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/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-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/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/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/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_cmds.c b/drivers/net/benet/be_cmds.c index 36eca1ce75d4..e4465d222a7d 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1235,7 +1235,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, | |||
1235 | 1235 | ||
1236 | i = 0; | 1236 | i = 0; |
1237 | netdev_for_each_mc_addr(ha, netdev) | 1237 | netdev_for_each_mc_addr(ha, netdev) |
1238 | memcpy(req->mac[i].byte, ha->addr, ETH_ALEN); | 1238 | memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN); |
1239 | } else { | 1239 | } else { |
1240 | req->promiscuous = 1; | 1240 | req->promiscuous = 1; |
1241 | } | 1241 | } |
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_main.c b/drivers/net/bonding/bond_main.c index 71a169740d05..d0ea760ce419 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 = |
@@ -1576,7 +1576,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1576 | 1576 | ||
1577 | /* If this is the first slave, then we need to set the master's hardware | 1577 | /* 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. */ | 1578 | * address to be the same as the slave's. */ |
1579 | if (bond->slave_cnt == 0) | 1579 | if (is_zero_ether_addr(bond->dev->dev_addr)) |
1580 | memcpy(bond->dev->dev_addr, slave_dev->dev_addr, | 1580 | memcpy(bond->dev->dev_addr, slave_dev->dev_addr, |
1581 | slave_dev->addr_len); | 1581 | slave_dev->addr_len); |
1582 | 1582 | ||
@@ -5299,13 +5299,6 @@ static int __init bonding_init(void) | |||
5299 | if (res) | 5299 | if (res) |
5300 | goto out; | 5300 | goto out; |
5301 | 5301 | ||
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); | 5302 | res = register_pernet_subsys(&bond_net_ops); |
5310 | if (res) | 5303 | if (res) |
5311 | goto out; | 5304 | goto out; |
@@ -5334,9 +5327,6 @@ err: | |||
5334 | rtnl_link_unregister(&bond_link_ops); | 5327 | rtnl_link_unregister(&bond_link_ops); |
5335 | err_link: | 5328 | err_link: |
5336 | unregister_pernet_subsys(&bond_net_ops); | 5329 | unregister_pernet_subsys(&bond_net_ops); |
5337 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
5338 | free_cpumask_var(netpoll_block_tx); | ||
5339 | #endif | ||
5340 | goto out; | 5330 | goto out; |
5341 | 5331 | ||
5342 | } | 5332 | } |
@@ -5353,7 +5343,10 @@ static void __exit bonding_exit(void) | |||
5353 | unregister_pernet_subsys(&bond_net_ops); | 5343 | unregister_pernet_subsys(&bond_net_ops); |
5354 | 5344 | ||
5355 | #ifdef CONFIG_NET_POLL_CONTROLLER | 5345 | #ifdef CONFIG_NET_POLL_CONTROLLER |
5356 | free_cpumask_var(netpoll_block_tx); | 5346 | /* |
5347 | * Make sure we don't have an imbalance on our netpoll blocking | ||
5348 | */ | ||
5349 | WARN_ON(atomic_read(&netpoll_block_tx)); | ||
5357 | #endif | 5350 | #endif |
5358 | } | 5351 | } |
5359 | 5352 | ||
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 4eedb12df6ca..c2f081352a03 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 |
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 d887a76cd39d..6bf464afa90e 100644 --- a/drivers/net/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c | |||
@@ -2269,6 +2269,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2269 | { | 2269 | { |
2270 | struct sge *s = &adapter->sge; | 2270 | struct sge *s = &adapter->sge; |
2271 | int q10g, n10g, qidx, pidx, qs; | 2271 | int q10g, n10g, qidx, pidx, qs; |
2272 | size_t iqe_size; | ||
2272 | 2273 | ||
2273 | /* | 2274 | /* |
2274 | * 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 |
@@ -2313,6 +2314,13 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2313 | s->ethqsets = qidx; | 2314 | s->ethqsets = qidx; |
2314 | 2315 | ||
2315 | /* | 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 | /* | ||
2316 | * Set up default Queue Set parameters ... Start off with the | 2324 | * Set up default Queue Set parameters ... Start off with the |
2317 | * shortest interrupt holdoff timer. | 2325 | * shortest interrupt holdoff timer. |
2318 | */ | 2326 | */ |
@@ -2320,7 +2328,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2320 | struct sge_eth_rxq *rxq = &s->ethrxq[qs]; | 2328 | struct sge_eth_rxq *rxq = &s->ethrxq[qs]; |
2321 | struct sge_eth_txq *txq = &s->ethtxq[qs]; | 2329 | struct sge_eth_txq *txq = &s->ethtxq[qs]; |
2322 | 2330 | ||
2323 | init_rspq(&rxq->rspq, 0, 0, 1024, L1_CACHE_BYTES); | 2331 | init_rspq(&rxq->rspq, 0, 0, 1024, iqe_size); |
2324 | rxq->fl.size = 72; | 2332 | rxq->fl.size = 72; |
2325 | txq->q.size = 1024; | 2333 | txq->q.size = 1024; |
2326 | } | 2334 | } |
@@ -2329,8 +2337,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2329 | * The firmware event queue is used for link state changes and | 2337 | * The firmware event queue is used for link state changes and |
2330 | * notifications of TX DMA completions. | 2338 | * notifications of TX DMA completions. |
2331 | */ | 2339 | */ |
2332 | 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); |
2333 | L1_CACHE_BYTES); | ||
2334 | 2341 | ||
2335 | /* | 2342 | /* |
2336 | * 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 |
@@ -2346,7 +2353,7 @@ static void __devinit cfg_queues(struct adapter *adapter) | |||
2346 | * any time ... | 2353 | * any time ... |
2347 | */ | 2354 | */ |
2348 | 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, |
2349 | L1_CACHE_BYTES); | 2356 | iqe_size); |
2350 | } | 2357 | } |
2351 | 2358 | ||
2352 | /* | 2359 | /* |
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 3d0af08483a1..b95f087cd5a9 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -683,7 +683,7 @@ static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe, | |||
683 | int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && | 683 | int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && |
684 | pr->port->vgrp); | 684 | pr->port->vgrp); |
685 | 685 | ||
686 | if (use_lro) { | 686 | if (skb->dev->features & NETIF_F_LRO) { |
687 | if (vlan_extracted) | 687 | if (vlan_extracted) |
688 | lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, | 688 | lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, |
689 | pr->port->vgrp, | 689 | pr->port->vgrp, |
@@ -787,7 +787,7 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
787 | } | 787 | } |
788 | cqe = ehea_poll_rq1(qp, &wqe_index); | 788 | cqe = ehea_poll_rq1(qp, &wqe_index); |
789 | } | 789 | } |
790 | if (use_lro) | 790 | if (dev->features & NETIF_F_LRO) |
791 | lro_flush_all(&pr->lro_mgr); | 791 | lro_flush_all(&pr->lro_mgr); |
792 | 792 | ||
793 | pr->rx_packets += processed; | 793 | pr->rx_packets += processed; |
@@ -3278,6 +3278,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
3278 | | NETIF_F_LLTX; | 3278 | | NETIF_F_LLTX; |
3279 | dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; | 3279 | dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; |
3280 | 3280 | ||
3281 | if (use_lro) | ||
3282 | dev->features |= NETIF_F_LRO; | ||
3283 | |||
3281 | INIT_WORK(&port->reset_task, ehea_reset_port); | 3284 | INIT_WORK(&port->reset_task, ehea_reset_port); |
3282 | 3285 | ||
3283 | 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/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/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/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/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/usb/hso.c b/drivers/net/usb/hso.c index 62e9e8dc8190..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 */ |
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/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 1a62e351ec77..fdc2ec52b42f 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -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 a314c2c2bfbe..dc7b30b170d0 100644 --- a/drivers/net/wireless/ath/carl9170/main.c +++ b/drivers/net/wireless/ath/carl9170/main.c | |||
@@ -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/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/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/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/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/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/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/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/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..5b6bbaea59fe 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); |
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/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/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/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/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); |