diff options
112 files changed, 1188 insertions, 539 deletions
diff --git a/Documentation/hwmon/max16064 b/Documentation/hwmon/max16064 new file mode 100644 index 00000000000..41728999e14 --- /dev/null +++ b/Documentation/hwmon/max16064 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | Kernel driver max16064 | ||
| 2 | ====================== | ||
| 3 | |||
| 4 | Supported chips: | ||
| 5 | * Maxim MAX16064 | ||
| 6 | Prefix: 'max16064' | ||
| 7 | Addresses scanned: - | ||
| 8 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf | ||
| 9 | |||
| 10 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
| 11 | |||
| 12 | |||
| 13 | Description | ||
| 14 | ----------- | ||
| 15 | |||
| 16 | This driver supports hardware montoring for Maxim MAX16064 Quad Power-Supply | ||
| 17 | Controller with Active-Voltage Output Control and PMBus Interface. | ||
| 18 | |||
| 19 | The driver is a client driver to the core PMBus driver. | ||
| 20 | Please see Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
| 21 | |||
| 22 | |||
| 23 | Usage Notes | ||
| 24 | ----------- | ||
| 25 | |||
| 26 | This driver does not auto-detect devices. You will have to instantiate the | ||
| 27 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
| 28 | details. | ||
| 29 | |||
| 30 | |||
| 31 | Platform data support | ||
| 32 | --------------------- | ||
| 33 | |||
| 34 | The driver supports standard PMBus driver platform data. | ||
| 35 | |||
| 36 | |||
| 37 | Sysfs entries | ||
| 38 | ------------- | ||
| 39 | |||
| 40 | The following attributes are supported. Limits are read-write; all other | ||
| 41 | attributes are read-only. | ||
| 42 | |||
| 43 | in[1-4]_label "vout[1-4]" | ||
| 44 | in[1-4]_input Measured voltage. From READ_VOUT register. | ||
| 45 | in[1-4]_min Minumum Voltage. From VOUT_UV_WARN_LIMIT register. | ||
| 46 | in[1-4]_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. | ||
| 47 | in[1-4]_lcrit Critical minumum Voltage. VOUT_UV_FAULT_LIMIT register. | ||
| 48 | in[1-4]_crit Critical maximum voltage. From VOUT_OV_FAULT_LIMIT register. | ||
| 49 | in[1-4]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||
| 50 | in[1-4]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||
| 51 | in[1-4]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||
| 52 | in[1-4]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||
| 53 | |||
| 54 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. | ||
| 55 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | ||
| 56 | temp1_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
| 57 | temp1_max_alarm Chip temperature high alarm. Set by comparing | ||
| 58 | READ_TEMPERATURE_1 with OT_WARN_LIMIT if TEMP_OT_WARNING | ||
| 59 | status is set. | ||
| 60 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | ||
| 61 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT | ||
| 62 | status is set. | ||
diff --git a/Documentation/hwmon/max34440 b/Documentation/hwmon/max34440 new file mode 100644 index 00000000000..6c525dd07d5 --- /dev/null +++ b/Documentation/hwmon/max34440 | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | Kernel driver max34440 | ||
| 2 | ====================== | ||
| 3 | |||
| 4 | Supported chips: | ||
| 5 | * Maxim MAX34440 | ||
| 6 | Prefixes: 'max34440' | ||
| 7 | Addresses scanned: - | ||
| 8 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34440.pdf | ||
| 9 | * Maxim MAX34441 | ||
| 10 | PMBus 5-Channel Power-Supply Manager and Intelligent Fan Controller | ||
| 11 | Prefixes: 'max34441' | ||
| 12 | Addresses scanned: - | ||
| 13 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf | ||
| 14 | |||
| 15 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
| 16 | |||
| 17 | |||
| 18 | Description | ||
| 19 | ----------- | ||
| 20 | |||
| 21 | This driver supports hardware montoring for Maxim MAX34440 PMBus 6-Channel | ||
| 22 | Power-Supply Manager and MAX34441 PMBus 5-Channel Power-Supply Manager | ||
| 23 | and Intelligent Fan Controller. | ||
| 24 | |||
| 25 | The driver is a client driver to the core PMBus driver. Please see | ||
| 26 | Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
| 27 | |||
| 28 | |||
| 29 | Usage Notes | ||
| 30 | ----------- | ||
| 31 | |||
| 32 | This driver does not auto-detect devices. You will have to instantiate the | ||
| 33 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
| 34 | details. | ||
| 35 | |||
| 36 | |||
| 37 | Platform data support | ||
| 38 | --------------------- | ||
| 39 | |||
| 40 | The driver supports standard PMBus driver platform data. | ||
| 41 | |||
| 42 | |||
| 43 | Sysfs entries | ||
| 44 | ------------- | ||
| 45 | |||
| 46 | The following attributes are supported. Limits are read-write; all other | ||
| 47 | attributes are read-only. | ||
| 48 | |||
| 49 | in[1-6]_label "vout[1-6]". | ||
| 50 | in[1-6]_input Measured voltage. From READ_VOUT register. | ||
| 51 | in[1-6]_min Minumum Voltage. From VOUT_UV_WARN_LIMIT register. | ||
| 52 | in[1-6]_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. | ||
| 53 | in[1-6]_lcrit Critical minumum Voltage. VOUT_UV_FAULT_LIMIT register. | ||
| 54 | in[1-6]_crit Critical maximum voltage. From VOUT_OV_FAULT_LIMIT register. | ||
| 55 | in[1-6]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||
| 56 | in[1-6]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||
| 57 | in[1-6]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||
| 58 | in[1-6]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||
| 59 | |||
| 60 | curr[1-6]_label "iout[1-6]". | ||
| 61 | curr[1-6]_input Measured current. From READ_IOUT register. | ||
| 62 | curr[1-6]_max Maximum current. From IOUT_OC_WARN_LIMIT register. | ||
| 63 | curr[1-6]_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. | ||
| 64 | curr[1-6]_max_alarm Current high alarm. From IOUT_OC_WARNING status. | ||
| 65 | curr[1-6]_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. | ||
| 66 | |||
| 67 | in6 and curr6 attributes only exist for MAX34440. | ||
| 68 | |||
| 69 | temp[1-8]_input Measured temperatures. From READ_TEMPERATURE_1 register. | ||
| 70 | temp1 is the chip's internal temperature. temp2..temp5 | ||
| 71 | are remote I2C temperature sensors. For MAX34441, temp6 | ||
| 72 | is a remote thermal-diode sensor. For MAX34440, temp6..8 | ||
| 73 | are remote I2C temperature sensors. | ||
| 74 | temp[1-8]_max Maximum temperature. From OT_WARN_LIMIT register. | ||
| 75 | temp[1-8]_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
| 76 | temp[1-8]_max_alarm Temperature high alarm. | ||
| 77 | temp[1-8]_crit_alarm Temperature critical high alarm. | ||
| 78 | |||
| 79 | temp7 and temp8 attributes only exist for MAX34440. | ||
diff --git a/Documentation/hwmon/max8688 b/Documentation/hwmon/max8688 new file mode 100644 index 00000000000..0ddd3a41203 --- /dev/null +++ b/Documentation/hwmon/max8688 | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | Kernel driver max8688 | ||
| 2 | ===================== | ||
| 3 | |||
| 4 | Supported chips: | ||
| 5 | * Maxim MAX8688 | ||
| 6 | Prefix: 'max8688' | ||
| 7 | Addresses scanned: - | ||
| 8 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf | ||
| 9 | |||
| 10 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
| 11 | |||
| 12 | |||
| 13 | Description | ||
| 14 | ----------- | ||
| 15 | |||
| 16 | This driver supports hardware montoring for Maxim MAX8688 Digital Power-Supply | ||
| 17 | Controller/Monitor with PMBus Interface. | ||
| 18 | |||
| 19 | The driver is a client driver to the core PMBus driver. Please see | ||
| 20 | Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
| 21 | |||
| 22 | |||
| 23 | Usage Notes | ||
| 24 | ----------- | ||
| 25 | |||
| 26 | This driver does not auto-detect devices. You will have to instantiate the | ||
| 27 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
| 28 | details. | ||
| 29 | |||
| 30 | |||
| 31 | Platform data support | ||
| 32 | --------------------- | ||
| 33 | |||
| 34 | The driver supports standard PMBus driver platform data. | ||
| 35 | |||
| 36 | |||
| 37 | Sysfs entries | ||
| 38 | ------------- | ||
| 39 | |||
| 40 | The following attributes are supported. Limits are read-write; all other | ||
| 41 | attributes are read-only. | ||
| 42 | |||
| 43 | in1_label "vout1" | ||
| 44 | in1_input Measured voltage. From READ_VOUT register. | ||
| 45 | in1_min Minumum Voltage. From VOUT_UV_WARN_LIMIT register. | ||
| 46 | in1_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. | ||
| 47 | in1_lcrit Critical minumum Voltage. VOUT_UV_FAULT_LIMIT register. | ||
| 48 | in1_crit Critical maximum voltage. From VOUT_OV_FAULT_LIMIT register. | ||
| 49 | in1_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||
| 50 | in1_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||
| 51 | in1_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||
| 52 | in1_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||
| 53 | |||
| 54 | curr1_label "iout1" | ||
| 55 | curr1_input Measured current. From READ_IOUT register. | ||
| 56 | curr1_max Maximum current. From IOUT_OC_WARN_LIMIT register. | ||
| 57 | curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. | ||
| 58 | curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT register. | ||
| 59 | curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. | ||
| 60 | |||
| 61 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. | ||
| 62 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | ||
| 63 | temp1_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
| 64 | temp1_max_alarm Chip temperature high alarm. Set by comparing | ||
| 65 | READ_TEMPERATURE_1 with OT_WARN_LIMIT if TEMP_OT_WARNING | ||
| 66 | status is set. | ||
| 67 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | ||
| 68 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT | ||
| 69 | status is set. | ||
diff --git a/Documentation/hwmon/pmbus b/Documentation/hwmon/pmbus index dc4933e9634..5e462fc7f99 100644 --- a/Documentation/hwmon/pmbus +++ b/Documentation/hwmon/pmbus | |||
| @@ -13,26 +13,6 @@ Supported chips: | |||
| 13 | Prefix: 'ltc2978' | 13 | Prefix: 'ltc2978' |
| 14 | Addresses scanned: - | 14 | Addresses scanned: - |
| 15 | Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf | 15 | Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf |
| 16 | * Maxim MAX16064 | ||
| 17 | Quad Power-Supply Controller | ||
| 18 | Prefix: 'max16064' | ||
| 19 | Addresses scanned: - | ||
| 20 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf | ||
| 21 | * Maxim MAX34440 | ||
| 22 | PMBus 6-Channel Power-Supply Manager | ||
| 23 | Prefixes: 'max34440' | ||
| 24 | Addresses scanned: - | ||
| 25 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34440.pdf | ||
| 26 | * Maxim MAX34441 | ||
| 27 | PMBus 5-Channel Power-Supply Manager and Intelligent Fan Controller | ||
| 28 | Prefixes: 'max34441' | ||
| 29 | Addresses scanned: - | ||
| 30 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf | ||
| 31 | * Maxim MAX8688 | ||
| 32 | Digital Power-Supply Controller/Monitor | ||
| 33 | Prefix: 'max8688' | ||
| 34 | Addresses scanned: - | ||
| 35 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf | ||
| 36 | * Generic PMBus devices | 16 | * Generic PMBus devices |
| 37 | Prefix: 'pmbus' | 17 | Prefix: 'pmbus' |
| 38 | Addresses scanned: - | 18 | Addresses scanned: - |
| @@ -175,11 +155,13 @@ currX_crit Critical maximum current. | |||
| 175 | From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register. | 155 | From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register. |
| 176 | currX_alarm Current high alarm. | 156 | currX_alarm Current high alarm. |
| 177 | From IIN_OC_WARNING or IOUT_OC_WARNING status. | 157 | From IIN_OC_WARNING or IOUT_OC_WARNING status. |
| 158 | currX_max_alarm Current high alarm. | ||
| 159 | From IIN_OC_WARN_LIMIT or IOUT_OC_WARN_LIMIT status. | ||
| 178 | currX_lcrit_alarm Output current critical low alarm. | 160 | currX_lcrit_alarm Output current critical low alarm. |
| 179 | From IOUT_UC_FAULT status. | 161 | From IOUT_UC_FAULT status. |
| 180 | currX_crit_alarm Current critical high alarm. | 162 | currX_crit_alarm Current critical high alarm. |
| 181 | From IIN_OC_FAULT or IOUT_OC_FAULT status. | 163 | From IIN_OC_FAULT or IOUT_OC_FAULT status. |
| 182 | currX_label "iin" or "vinY" | 164 | currX_label "iin" or "ioutY" |
| 183 | 165 | ||
| 184 | powerX_input Measured power. From READ_PIN or READ_POUT register. | 166 | powerX_input Measured power. From READ_PIN or READ_POUT register. |
| 185 | powerX_cap Output power cap. From POUT_MAX register. | 167 | powerX_cap Output power cap. From POUT_MAX register. |
| @@ -193,13 +175,13 @@ powerX_crit_alarm Output power critical high alarm. | |||
| 193 | From POUT_OP_FAULT status. | 175 | From POUT_OP_FAULT status. |
| 194 | powerX_label "pin" or "poutY" | 176 | powerX_label "pin" or "poutY" |
| 195 | 177 | ||
| 196 | tempX_input Measured tempererature. | 178 | tempX_input Measured temperature. |
| 197 | From READ_TEMPERATURE_X register. | 179 | From READ_TEMPERATURE_X register. |
| 198 | tempX_min Mimimum tempererature. From UT_WARN_LIMIT register. | 180 | tempX_min Mimimum temperature. From UT_WARN_LIMIT register. |
| 199 | tempX_max Maximum tempererature. From OT_WARN_LIMIT register. | 181 | tempX_max Maximum temperature. From OT_WARN_LIMIT register. |
| 200 | tempX_lcrit Critical low tempererature. | 182 | tempX_lcrit Critical low temperature. |
| 201 | From UT_FAULT_LIMIT register. | 183 | From UT_FAULT_LIMIT register. |
| 202 | tempX_crit Critical high tempererature. | 184 | tempX_crit Critical high temperature. |
| 203 | From OT_FAULT_LIMIT register. | 185 | From OT_FAULT_LIMIT register. |
| 204 | tempX_min_alarm Chip temperature low alarm. Set by comparing | 186 | tempX_min_alarm Chip temperature low alarm. Set by comparing |
| 205 | READ_TEMPERATURE_X with UT_WARN_LIMIT if | 187 | READ_TEMPERATURE_X with UT_WARN_LIMIT if |
diff --git a/Documentation/hwmon/smm665 b/Documentation/hwmon/smm665 index 3820fc9ca52..59e31614054 100644 --- a/Documentation/hwmon/smm665 +++ b/Documentation/hwmon/smm665 | |||
| @@ -150,8 +150,8 @@ in8_crit_alarm Channel F critical alarm | |||
| 150 | in9_crit_alarm AIN1 critical alarm | 150 | in9_crit_alarm AIN1 critical alarm |
| 151 | in10_crit_alarm AIN2 critical alarm | 151 | in10_crit_alarm AIN2 critical alarm |
| 152 | 152 | ||
| 153 | temp1_input Chip tempererature | 153 | temp1_input Chip temperature |
| 154 | temp1_min Mimimum chip tempererature | 154 | temp1_min Mimimum chip temperature |
| 155 | temp1_max Maximum chip tempererature | 155 | temp1_max Maximum chip temperature |
| 156 | temp1_crit Critical chip tempererature | 156 | temp1_crit Critical chip temperature |
| 157 | temp1_crit_alarm Temperature critical alarm | 157 | temp1_crit_alarm Temperature critical alarm |
diff --git a/Documentation/hwmon/submitting-patches b/Documentation/hwmon/submitting-patches new file mode 100644 index 00000000000..86f42e8e9e4 --- /dev/null +++ b/Documentation/hwmon/submitting-patches | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | How to Get Your Patch Accepted Into the Hwmon Subsystem | ||
| 2 | ------------------------------------------------------- | ||
| 3 | |||
| 4 | This text is is a collection of suggestions for people writing patches or | ||
| 5 | drivers for the hwmon subsystem. Following these suggestions will greatly | ||
| 6 | increase the chances of your change being accepted. | ||
| 7 | |||
| 8 | |||
| 9 | 1. General | ||
| 10 | ---------- | ||
| 11 | |||
| 12 | * It should be unnecessary to mention, but please read and follow | ||
| 13 | Documentation/SubmitChecklist | ||
| 14 | Documentation/SubmittingDrivers | ||
| 15 | Documentation/SubmittingPatches | ||
| 16 | Documentation/CodingStyle | ||
| 17 | |||
| 18 | * If your patch generates checkpatch warnings, please refrain from explanations | ||
| 19 | such as "I don't like that coding style". Keep in mind that each unnecessary | ||
| 20 | warning helps hiding a real problem. If you don't like the kernel coding | ||
| 21 | style, don't write kernel drivers. | ||
| 22 | |||
| 23 | * Please test your patch thoroughly. We are not your test group. | ||
| 24 | Sometimes a patch can not or not completely be tested because of missing | ||
| 25 | hardware. In such cases, you should test-build the code on at least one | ||
| 26 | architecture. If run-time testing was not achieved, it should be written | ||
| 27 | explicitly below the patch header. | ||
| 28 | |||
| 29 | * If your patch (or the driver) is affected by configuration options such as | ||
| 30 | CONFIG_SMP or CONFIG_HOTPLUG, make sure it compiles for all configuration | ||
| 31 | variants. | ||
| 32 | |||
| 33 | |||
| 34 | 2. Adding functionality to existing drivers | ||
| 35 | ------------------------------------------- | ||
| 36 | |||
| 37 | * Make sure the documentation in Documentation/hwmon/<driver_name> is up to | ||
| 38 | date. | ||
| 39 | |||
| 40 | * Make sure the information in Kconfig is up to date. | ||
| 41 | |||
| 42 | * If the added functionality requires some cleanup or structural changes, split | ||
| 43 | your patch into a cleanup part and the actual addition. This makes it easier | ||
| 44 | to review your changes, and to bisect any resulting problems. | ||
| 45 | |||
| 46 | * Never mix bug fixes, cleanup, and functional enhancements in a single patch. | ||
| 47 | |||
| 48 | |||
| 49 | 3. New drivers | ||
| 50 | -------------- | ||
| 51 | |||
| 52 | * Running your patch or driver file(s) through checkpatch does not mean its | ||
| 53 | formatting is clean. If unsure about formatting in your new driver, run it | ||
| 54 | through Lindent. Lindent is not perfect, and you may have to do some minor | ||
| 55 | cleanup, but it is a good start. | ||
| 56 | |||
| 57 | * Consider adding yourself to MAINTAINERS. | ||
| 58 | |||
| 59 | * Document the driver in Documentation/hwmon/<driver_name>. | ||
| 60 | |||
| 61 | * Add the driver to Kconfig and Makefile in alphabetical order. | ||
| 62 | |||
| 63 | * Make sure that all dependencies are listed in Kconfig. For new drivers, it | ||
| 64 | is most likely prudent to add a dependency on EXPERIMENTAL. | ||
| 65 | |||
| 66 | * Avoid forward declarations if you can. Rearrange the code if necessary. | ||
| 67 | |||
| 68 | * Avoid calculations in macros and macro-generated functions. While such macros | ||
| 69 | may save a line or so in the source, it obfuscates the code and makes code | ||
| 70 | review more difficult. It may also result in code which is more complicated | ||
| 71 | than necessary. Use inline functions or just regular functions instead. | ||
| 72 | |||
| 73 | * If the driver has a detect function, make sure it is silent. Debug messages | ||
| 74 | and messages printed after a successful detection are acceptable, but it | ||
| 75 | must not print messages such as "Chip XXX not found/supported". | ||
| 76 | |||
| 77 | Keep in mind that the detect function will run for all drivers supporting an | ||
| 78 | address if a chip is detected on that address. Unnecessary messages will just | ||
| 79 | pollute the kernel log and not provide any value. | ||
| 80 | |||
| 81 | * Provide a detect function if and only if a chip can be detected reliably. | ||
| 82 | |||
| 83 | * Avoid writing to chip registers in the detect function. If you have to write, | ||
| 84 | only do it after you have already gathered enough data to be certain that the | ||
| 85 | detection is going to be successful. | ||
| 86 | |||
| 87 | Keep in mind that the chip might not be what your driver believes it is, and | ||
| 88 | writing to it might cause a bad misconfiguration. | ||
| 89 | |||
| 90 | * Make sure there are no race conditions in the probe function. Specifically, | ||
| 91 | completely initialize your chip first, then create sysfs entries and register | ||
| 92 | with the hwmon subsystem. | ||
| 93 | |||
| 94 | * Do not provide support for deprecated sysfs attributes. | ||
| 95 | |||
| 96 | * Do not create non-standard attributes unless really needed. If you have to use | ||
| 97 | non-standard attributes, or you believe you do, discuss it on the mailing list | ||
| 98 | first. Either case, provide a detailed explanation why you need the | ||
| 99 | non-standard attribute(s). | ||
| 100 | Standard attributes are specified in Documentation/hwmon/sysfs-interface. | ||
| 101 | |||
| 102 | * When deciding which sysfs attributes to support, look at the chip's | ||
| 103 | capabilities. While we do not expect your driver to support everything the | ||
| 104 | chip may offer, it should at least support all limits and alarms. | ||
| 105 | |||
| 106 | * Last but not least, please check if a driver for your chip already exists | ||
| 107 | before starting to write a new driver. Especially for temperature sensors, | ||
| 108 | new chips are often variants of previously released chips. In some cases, | ||
| 109 | a presumably new chip may simply have been relabeled. | ||
diff --git a/Documentation/md.txt b/Documentation/md.txt index a81c7b4790f..2366b1c8cf1 100644 --- a/Documentation/md.txt +++ b/Documentation/md.txt | |||
| @@ -552,6 +552,16 @@ also have | |||
| 552 | within the array where IO will be blocked. This is currently | 552 | within the array where IO will be blocked. This is currently |
| 553 | only supported for raid4/5/6. | 553 | only supported for raid4/5/6. |
| 554 | 554 | ||
| 555 | sync_min | ||
| 556 | sync_max | ||
| 557 | The two values, given as numbers of sectors, indicate a range | ||
| 558 | withing the array where 'check'/'repair' will operate. Must be | ||
| 559 | a multiple of chunk_size. When it reaches "sync_max" it will | ||
| 560 | pause, rather than complete. | ||
| 561 | You can use 'select' or 'poll' on "sync_completed" to wait for | ||
| 562 | that number to reach sync_max. Then you can either increase | ||
| 563 | "sync_max", or can write 'idle' to "sync_action". | ||
| 564 | |||
| 555 | 565 | ||
| 556 | Each active md device may also have attributes specific to the | 566 | Each active md device may also have attributes specific to the |
| 557 | personality module that manages it. | 567 | personality module that manages it. |
diff --git a/Documentation/sound/alsa/SB-Live-mixer.txt b/Documentation/sound/alsa/SB-Live-mixer.txt index f5639d40521..f4b5988f450 100644 --- a/Documentation/sound/alsa/SB-Live-mixer.txt +++ b/Documentation/sound/alsa/SB-Live-mixer.txt | |||
| @@ -87,14 +87,14 @@ accumulator. ALSA uses accumulators 0 and 1 for left and right PCM. | |||
| 87 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | 87 | The result is forwarded to the ADC capture FIFO (thus to the standard capture |
| 88 | PCM device). | 88 | PCM device). |
| 89 | 89 | ||
| 90 | name='Music Playback Volume',index=0 | 90 | name='Synth Playback Volume',index=0 |
| 91 | 91 | ||
| 92 | This control is used to attenuate samples for left and right MIDI FX-bus | 92 | This control is used to attenuate samples for left and right MIDI FX-bus |
| 93 | accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. | 93 | accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. |
| 94 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. | 94 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. |
| 95 | 95 | ||
| 96 | name='Music Capture Volume',index=0 | 96 | name='Synth Capture Volume',index=0 |
| 97 | name='Music Capture Switch',index=0 | 97 | name='Synth Capture Switch',index=0 |
| 98 | 98 | ||
| 99 | These controls are used to attenuate samples for left and right MIDI FX-bus | 99 | These controls are used to attenuate samples for left and right MIDI FX-bus |
| 100 | accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. | 100 | accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. |
diff --git a/MAINTAINERS b/MAINTAINERS index 1e2724e55cf..13803127b68 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -5396,7 +5396,7 @@ F: drivers/media/video/*7146* | |||
| 5396 | F: include/media/*7146* | 5396 | F: include/media/*7146* |
| 5397 | 5397 | ||
| 5398 | SAMSUNG AUDIO (ASoC) DRIVERS | 5398 | SAMSUNG AUDIO (ASoC) DRIVERS |
| 5399 | M: Jassi Brar <jassi.brar@samsung.com> | 5399 | M: Jassi Brar <jassisinghbrar@gmail.com> |
| 5400 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 5400 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| 5401 | S: Supported | 5401 | S: Supported |
| 5402 | F: sound/soc/samsung | 5402 | F: sound/soc/samsung |
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index ed5bc9e05a4..cd4458f6417 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define __ASM_ARM_CPUTYPE_H | 2 | #define __ASM_ARM_CPUTYPE_H |
| 3 | 3 | ||
| 4 | #include <linux/stringify.h> | 4 | #include <linux/stringify.h> |
| 5 | #include <linux/kernel.h> | ||
| 5 | 6 | ||
| 6 | #define CPUID_ID 0 | 7 | #define CPUID_ID 0 |
| 7 | #define CPUID_CACHETYPE 1 | 8 | #define CPUID_CACHETYPE 1 |
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index c891eb76c0e..87dbe3e2197 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
| @@ -396,6 +396,10 @@ | |||
| 396 | #define __NR_fanotify_init (__NR_SYSCALL_BASE+367) | 396 | #define __NR_fanotify_init (__NR_SYSCALL_BASE+367) |
| 397 | #define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) | 397 | #define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) |
| 398 | #define __NR_prlimit64 (__NR_SYSCALL_BASE+369) | 398 | #define __NR_prlimit64 (__NR_SYSCALL_BASE+369) |
| 399 | #define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370) | ||
| 400 | #define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371) | ||
| 401 | #define __NR_clock_adjtime (__NR_SYSCALL_BASE+372) | ||
| 402 | #define __NR_syncfs (__NR_SYSCALL_BASE+373) | ||
| 399 | 403 | ||
| 400 | /* | 404 | /* |
| 401 | * The following SWIs are ARM private. | 405 | * The following SWIs are ARM private. |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 5c26eccef99..7fbf28c35bb 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
| @@ -379,6 +379,10 @@ | |||
| 379 | CALL(sys_fanotify_init) | 379 | CALL(sys_fanotify_init) |
| 380 | CALL(sys_fanotify_mark) | 380 | CALL(sys_fanotify_mark) |
| 381 | CALL(sys_prlimit64) | 381 | CALL(sys_prlimit64) |
| 382 | /* 370 */ CALL(sys_name_to_handle_at) | ||
| 383 | CALL(sys_open_by_handle_at) | ||
| 384 | CALL(sys_clock_adjtime) | ||
| 385 | CALL(sys_syncfs) | ||
| 382 | #ifndef syscalls_counted | 386 | #ifndef syscalls_counted |
| 383 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 387 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
| 384 | #define syscalls_counted | 388 | #define syscalls_counted |
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index 0db2411ef4b..716662008ce 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c | |||
| @@ -409,6 +409,10 @@ struct platform_device s3c24xx_pwm_device = { | |||
| 409 | .num_resources = 0, | 409 | .num_resources = 0, |
| 410 | }; | 410 | }; |
| 411 | 411 | ||
| 412 | static struct platform_device gta02_dfbmcs320_device = { | ||
| 413 | .name = "dfbmcs320", | ||
| 414 | }; | ||
| 415 | |||
| 412 | static struct i2c_board_info gta02_i2c_devs[] __initdata = { | 416 | static struct i2c_board_info gta02_i2c_devs[] __initdata = { |
| 413 | { | 417 | { |
| 414 | I2C_BOARD_INFO("pcf50633", 0x73), | 418 | I2C_BOARD_INFO("pcf50633", 0x73), |
| @@ -523,6 +527,7 @@ static struct platform_device *gta02_devices[] __initdata = { | |||
| 523 | &s3c_device_iis, | 527 | &s3c_device_iis, |
| 524 | &samsung_asoc_dma, | 528 | &samsung_asoc_dma, |
| 525 | &s3c_device_i2c0, | 529 | &s3c_device_i2c0, |
| 530 | >a02_dfbmcs320_device, | ||
| 526 | >a02_buttons_device, | 531 | >a02_buttons_device, |
| 527 | &s3c_device_adc, | 532 | &s3c_device_adc, |
| 528 | &s3c_device_ts, | 533 | &s3c_device_ts, |
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index af913741e6e..6e1907fa94f 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
| @@ -178,16 +178,15 @@ static struct i2c_board_info __initdata mop500_i2c0_devices[] = { | |||
| 178 | .irq = NOMADIK_GPIO_TO_IRQ(217), | 178 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
| 179 | .platform_data = &mop500_tc35892_data, | 179 | .platform_data = &mop500_tc35892_data, |
| 180 | }, | 180 | }, |
| 181 | }; | 181 | /* I2C0 devices only available prior to HREFv60 */ |
| 182 | |||
| 183 | /* I2C0 devices only available prior to HREFv60 */ | ||
| 184 | static struct i2c_board_info __initdata mop500_i2c0_old_devices[] = { | ||
| 185 | { | 182 | { |
| 186 | I2C_BOARD_INFO("tps61052", 0x33), | 183 | I2C_BOARD_INFO("tps61052", 0x33), |
| 187 | .platform_data = &mop500_tps61052_data, | 184 | .platform_data = &mop500_tps61052_data, |
| 188 | }, | 185 | }, |
| 189 | }; | 186 | }; |
| 190 | 187 | ||
| 188 | #define NUM_PRE_V60_I2C0_DEVICES 1 | ||
| 189 | |||
| 191 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { | 190 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
| 192 | { | 191 | { |
| 193 | /* lp5521 LED driver, 1st device */ | 192 | /* lp5521 LED driver, 1st device */ |
| @@ -425,6 +424,8 @@ static void __init mop500_uart_init(void) | |||
| 425 | 424 | ||
| 426 | static void __init mop500_init_machine(void) | 425 | static void __init mop500_init_machine(void) |
| 427 | { | 426 | { |
| 427 | int i2c0_devs; | ||
| 428 | |||
| 428 | /* | 429 | /* |
| 429 | * The HREFv60 board removed a GPIO expander and routed | 430 | * The HREFv60 board removed a GPIO expander and routed |
| 430 | * all these GPIO pins to the internal GPIO controller | 431 | * all these GPIO pins to the internal GPIO controller |
| @@ -448,11 +449,11 @@ static void __init mop500_init_machine(void) | |||
| 448 | 449 | ||
| 449 | platform_device_register(&ab8500_device); | 450 | platform_device_register(&ab8500_device); |
| 450 | 451 | ||
| 451 | i2c_register_board_info(0, mop500_i2c0_devices, | 452 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
| 452 | ARRAY_SIZE(mop500_i2c0_devices)); | 453 | if (machine_is_hrefv60()) |
| 453 | if (!machine_is_hrefv60()) | 454 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
| 454 | i2c_register_board_info(0, mop500_i2c0_old_devices, | 455 | |
| 455 | ARRAY_SIZE(mop500_i2c0_old_devices)); | 456 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
| 456 | i2c_register_board_info(2, mop500_i2c2_devices, | 457 | i2c_register_board_info(2, mop500_i2c2_devices, |
| 457 | ARRAY_SIZE(mop500_i2c2_devices)); | 458 | ARRAY_SIZE(mop500_i2c2_devices)); |
| 458 | } | 459 | } |
diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 3d4dab43c99..a50fc9f493b 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h | |||
| @@ -51,7 +51,7 @@ static inline void numa_remove_cpu(int cpu) { } | |||
| 51 | #endif /* CONFIG_NUMA */ | 51 | #endif /* CONFIG_NUMA */ |
| 52 | 52 | ||
| 53 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 53 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
| 54 | struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable); | 54 | void debug_cpumask_set_cpu(int cpu, int node, bool enable); |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | #endif /* _ASM_X86_NUMA_H */ | 57 | #endif /* _ASM_X86_NUMA_H */ |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 0b4be431c62..adee12e0da1 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
| @@ -228,6 +228,7 @@ | |||
| 228 | #include <linux/kthread.h> | 228 | #include <linux/kthread.h> |
| 229 | #include <linux/jiffies.h> | 229 | #include <linux/jiffies.h> |
| 230 | #include <linux/acpi.h> | 230 | #include <linux/acpi.h> |
| 231 | #include <linux/syscore_ops.h> | ||
| 231 | 232 | ||
| 232 | #include <asm/system.h> | 233 | #include <asm/system.h> |
| 233 | #include <asm/uaccess.h> | 234 | #include <asm/uaccess.h> |
| @@ -1238,6 +1239,7 @@ static int suspend(int vetoable) | |||
| 1238 | 1239 | ||
| 1239 | local_irq_disable(); | 1240 | local_irq_disable(); |
| 1240 | sysdev_suspend(PMSG_SUSPEND); | 1241 | sysdev_suspend(PMSG_SUSPEND); |
| 1242 | syscore_suspend(); | ||
| 1241 | 1243 | ||
| 1242 | local_irq_enable(); | 1244 | local_irq_enable(); |
| 1243 | 1245 | ||
| @@ -1255,6 +1257,7 @@ static int suspend(int vetoable) | |||
| 1255 | apm_error("suspend", err); | 1257 | apm_error("suspend", err); |
| 1256 | err = (err == APM_SUCCESS) ? 0 : -EIO; | 1258 | err = (err == APM_SUCCESS) ? 0 : -EIO; |
| 1257 | 1259 | ||
| 1260 | syscore_resume(); | ||
| 1258 | sysdev_resume(); | 1261 | sysdev_resume(); |
| 1259 | local_irq_enable(); | 1262 | local_irq_enable(); |
| 1260 | 1263 | ||
| @@ -1280,6 +1283,7 @@ static void standby(void) | |||
| 1280 | 1283 | ||
| 1281 | local_irq_disable(); | 1284 | local_irq_disable(); |
| 1282 | sysdev_suspend(PMSG_SUSPEND); | 1285 | sysdev_suspend(PMSG_SUSPEND); |
| 1286 | syscore_suspend(); | ||
| 1283 | local_irq_enable(); | 1287 | local_irq_enable(); |
| 1284 | 1288 | ||
| 1285 | err = set_system_power_state(APM_STATE_STANDBY); | 1289 | err = set_system_power_state(APM_STATE_STANDBY); |
| @@ -1287,6 +1291,7 @@ static void standby(void) | |||
| 1287 | apm_error("standby", err); | 1291 | apm_error("standby", err); |
| 1288 | 1292 | ||
| 1289 | local_irq_disable(); | 1293 | local_irq_disable(); |
| 1294 | syscore_resume(); | ||
| 1290 | sysdev_resume(); | 1295 | sysdev_resume(); |
| 1291 | local_irq_enable(); | 1296 | local_irq_enable(); |
| 1292 | 1297 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index eed3673a865..632e5dc9c9c 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
| @@ -586,8 +586,12 @@ static int x86_setup_perfctr(struct perf_event *event) | |||
| 586 | return -EOPNOTSUPP; | 586 | return -EOPNOTSUPP; |
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | /* | ||
| 590 | * Do not allow config1 (extended registers) to propagate, | ||
| 591 | * there's no sane user-space generalization yet: | ||
| 592 | */ | ||
| 589 | if (attr->type == PERF_TYPE_RAW) | 593 | if (attr->type == PERF_TYPE_RAW) |
| 590 | return x86_pmu_extra_regs(event->attr.config, event); | 594 | return 0; |
| 591 | 595 | ||
| 592 | if (attr->type == PERF_TYPE_HW_CACHE) | 596 | if (attr->type == PERF_TYPE_HW_CACHE) |
| 593 | return set_ext_hw_attr(hwc, event); | 597 | return set_ext_hw_attr(hwc, event); |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 8fc2b2cee1d..43fa20b1381 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
| @@ -391,12 +391,12 @@ static __initconst const u64 nehalem_hw_cache_event_ids | |||
| 391 | { | 391 | { |
| 392 | [ C(L1D) ] = { | 392 | [ C(L1D) ] = { |
| 393 | [ C(OP_READ) ] = { | 393 | [ C(OP_READ) ] = { |
| 394 | [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI */ | 394 | [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS */ |
| 395 | [ C(RESULT_MISS) ] = 0x0140, /* L1D_CACHE_LD.I_STATE */ | 395 | [ C(RESULT_MISS) ] = 0x0151, /* L1D.REPL */ |
| 396 | }, | 396 | }, |
| 397 | [ C(OP_WRITE) ] = { | 397 | [ C(OP_WRITE) ] = { |
| 398 | [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI */ | 398 | [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES */ |
| 399 | [ C(RESULT_MISS) ] = 0x0141, /* L1D_CACHE_ST.I_STATE */ | 399 | [ C(RESULT_MISS) ] = 0x0251, /* L1D.M_REPL */ |
| 400 | }, | 400 | }, |
| 401 | [ C(OP_PREFETCH) ] = { | 401 | [ C(OP_PREFETCH) ] = { |
| 402 | [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */ | 402 | [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */ |
| @@ -1425,6 +1425,7 @@ static __init int intel_pmu_init(void) | |||
| 1425 | 1425 | ||
| 1426 | case 37: /* 32 nm nehalem, "Clarkdale" */ | 1426 | case 37: /* 32 nm nehalem, "Clarkdale" */ |
| 1427 | case 44: /* 32 nm nehalem, "Gulftown" */ | 1427 | case 44: /* 32 nm nehalem, "Gulftown" */ |
| 1428 | case 47: /* 32 nm Xeon E7 */ | ||
| 1428 | memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids, | 1429 | memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids, |
| 1429 | sizeof(hw_cache_event_ids)); | 1430 | sizeof(hw_cache_event_ids)); |
| 1430 | memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs, | 1431 | memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs, |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index c2520e178d3..d1f77e2934a 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
| @@ -947,7 +947,7 @@ static int p4_pmu_handle_irq(struct pt_regs *regs) | |||
| 947 | if (!x86_perf_event_set_period(event)) | 947 | if (!x86_perf_event_set_period(event)) |
| 948 | continue; | 948 | continue; |
| 949 | if (perf_event_overflow(event, 1, &data, regs)) | 949 | if (perf_event_overflow(event, 1, &data, regs)) |
| 950 | p4_pmu_disable_event(event); | 950 | x86_pmu_stop(event, 0); |
| 951 | } | 951 | } |
| 952 | 952 | ||
| 953 | if (handled) { | 953 | if (handled) { |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 8ed8908cc9f..c2871d3c71b 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
| @@ -312,26 +312,6 @@ void __cpuinit smp_store_cpu_info(int id) | |||
| 312 | identify_secondary_cpu(c); | 312 | identify_secondary_cpu(c); |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static void __cpuinit check_cpu_siblings_on_same_node(int cpu1, int cpu2) | ||
| 316 | { | ||
| 317 | int node1 = early_cpu_to_node(cpu1); | ||
| 318 | int node2 = early_cpu_to_node(cpu2); | ||
| 319 | |||
| 320 | /* | ||
| 321 | * Our CPU scheduler assumes all logical cpus in the same physical cpu | ||
| 322 | * share the same node. But, buggy ACPI or NUMA emulation might assign | ||
| 323 | * them to different node. Fix it. | ||
| 324 | */ | ||
| 325 | if (node1 != node2) { | ||
| 326 | pr_warning("CPU %d in node %d and CPU %d in node %d are in the same physical CPU. forcing same node %d\n", | ||
| 327 | cpu1, node1, cpu2, node2, node2); | ||
| 328 | |||
| 329 | numa_remove_cpu(cpu1); | ||
| 330 | numa_set_node(cpu1, node2); | ||
| 331 | numa_add_cpu(cpu1); | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 335 | static void __cpuinit link_thread_siblings(int cpu1, int cpu2) | 315 | static void __cpuinit link_thread_siblings(int cpu1, int cpu2) |
| 336 | { | 316 | { |
| 337 | cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2)); | 317 | cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2)); |
| @@ -340,7 +320,6 @@ static void __cpuinit link_thread_siblings(int cpu1, int cpu2) | |||
| 340 | cpumask_set_cpu(cpu2, cpu_core_mask(cpu1)); | 320 | cpumask_set_cpu(cpu2, cpu_core_mask(cpu1)); |
| 341 | cpumask_set_cpu(cpu1, cpu_llc_shared_mask(cpu2)); | 321 | cpumask_set_cpu(cpu1, cpu_llc_shared_mask(cpu2)); |
| 342 | cpumask_set_cpu(cpu2, cpu_llc_shared_mask(cpu1)); | 322 | cpumask_set_cpu(cpu2, cpu_llc_shared_mask(cpu1)); |
| 343 | check_cpu_siblings_on_same_node(cpu1, cpu2); | ||
| 344 | } | 323 | } |
| 345 | 324 | ||
| 346 | 325 | ||
| @@ -382,12 +361,10 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
| 382 | per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { | 361 | per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { |
| 383 | cpumask_set_cpu(i, cpu_llc_shared_mask(cpu)); | 362 | cpumask_set_cpu(i, cpu_llc_shared_mask(cpu)); |
| 384 | cpumask_set_cpu(cpu, cpu_llc_shared_mask(i)); | 363 | cpumask_set_cpu(cpu, cpu_llc_shared_mask(i)); |
| 385 | check_cpu_siblings_on_same_node(cpu, i); | ||
| 386 | } | 364 | } |
| 387 | if (c->phys_proc_id == cpu_data(i).phys_proc_id) { | 365 | if (c->phys_proc_id == cpu_data(i).phys_proc_id) { |
| 388 | cpumask_set_cpu(i, cpu_core_mask(cpu)); | 366 | cpumask_set_cpu(i, cpu_core_mask(cpu)); |
| 389 | cpumask_set_cpu(cpu, cpu_core_mask(i)); | 367 | cpumask_set_cpu(cpu, cpu_core_mask(i)); |
| 390 | check_cpu_siblings_on_same_node(cpu, i); | ||
| 391 | /* | 368 | /* |
| 392 | * Does this new cpu bringup a new core? | 369 | * Does this new cpu bringup a new core? |
| 393 | */ | 370 | */ |
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 9559d360fde..745258dfc4d 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
| @@ -213,53 +213,48 @@ int early_cpu_to_node(int cpu) | |||
| 213 | return per_cpu(x86_cpu_to_node_map, cpu); | 213 | return per_cpu(x86_cpu_to_node_map, cpu); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable) | 216 | void debug_cpumask_set_cpu(int cpu, int node, bool enable) |
| 217 | { | 217 | { |
| 218 | int node = early_cpu_to_node(cpu); | ||
| 219 | struct cpumask *mask; | 218 | struct cpumask *mask; |
| 220 | char buf[64]; | 219 | char buf[64]; |
| 221 | 220 | ||
| 222 | if (node == NUMA_NO_NODE) { | 221 | if (node == NUMA_NO_NODE) { |
| 223 | /* early_cpu_to_node() already emits a warning and trace */ | 222 | /* early_cpu_to_node() already emits a warning and trace */ |
| 224 | return NULL; | 223 | return; |
| 225 | } | 224 | } |
| 226 | mask = node_to_cpumask_map[node]; | 225 | mask = node_to_cpumask_map[node]; |
| 227 | if (!mask) { | 226 | if (!mask) { |
| 228 | pr_err("node_to_cpumask_map[%i] NULL\n", node); | 227 | pr_err("node_to_cpumask_map[%i] NULL\n", node); |
| 229 | dump_stack(); | 228 | dump_stack(); |
| 230 | return NULL; | 229 | return; |
| 231 | } | 230 | } |
| 232 | 231 | ||
| 232 | if (enable) | ||
| 233 | cpumask_set_cpu(cpu, mask); | ||
| 234 | else | ||
| 235 | cpumask_clear_cpu(cpu, mask); | ||
| 236 | |||
| 233 | cpulist_scnprintf(buf, sizeof(buf), mask); | 237 | cpulist_scnprintf(buf, sizeof(buf), mask); |
| 234 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", | 238 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", |
| 235 | enable ? "numa_add_cpu" : "numa_remove_cpu", | 239 | enable ? "numa_add_cpu" : "numa_remove_cpu", |
| 236 | cpu, node, buf); | 240 | cpu, node, buf); |
| 237 | return mask; | 241 | return; |
| 238 | } | 242 | } |
| 239 | 243 | ||
| 240 | # ifndef CONFIG_NUMA_EMU | 244 | # ifndef CONFIG_NUMA_EMU |
| 241 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | 245 | static void __cpuinit numa_set_cpumask(int cpu, bool enable) |
| 242 | { | 246 | { |
| 243 | struct cpumask *mask; | 247 | debug_cpumask_set_cpu(cpu, early_cpu_to_node(cpu), enable); |
| 244 | |||
| 245 | mask = debug_cpumask_set_cpu(cpu, enable); | ||
| 246 | if (!mask) | ||
| 247 | return; | ||
| 248 | |||
| 249 | if (enable) | ||
| 250 | cpumask_set_cpu(cpu, mask); | ||
| 251 | else | ||
| 252 | cpumask_clear_cpu(cpu, mask); | ||
| 253 | } | 248 | } |
| 254 | 249 | ||
| 255 | void __cpuinit numa_add_cpu(int cpu) | 250 | void __cpuinit numa_add_cpu(int cpu) |
| 256 | { | 251 | { |
| 257 | numa_set_cpumask(cpu, 1); | 252 | numa_set_cpumask(cpu, true); |
| 258 | } | 253 | } |
| 259 | 254 | ||
| 260 | void __cpuinit numa_remove_cpu(int cpu) | 255 | void __cpuinit numa_remove_cpu(int cpu) |
| 261 | { | 256 | { |
| 262 | numa_set_cpumask(cpu, 0); | 257 | numa_set_cpumask(cpu, false); |
| 263 | } | 258 | } |
| 264 | # endif /* !CONFIG_NUMA_EMU */ | 259 | # endif /* !CONFIG_NUMA_EMU */ |
| 265 | 260 | ||
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index ad091e4cff1..de84cc14037 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c | |||
| @@ -454,10 +454,9 @@ void __cpuinit numa_remove_cpu(int cpu) | |||
| 454 | cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); | 454 | cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); |
| 455 | } | 455 | } |
| 456 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 456 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
| 457 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | 457 | static void __cpuinit numa_set_cpumask(int cpu, bool enable) |
| 458 | { | 458 | { |
| 459 | struct cpumask *mask; | 459 | int nid, physnid; |
| 460 | int nid, physnid, i; | ||
| 461 | 460 | ||
| 462 | nid = early_cpu_to_node(cpu); | 461 | nid = early_cpu_to_node(cpu); |
| 463 | if (nid == NUMA_NO_NODE) { | 462 | if (nid == NUMA_NO_NODE) { |
| @@ -467,28 +466,21 @@ static void __cpuinit numa_set_cpumask(int cpu, int enable) | |||
| 467 | 466 | ||
| 468 | physnid = emu_nid_to_phys[nid]; | 467 | physnid = emu_nid_to_phys[nid]; |
| 469 | 468 | ||
| 470 | for_each_online_node(i) { | 469 | for_each_online_node(nid) { |
| 471 | if (emu_nid_to_phys[nid] != physnid) | 470 | if (emu_nid_to_phys[nid] != physnid) |
| 472 | continue; | 471 | continue; |
| 473 | 472 | ||
| 474 | mask = debug_cpumask_set_cpu(cpu, enable); | 473 | debug_cpumask_set_cpu(cpu, nid, enable); |
| 475 | if (!mask) | ||
| 476 | return; | ||
| 477 | |||
| 478 | if (enable) | ||
| 479 | cpumask_set_cpu(cpu, mask); | ||
| 480 | else | ||
| 481 | cpumask_clear_cpu(cpu, mask); | ||
| 482 | } | 474 | } |
| 483 | } | 475 | } |
| 484 | 476 | ||
| 485 | void __cpuinit numa_add_cpu(int cpu) | 477 | void __cpuinit numa_add_cpu(int cpu) |
| 486 | { | 478 | { |
| 487 | numa_set_cpumask(cpu, 1); | 479 | numa_set_cpumask(cpu, true); |
| 488 | } | 480 | } |
| 489 | 481 | ||
| 490 | void __cpuinit numa_remove_cpu(int cpu) | 482 | void __cpuinit numa_remove_cpu(int cpu) |
| 491 | { | 483 | { |
| 492 | numa_set_cpumask(cpu, 0); | 484 | numa_set_cpumask(cpu, false); |
| 493 | } | 485 | } |
| 494 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 486 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index a991b57f91f..aef7af92b28 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -1473,16 +1473,20 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
| 1473 | #endif | 1473 | #endif |
| 1474 | } | 1474 | } |
| 1475 | 1475 | ||
| 1476 | #ifdef CONFIG_X86_32 | ||
| 1476 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | 1477 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) |
| 1477 | { | 1478 | { |
| 1478 | unsigned long pfn = pte_pfn(pte); | ||
| 1479 | |||
| 1480 | #ifdef CONFIG_X86_32 | ||
| 1481 | /* If there's an existing pte, then don't allow _PAGE_RW to be set */ | 1479 | /* If there's an existing pte, then don't allow _PAGE_RW to be set */ |
| 1482 | if (pte_val_ma(*ptep) & _PAGE_PRESENT) | 1480 | if (pte_val_ma(*ptep) & _PAGE_PRESENT) |
| 1483 | pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & | 1481 | pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & |
| 1484 | pte_val_ma(pte)); | 1482 | pte_val_ma(pte)); |
| 1485 | #endif | 1483 | |
| 1484 | return pte; | ||
| 1485 | } | ||
| 1486 | #else /* CONFIG_X86_64 */ | ||
| 1487 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | ||
| 1488 | { | ||
| 1489 | unsigned long pfn = pte_pfn(pte); | ||
| 1486 | 1490 | ||
| 1487 | /* | 1491 | /* |
| 1488 | * If the new pfn is within the range of the newly allocated | 1492 | * If the new pfn is within the range of the newly allocated |
| @@ -1497,6 +1501,7 @@ static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | |||
| 1497 | 1501 | ||
| 1498 | return pte; | 1502 | return pte; |
| 1499 | } | 1503 | } |
| 1504 | #endif /* CONFIG_X86_64 */ | ||
| 1500 | 1505 | ||
| 1501 | /* Init-time set_pte while constructing initial pagetables, which | 1506 | /* Init-time set_pte while constructing initial pagetables, which |
| 1502 | doesn't allow RO pagetable pages to be remapped RW */ | 1507 | doesn't allow RO pagetable pages to be remapped RW */ |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index fa0269a9937..90bac0aac3a 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -227,7 +227,7 @@ char * __init xen_memory_setup(void) | |||
| 227 | 227 | ||
| 228 | memcpy(map_raw, map, sizeof(map)); | 228 | memcpy(map_raw, map, sizeof(map)); |
| 229 | e820.nr_map = 0; | 229 | e820.nr_map = 0; |
| 230 | xen_extra_mem_start = mem_end; | 230 | xen_extra_mem_start = max((1ULL << 32), mem_end); |
| 231 | for (i = 0; i < memmap.nr_entries; i++) { | 231 | for (i = 0; i < memmap.nr_entries; i++) { |
| 232 | unsigned long long end; | 232 | unsigned long long end; |
| 233 | 233 | ||
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c index d77089df412..4340ee076bd 100644 --- a/arch/xtensa/kernel/irq.c +++ b/arch/xtensa/kernel/irq.c | |||
| @@ -64,47 +64,41 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs) | |||
| 64 | 64 | ||
| 65 | int arch_show_interrupts(struct seq_file *p, int prec) | 65 | int arch_show_interrupts(struct seq_file *p, int prec) |
| 66 | { | 66 | { |
| 67 | int j; | ||
| 68 | |||
| 69 | seq_printf(p, "%*s: ", prec, "NMI"); | ||
| 70 | for_each_online_cpu(j) | ||
| 71 | seq_printf(p, "%10u ", nmi_count(j)); | ||
| 72 | seq_putc(p, '\n'); | ||
| 73 | seq_printf(p, "%*s: ", prec, "ERR"); | 67 | seq_printf(p, "%*s: ", prec, "ERR"); |
| 74 | seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); | 68 | seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); |
| 75 | return 0; | 69 | return 0; |
| 76 | } | 70 | } |
| 77 | 71 | ||
| 78 | static void xtensa_irq_mask(struct irq_chip *d) | 72 | static void xtensa_irq_mask(struct irq_data *d) |
| 79 | { | 73 | { |
| 80 | cached_irq_mask &= ~(1 << d->irq); | 74 | cached_irq_mask &= ~(1 << d->irq); |
| 81 | set_sr (cached_irq_mask, INTENABLE); | 75 | set_sr (cached_irq_mask, INTENABLE); |
| 82 | } | 76 | } |
| 83 | 77 | ||
| 84 | static void xtensa_irq_unmask(struct irq_chip *d) | 78 | static void xtensa_irq_unmask(struct irq_data *d) |
| 85 | { | 79 | { |
| 86 | cached_irq_mask |= 1 << d->irq; | 80 | cached_irq_mask |= 1 << d->irq; |
| 87 | set_sr (cached_irq_mask, INTENABLE); | 81 | set_sr (cached_irq_mask, INTENABLE); |
| 88 | } | 82 | } |
| 89 | 83 | ||
| 90 | static void xtensa_irq_enable(struct irq_chip *d) | 84 | static void xtensa_irq_enable(struct irq_data *d) |
| 91 | { | 85 | { |
| 92 | variant_irq_enable(d->irq); | 86 | variant_irq_enable(d->irq); |
| 93 | xtensa_irq_unmask(d->irq); | 87 | xtensa_irq_unmask(d->irq); |
| 94 | } | 88 | } |
| 95 | 89 | ||
| 96 | static void xtensa_irq_disable(struct irq_chip *d) | 90 | static void xtensa_irq_disable(struct irq_data *d) |
| 97 | { | 91 | { |
| 98 | xtensa_irq_mask(d->irq); | 92 | xtensa_irq_mask(d->irq); |
| 99 | variant_irq_disable(d->irq); | 93 | variant_irq_disable(d->irq); |
| 100 | } | 94 | } |
| 101 | 95 | ||
| 102 | static void xtensa_irq_ack(struct irq_chip *d) | 96 | static void xtensa_irq_ack(struct irq_data *d) |
| 103 | { | 97 | { |
| 104 | set_sr(1 << d->irq, INTCLEAR); | 98 | set_sr(1 << d->irq, INTCLEAR); |
| 105 | } | 99 | } |
| 106 | 100 | ||
| 107 | static int xtensa_irq_retrigger(struct irq_chip *d) | 101 | static int xtensa_irq_retrigger(struct irq_data *d) |
| 108 | { | 102 | { |
| 109 | set_sr (1 << d->irq, INTSET); | 103 | set_sr (1 << d->irq, INTSET); |
| 110 | return 1; | 104 | return 1; |
diff --git a/block/blk-core.c b/block/blk-core.c index 5fa3dd2705c..a2e58eeb354 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -292,7 +292,6 @@ EXPORT_SYMBOL(blk_sync_queue); | |||
| 292 | /** | 292 | /** |
| 293 | * __blk_run_queue - run a single device queue | 293 | * __blk_run_queue - run a single device queue |
| 294 | * @q: The queue to run | 294 | * @q: The queue to run |
| 295 | * @force_kblockd: Don't run @q->request_fn directly. Use kblockd. | ||
| 296 | * | 295 | * |
| 297 | * Description: | 296 | * Description: |
| 298 | * See @blk_run_queue. This variant must be called with the queue lock | 297 | * See @blk_run_queue. This variant must be called with the queue lock |
| @@ -303,15 +302,7 @@ void __blk_run_queue(struct request_queue *q) | |||
| 303 | if (unlikely(blk_queue_stopped(q))) | 302 | if (unlikely(blk_queue_stopped(q))) |
| 304 | return; | 303 | return; |
| 305 | 304 | ||
| 306 | /* | 305 | q->request_fn(q); |
| 307 | * Only recurse once to avoid overrunning the stack, let the unplug | ||
| 308 | * handling reinvoke the handler shortly if we already got there. | ||
| 309 | */ | ||
| 310 | if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { | ||
| 311 | q->request_fn(q); | ||
| 312 | queue_flag_clear(QUEUE_FLAG_REENTER, q); | ||
| 313 | } else | ||
| 314 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); | ||
| 315 | } | 306 | } |
| 316 | EXPORT_SYMBOL(__blk_run_queue); | 307 | EXPORT_SYMBOL(__blk_run_queue); |
| 317 | 308 | ||
| @@ -328,6 +319,7 @@ void blk_run_queue_async(struct request_queue *q) | |||
| 328 | if (likely(!blk_queue_stopped(q))) | 319 | if (likely(!blk_queue_stopped(q))) |
| 329 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); | 320 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); |
| 330 | } | 321 | } |
| 322 | EXPORT_SYMBOL(blk_run_queue_async); | ||
| 331 | 323 | ||
| 332 | /** | 324 | /** |
| 333 | * blk_run_queue - run a single device queue | 325 | * blk_run_queue - run a single device queue |
| @@ -2787,7 +2779,6 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) | |||
| 2787 | 2779 | ||
| 2788 | local_irq_restore(flags); | 2780 | local_irq_restore(flags); |
| 2789 | } | 2781 | } |
| 2790 | EXPORT_SYMBOL(blk_flush_plug_list); | ||
| 2791 | 2782 | ||
| 2792 | void blk_finish_plug(struct blk_plug *plug) | 2783 | void blk_finish_plug(struct blk_plug *plug) |
| 2793 | { | 2784 | { |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 6d735122bc5..bd236313f35 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
| @@ -66,14 +66,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count) | |||
| 66 | 66 | ||
| 67 | if (rl->count[BLK_RW_SYNC] >= q->nr_requests) { | 67 | if (rl->count[BLK_RW_SYNC] >= q->nr_requests) { |
| 68 | blk_set_queue_full(q, BLK_RW_SYNC); | 68 | blk_set_queue_full(q, BLK_RW_SYNC); |
| 69 | } else if (rl->count[BLK_RW_SYNC]+1 <= q->nr_requests) { | 69 | } else { |
| 70 | blk_clear_queue_full(q, BLK_RW_SYNC); | 70 | blk_clear_queue_full(q, BLK_RW_SYNC); |
| 71 | wake_up(&rl->wait[BLK_RW_SYNC]); | 71 | wake_up(&rl->wait[BLK_RW_SYNC]); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | if (rl->count[BLK_RW_ASYNC] >= q->nr_requests) { | 74 | if (rl->count[BLK_RW_ASYNC] >= q->nr_requests) { |
| 75 | blk_set_queue_full(q, BLK_RW_ASYNC); | 75 | blk_set_queue_full(q, BLK_RW_ASYNC); |
| 76 | } else if (rl->count[BLK_RW_ASYNC]+1 <= q->nr_requests) { | 76 | } else { |
| 77 | blk_clear_queue_full(q, BLK_RW_ASYNC); | 77 | blk_clear_queue_full(q, BLK_RW_ASYNC); |
| 78 | wake_up(&rl->wait[BLK_RW_ASYNC]); | 78 | wake_up(&rl->wait[BLK_RW_ASYNC]); |
| 79 | } | 79 | } |
| @@ -508,8 +508,10 @@ int blk_register_queue(struct gendisk *disk) | |||
| 508 | return ret; | 508 | return ret; |
| 509 | 509 | ||
| 510 | ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); | 510 | ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); |
| 511 | if (ret < 0) | 511 | if (ret < 0) { |
| 512 | blk_trace_remove_sysfs(dev); | ||
| 512 | return ret; | 513 | return ret; |
| 514 | } | ||
| 513 | 515 | ||
| 514 | kobject_uevent(&q->kobj, KOBJ_ADD); | 516 | kobject_uevent(&q->kobj, KOBJ_ADD); |
| 515 | 517 | ||
diff --git a/block/blk.h b/block/blk.h index c9df8fc3c99..61263463e38 100644 --- a/block/blk.h +++ b/block/blk.h | |||
| @@ -22,7 +22,6 @@ void blk_rq_timed_out_timer(unsigned long data); | |||
| 22 | void blk_delete_timer(struct request *); | 22 | void blk_delete_timer(struct request *); |
| 23 | void blk_add_timer(struct request *); | 23 | void blk_add_timer(struct request *); |
| 24 | void __generic_unplug_device(struct request_queue *); | 24 | void __generic_unplug_device(struct request_queue *); |
| 25 | void blk_run_queue_async(struct request_queue *q); | ||
| 26 | 25 | ||
| 27 | /* | 26 | /* |
| 28 | * Internal atomic flags for request handling | 27 | * Internal atomic flags for request handling |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 46b0a1d1d92..5b52011e3a4 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -2582,28 +2582,20 @@ static void cfq_put_queue(struct cfq_queue *cfqq) | |||
| 2582 | } | 2582 | } |
| 2583 | 2583 | ||
| 2584 | /* | 2584 | /* |
| 2585 | * Must always be called with the rcu_read_lock() held | 2585 | * Call func for each cic attached to this ioc. |
| 2586 | */ | 2586 | */ |
| 2587 | static void | 2587 | static void |
| 2588 | __call_for_each_cic(struct io_context *ioc, | 2588 | call_for_each_cic(struct io_context *ioc, |
| 2589 | void (*func)(struct io_context *, struct cfq_io_context *)) | 2589 | void (*func)(struct io_context *, struct cfq_io_context *)) |
| 2590 | { | 2590 | { |
| 2591 | struct cfq_io_context *cic; | 2591 | struct cfq_io_context *cic; |
| 2592 | struct hlist_node *n; | 2592 | struct hlist_node *n; |
| 2593 | 2593 | ||
| 2594 | rcu_read_lock(); | ||
| 2595 | |||
| 2594 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | 2596 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) |
| 2595 | func(ioc, cic); | 2597 | func(ioc, cic); |
| 2596 | } | ||
| 2597 | 2598 | ||
| 2598 | /* | ||
| 2599 | * Call func for each cic attached to this ioc. | ||
| 2600 | */ | ||
| 2601 | static void | ||
| 2602 | call_for_each_cic(struct io_context *ioc, | ||
| 2603 | void (*func)(struct io_context *, struct cfq_io_context *)) | ||
| 2604 | { | ||
| 2605 | rcu_read_lock(); | ||
| 2606 | __call_for_each_cic(ioc, func); | ||
| 2607 | rcu_read_unlock(); | 2599 | rcu_read_unlock(); |
| 2608 | } | 2600 | } |
| 2609 | 2601 | ||
| @@ -2664,7 +2656,7 @@ static void cfq_free_io_context(struct io_context *ioc) | |||
| 2664 | * should be ok to iterate over the known list, we will see all cic's | 2656 | * should be ok to iterate over the known list, we will see all cic's |
| 2665 | * since no new ones are added. | 2657 | * since no new ones are added. |
| 2666 | */ | 2658 | */ |
| 2667 | __call_for_each_cic(ioc, cic_free_func); | 2659 | call_for_each_cic(ioc, cic_free_func); |
| 2668 | } | 2660 | } |
| 2669 | 2661 | ||
| 2670 | static void cfq_put_cooperator(struct cfq_queue *cfqq) | 2662 | static void cfq_put_cooperator(struct cfq_queue *cfqq) |
diff --git a/block/elevator.c b/block/elevator.c index 6f6abc08bb5..45ca1e34f58 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -671,7 +671,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) | |||
| 671 | q->boundary_rq = rq; | 671 | q->boundary_rq = rq; |
| 672 | } | 672 | } |
| 673 | } else if (!(rq->cmd_flags & REQ_ELVPRIV) && | 673 | } else if (!(rq->cmd_flags & REQ_ELVPRIV) && |
| 674 | where == ELEVATOR_INSERT_SORT) | 674 | (where == ELEVATOR_INSERT_SORT || |
| 675 | where == ELEVATOR_INSERT_SORT_MERGE)) | ||
| 675 | where = ELEVATOR_INSERT_BACK; | 676 | where = ELEVATOR_INSERT_BACK; |
| 676 | 677 | ||
| 677 | switch (where) { | 678 | switch (where) { |
diff --git a/block/genhd.c b/block/genhd.c index b364bd038a1..2dd988723d7 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
| @@ -1588,9 +1588,13 @@ static void disk_events_workfn(struct work_struct *work) | |||
| 1588 | 1588 | ||
| 1589 | spin_unlock_irq(&ev->lock); | 1589 | spin_unlock_irq(&ev->lock); |
| 1590 | 1590 | ||
| 1591 | /* tell userland about new events */ | 1591 | /* |
| 1592 | * Tell userland about new events. Only the events listed in | ||
| 1593 | * @disk->events are reported. Unlisted events are processed the | ||
| 1594 | * same internally but never get reported to userland. | ||
| 1595 | */ | ||
| 1592 | for (i = 0; i < ARRAY_SIZE(disk_uevents); i++) | 1596 | for (i = 0; i < ARRAY_SIZE(disk_uevents); i++) |
| 1593 | if (events & (1 << i)) | 1597 | if (events & disk->events & (1 << i)) |
| 1594 | envp[nr_events++] = disk_uevents[i]; | 1598 | envp[nr_events++] = disk_uevents[i]; |
| 1595 | 1599 | ||
| 1596 | if (nr_events) | 1600 | if (nr_events) |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 39d829cd82d..71afe037131 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -150,7 +150,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
| 150 | { | 150 | { |
| 151 | AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | | 151 | AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | |
| 152 | AHCI_HFLAG_YES_NCQ), | 152 | AHCI_HFLAG_YES_NCQ), |
| 153 | .flags = AHCI_FLAG_COMMON, | 153 | .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, |
| 154 | .pio_mask = ATA_PIO4, | 154 | .pio_mask = ATA_PIO4, |
| 155 | .udma_mask = ATA_UDMA6, | 155 | .udma_mask = ATA_UDMA6, |
| 156 | .port_ops = &ahci_ops, | 156 | .port_ops = &ahci_ops, |
| @@ -261,6 +261,12 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 261 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | 261 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ |
| 262 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ | 262 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ |
| 263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ | 263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ |
| 264 | { PCI_VDEVICE(INTEL, 0x1e02), board_ahci }, /* Panther Point AHCI */ | ||
| 265 | { PCI_VDEVICE(INTEL, 0x1e03), board_ahci }, /* Panther Point AHCI */ | ||
| 266 | { PCI_VDEVICE(INTEL, 0x1e04), board_ahci }, /* Panther Point RAID */ | ||
| 267 | { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */ | ||
| 268 | { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */ | ||
| 269 | { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */ | ||
| 264 | 270 | ||
| 265 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 271 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| 266 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 272 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 39865009c25..12c5282e7fc 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
| @@ -229,6 +229,10 @@ enum { | |||
| 229 | EM_CTL_ALHD = (1 << 26), /* Activity LED */ | 229 | EM_CTL_ALHD = (1 << 26), /* Activity LED */ |
| 230 | EM_CTL_XMT = (1 << 25), /* Transmit Only */ | 230 | EM_CTL_XMT = (1 << 25), /* Transmit Only */ |
| 231 | EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ | 231 | EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ |
| 232 | EM_CTL_SGPIO = (1 << 19), /* SGPIO messages supported */ | ||
| 233 | EM_CTL_SES = (1 << 18), /* SES-2 messages supported */ | ||
| 234 | EM_CTL_SAFTE = (1 << 17), /* SAF-TE messages supported */ | ||
| 235 | EM_CTL_LED = (1 << 16), /* LED messages supported */ | ||
| 232 | 236 | ||
| 233 | /* em message type */ | 237 | /* em message type */ |
| 234 | EM_MSG_TYPE_LED = (1 << 0), /* LED */ | 238 | EM_MSG_TYPE_LED = (1 << 0), /* LED */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 0bc3fd6c3fd..6f6e7718b05 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
| @@ -309,6 +309,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
| 309 | { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 309 | { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
| 310 | /* SATA Controller IDE (PBG) */ | 310 | /* SATA Controller IDE (PBG) */ |
| 311 | { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 311 | { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 312 | /* SATA Controller IDE (Panther Point) */ | ||
| 313 | { 0x8086, 0x1e00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
| 314 | /* SATA Controller IDE (Panther Point) */ | ||
| 315 | { 0x8086, 0x1e01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
| 316 | /* SATA Controller IDE (Panther Point) */ | ||
| 317 | { 0x8086, 0x1e08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
| 318 | /* SATA Controller IDE (Panther Point) */ | ||
| 319 | { 0x8086, 0x1e09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
| 312 | { } /* terminate list */ | 320 | { } /* terminate list */ |
| 313 | }; | 321 | }; |
| 314 | 322 | ||
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 26d452339e9..ff9d832a163 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
| @@ -109,6 +109,8 @@ static ssize_t ahci_read_em_buffer(struct device *dev, | |||
| 109 | static ssize_t ahci_store_em_buffer(struct device *dev, | 109 | static ssize_t ahci_store_em_buffer(struct device *dev, |
| 110 | struct device_attribute *attr, | 110 | struct device_attribute *attr, |
| 111 | const char *buf, size_t size); | 111 | const char *buf, size_t size); |
| 112 | static ssize_t ahci_show_em_supported(struct device *dev, | ||
| 113 | struct device_attribute *attr, char *buf); | ||
| 112 | 114 | ||
| 113 | static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); | 115 | static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); |
| 114 | static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); | 116 | static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); |
| @@ -116,6 +118,7 @@ static DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); | |||
| 116 | static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); | 118 | static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); |
| 117 | static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, | 119 | static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, |
| 118 | ahci_read_em_buffer, ahci_store_em_buffer); | 120 | ahci_read_em_buffer, ahci_store_em_buffer); |
| 121 | static DEVICE_ATTR(em_message_supported, S_IRUGO, ahci_show_em_supported, NULL); | ||
| 119 | 122 | ||
| 120 | struct device_attribute *ahci_shost_attrs[] = { | 123 | struct device_attribute *ahci_shost_attrs[] = { |
| 121 | &dev_attr_link_power_management_policy, | 124 | &dev_attr_link_power_management_policy, |
| @@ -126,6 +129,7 @@ struct device_attribute *ahci_shost_attrs[] = { | |||
| 126 | &dev_attr_ahci_host_version, | 129 | &dev_attr_ahci_host_version, |
| 127 | &dev_attr_ahci_port_cmd, | 130 | &dev_attr_ahci_port_cmd, |
| 128 | &dev_attr_em_buffer, | 131 | &dev_attr_em_buffer, |
| 132 | &dev_attr_em_message_supported, | ||
| 129 | NULL | 133 | NULL |
| 130 | }; | 134 | }; |
| 131 | EXPORT_SYMBOL_GPL(ahci_shost_attrs); | 135 | EXPORT_SYMBOL_GPL(ahci_shost_attrs); |
| @@ -343,6 +347,24 @@ static ssize_t ahci_store_em_buffer(struct device *dev, | |||
| 343 | return size; | 347 | return size; |
| 344 | } | 348 | } |
| 345 | 349 | ||
| 350 | static ssize_t ahci_show_em_supported(struct device *dev, | ||
| 351 | struct device_attribute *attr, char *buf) | ||
| 352 | { | ||
| 353 | struct Scsi_Host *shost = class_to_shost(dev); | ||
| 354 | struct ata_port *ap = ata_shost_to_port(shost); | ||
| 355 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
| 356 | void __iomem *mmio = hpriv->mmio; | ||
| 357 | u32 em_ctl; | ||
| 358 | |||
| 359 | em_ctl = readl(mmio + HOST_EM_CTL); | ||
| 360 | |||
| 361 | return sprintf(buf, "%s%s%s%s\n", | ||
| 362 | em_ctl & EM_CTL_LED ? "led " : "", | ||
| 363 | em_ctl & EM_CTL_SAFTE ? "saf-te " : "", | ||
| 364 | em_ctl & EM_CTL_SES ? "ses-2 " : "", | ||
| 365 | em_ctl & EM_CTL_SGPIO ? "sgpio " : ""); | ||
| 366 | } | ||
| 367 | |||
| 346 | /** | 368 | /** |
| 347 | * ahci_save_initial_config - Save and fixup initial config values | 369 | * ahci_save_initial_config - Save and fixup initial config values |
| 348 | * @dev: target AHCI device | 370 | * @dev: target AHCI device |
| @@ -539,6 +561,27 @@ void ahci_start_engine(struct ata_port *ap) | |||
| 539 | { | 561 | { |
| 540 | void __iomem *port_mmio = ahci_port_base(ap); | 562 | void __iomem *port_mmio = ahci_port_base(ap); |
| 541 | u32 tmp; | 563 | u32 tmp; |
| 564 | u8 status; | ||
| 565 | |||
| 566 | status = readl(port_mmio + PORT_TFDATA) & 0xFF; | ||
| 567 | |||
| 568 | /* | ||
| 569 | * At end of section 10.1 of AHCI spec (rev 1.3), it states | ||
| 570 | * Software shall not set PxCMD.ST to 1 until it is determined | ||
| 571 | * that a functoinal device is present on the port as determined by | ||
| 572 | * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h | ||
| 573 | * | ||
| 574 | * Even though most AHCI host controllers work without this check, | ||
| 575 | * specific controller will fail under this condition | ||
| 576 | */ | ||
| 577 | if (status & (ATA_BUSY | ATA_DRQ)) | ||
| 578 | return; | ||
| 579 | else { | ||
| 580 | ahci_scr_read(&ap->link, SCR_STATUS, &tmp); | ||
| 581 | |||
| 582 | if ((tmp & 0xf) != 0x3) | ||
| 583 | return; | ||
| 584 | } | ||
| 542 | 585 | ||
| 543 | /* start DMA */ | 586 | /* start DMA */ |
| 544 | tmp = readl(port_mmio + PORT_CMD); | 587 | tmp = readl(port_mmio + PORT_CMD); |
| @@ -1897,7 +1940,17 @@ static void ahci_pmp_attach(struct ata_port *ap) | |||
| 1897 | ahci_enable_fbs(ap); | 1940 | ahci_enable_fbs(ap); |
| 1898 | 1941 | ||
| 1899 | pp->intr_mask |= PORT_IRQ_BAD_PMP; | 1942 | pp->intr_mask |= PORT_IRQ_BAD_PMP; |
| 1900 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | 1943 | |
| 1944 | /* | ||
| 1945 | * We must not change the port interrupt mask register if the | ||
| 1946 | * port is marked frozen, the value in pp->intr_mask will be | ||
| 1947 | * restored later when the port is thawed. | ||
| 1948 | * | ||
| 1949 | * Note that during initialization, the port is marked as | ||
| 1950 | * frozen since the irq handler is not yet registered. | ||
| 1951 | */ | ||
| 1952 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | ||
| 1953 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | ||
| 1901 | } | 1954 | } |
| 1902 | 1955 | ||
| 1903 | static void ahci_pmp_detach(struct ata_port *ap) | 1956 | static void ahci_pmp_detach(struct ata_port *ap) |
| @@ -1913,7 +1966,10 @@ static void ahci_pmp_detach(struct ata_port *ap) | |||
| 1913 | writel(cmd, port_mmio + PORT_CMD); | 1966 | writel(cmd, port_mmio + PORT_CMD); |
| 1914 | 1967 | ||
| 1915 | pp->intr_mask &= ~PORT_IRQ_BAD_PMP; | 1968 | pp->intr_mask &= ~PORT_IRQ_BAD_PMP; |
| 1916 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | 1969 | |
| 1970 | /* see comment above in ahci_pmp_attach() */ | ||
| 1971 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | ||
| 1972 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | ||
| 1917 | } | 1973 | } |
| 1918 | 1974 | ||
| 1919 | int ahci_port_resume(struct ata_port *ap) | 1975 | int ahci_port_resume(struct ata_port *ap) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 423c0a6952b..76c3c15cb1e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4139,6 +4139,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4139 | */ | 4139 | */ |
| 4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, | 4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, |
| 4141 | { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, | 4141 | { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, |
| 4142 | { "PIONEER DVD-RW DVR-216D", "1.08", ATA_HORKAGE_NOSETXFER }, | ||
| 4142 | 4143 | ||
| 4143 | /* End Marker */ | 4144 | /* End Marker */ |
| 4144 | { } | 4145 | { } |
| @@ -5480,7 +5481,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) | |||
| 5480 | if (!ap) | 5481 | if (!ap) |
| 5481 | return NULL; | 5482 | return NULL; |
| 5482 | 5483 | ||
| 5483 | ap->pflags |= ATA_PFLAG_INITIALIZING; | 5484 | ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; |
| 5484 | ap->lock = &host->lock; | 5485 | ap->lock = &host->lock; |
| 5485 | ap->print_id = -1; | 5486 | ap->print_id = -1; |
| 5486 | ap->host = host; | 5487 | ap->host = host; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 88cd22fa65c..f26f2fe3480 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -3316,6 +3316,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 3316 | struct ata_eh_context *ehc = &link->eh_context; | 3316 | struct ata_eh_context *ehc = &link->eh_context; |
| 3317 | struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; | 3317 | struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; |
| 3318 | enum ata_lpm_policy old_policy = link->lpm_policy; | 3318 | enum ata_lpm_policy old_policy = link->lpm_policy; |
| 3319 | bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM; | ||
| 3319 | unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; | 3320 | unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; |
| 3320 | unsigned int err_mask; | 3321 | unsigned int err_mask; |
| 3321 | int rc; | 3322 | int rc; |
| @@ -3332,7 +3333,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 3332 | */ | 3333 | */ |
| 3333 | ata_for_each_dev(dev, link, ENABLED) { | 3334 | ata_for_each_dev(dev, link, ENABLED) { |
| 3334 | bool hipm = ata_id_has_hipm(dev->id); | 3335 | bool hipm = ata_id_has_hipm(dev->id); |
| 3335 | bool dipm = ata_id_has_dipm(dev->id); | 3336 | bool dipm = ata_id_has_dipm(dev->id) && !no_dipm; |
| 3336 | 3337 | ||
| 3337 | /* find the first enabled and LPM enabled devices */ | 3338 | /* find the first enabled and LPM enabled devices */ |
| 3338 | if (!link_dev) | 3339 | if (!link_dev) |
| @@ -3389,7 +3390,8 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 3389 | 3390 | ||
| 3390 | /* host config updated, enable DIPM if transitioning to MIN_POWER */ | 3391 | /* host config updated, enable DIPM if transitioning to MIN_POWER */ |
| 3391 | ata_for_each_dev(dev, link, ENABLED) { | 3392 | ata_for_each_dev(dev, link, ENABLED) { |
| 3392 | if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { | 3393 | if (policy == ATA_LPM_MIN_POWER && !no_dipm && |
| 3394 | ata_id_has_dipm(dev->id)) { | ||
| 3393 | err_mask = ata_dev_set_feature(dev, | 3395 | err_mask = ata_dev_set_feature(dev, |
| 3394 | SETFEATURES_SATA_ENABLE, SATA_DIPM); | 3396 | SETFEATURES_SATA_ENABLE, SATA_DIPM); |
| 3395 | if (err_mask && err_mask != AC_ERR_DEV) { | 3397 | if (err_mask && err_mask != AC_ERR_DEV) { |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 0da0dcc7dd0..a5fdbdcb0fa 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
| @@ -33,11 +33,12 @@ | |||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | #define DRV_NAME "pata_at91" | 35 | #define DRV_NAME "pata_at91" |
| 36 | #define DRV_VERSION "0.1" | 36 | #define DRV_VERSION "0.2" |
| 37 | 37 | ||
| 38 | #define CF_IDE_OFFSET 0x00c00000 | 38 | #define CF_IDE_OFFSET 0x00c00000 |
| 39 | #define CF_ALT_IDE_OFFSET 0x00e00000 | 39 | #define CF_ALT_IDE_OFFSET 0x00e00000 |
| 40 | #define CF_IDE_RES_SIZE 0x08 | 40 | #define CF_IDE_RES_SIZE 0x08 |
| 41 | #define NCS_RD_PULSE_LIMIT 0x3f /* maximal value for pulse bitfields */ | ||
| 41 | 42 | ||
| 42 | struct at91_ide_info { | 43 | struct at91_ide_info { |
| 43 | unsigned long mode; | 44 | unsigned long mode; |
| @@ -49,8 +50,18 @@ struct at91_ide_info { | |||
| 49 | void __iomem *alt_addr; | 50 | void __iomem *alt_addr; |
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| 52 | static const struct ata_timing initial_timing = | 53 | static const struct ata_timing initial_timing = { |
| 53 | {XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0}; | 54 | .mode = XFER_PIO_0, |
| 55 | .setup = 70, | ||
| 56 | .act8b = 290, | ||
| 57 | .rec8b = 240, | ||
| 58 | .cyc8b = 600, | ||
| 59 | .active = 165, | ||
| 60 | .recover = 150, | ||
| 61 | .dmack_hold = 0, | ||
| 62 | .cycle = 600, | ||
| 63 | .udma = 0 | ||
| 64 | }; | ||
| 54 | 65 | ||
| 55 | static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) | 66 | static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) |
| 56 | { | 67 | { |
| @@ -109,6 +120,11 @@ static void set_smc_timing(struct device *dev, | |||
| 109 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ | 120 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ |
| 110 | ncs_read_setup = 1; | 121 | ncs_read_setup = 1; |
| 111 | ncs_read_pulse = read_cycle - 2; | 122 | ncs_read_pulse = read_cycle - 2; |
| 123 | if (ncs_read_pulse > NCS_RD_PULSE_LIMIT) { | ||
| 124 | ncs_read_pulse = NCS_RD_PULSE_LIMIT; | ||
| 125 | dev_warn(dev, "ncs_read_pulse limited to maximal value %lu\n", | ||
| 126 | ncs_read_pulse); | ||
| 127 | } | ||
| 112 | 128 | ||
| 113 | /* Write timings same as read timings */ | 129 | /* Write timings same as read timings */ |
| 114 | write_cycle = read_cycle; | 130 | write_cycle = read_cycle; |
diff --git a/drivers/base/syscore.c b/drivers/base/syscore.c index 90af2943f9e..c126db3cb7d 100644 --- a/drivers/base/syscore.c +++ b/drivers/base/syscore.c | |||
| @@ -73,6 +73,7 @@ int syscore_suspend(void) | |||
| 73 | 73 | ||
| 74 | return ret; | 74 | return ret; |
| 75 | } | 75 | } |
| 76 | EXPORT_SYMBOL_GPL(syscore_suspend); | ||
| 76 | 77 | ||
| 77 | /** | 78 | /** |
| 78 | * syscore_resume - Execute all the registered system core resume callbacks. | 79 | * syscore_resume - Execute all the registered system core resume callbacks. |
| @@ -95,6 +96,7 @@ void syscore_resume(void) | |||
| 95 | "Interrupts enabled after %pF\n", ops->resume); | 96 | "Interrupts enabled after %pF\n", ops->resume); |
| 96 | } | 97 | } |
| 97 | } | 98 | } |
| 99 | EXPORT_SYMBOL_GPL(syscore_resume); | ||
| 98 | #endif /* CONFIG_PM_SLEEP */ | 100 | #endif /* CONFIG_PM_SLEEP */ |
| 99 | 101 | ||
| 100 | /** | 102 | /** |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 012cba0d6d9..b072648dc3f 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
| @@ -115,6 +115,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) | |||
| 115 | struct agp_memory *new; | 115 | struct agp_memory *new; |
| 116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); | 116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); |
| 117 | 117 | ||
| 118 | if (INT_MAX/sizeof(struct page *) < num_agp_pages) | ||
| 119 | return NULL; | ||
| 120 | |||
| 118 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); | 121 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); |
| 119 | if (new == NULL) | 122 | if (new == NULL) |
| 120 | return NULL; | 123 | return NULL; |
| @@ -234,11 +237,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, | |||
| 234 | int scratch_pages; | 237 | int scratch_pages; |
| 235 | struct agp_memory *new; | 238 | struct agp_memory *new; |
| 236 | size_t i; | 239 | size_t i; |
| 240 | int cur_memory; | ||
| 237 | 241 | ||
| 238 | if (!bridge) | 242 | if (!bridge) |
| 239 | return NULL; | 243 | return NULL; |
| 240 | 244 | ||
| 241 | if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp) | 245 | cur_memory = atomic_read(&bridge->current_memory_agp); |
| 246 | if ((cur_memory + page_count > bridge->max_memory_agp) || | ||
| 247 | (cur_memory + page_count < page_count)) | ||
| 242 | return NULL; | 248 | return NULL; |
| 243 | 249 | ||
| 244 | if (type >= AGP_USER_TYPES) { | 250 | if (type >= AGP_USER_TYPES) { |
| @@ -1089,8 +1095,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) | |||
| 1089 | return -EINVAL; | 1095 | return -EINVAL; |
| 1090 | } | 1096 | } |
| 1091 | 1097 | ||
| 1092 | /* AK: could wrap */ | 1098 | if (((pg_start + mem->page_count) > num_entries) || |
| 1093 | if ((pg_start + mem->page_count) > num_entries) | 1099 | ((pg_start + mem->page_count) < pg_start)) |
| 1094 | return -EINVAL; | 1100 | return -EINVAL; |
| 1095 | 1101 | ||
| 1096 | j = pg_start; | 1102 | j = pg_start; |
| @@ -1124,7 +1130,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
| 1124 | { | 1130 | { |
| 1125 | size_t i; | 1131 | size_t i; |
| 1126 | struct agp_bridge_data *bridge; | 1132 | struct agp_bridge_data *bridge; |
| 1127 | int mask_type; | 1133 | int mask_type, num_entries; |
| 1128 | 1134 | ||
| 1129 | bridge = mem->bridge; | 1135 | bridge = mem->bridge; |
| 1130 | if (!bridge) | 1136 | if (!bridge) |
| @@ -1136,6 +1142,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
| 1136 | if (type != mem->type) | 1142 | if (type != mem->type) |
| 1137 | return -EINVAL; | 1143 | return -EINVAL; |
| 1138 | 1144 | ||
| 1145 | num_entries = agp_num_entries(); | ||
| 1146 | if (((pg_start + mem->page_count) > num_entries) || | ||
| 1147 | ((pg_start + mem->page_count) < pg_start)) | ||
| 1148 | return -EINVAL; | ||
| 1149 | |||
| 1139 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); | 1150 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); |
| 1140 | if (mask_type != 0) { | 1151 | if (mask_type != 0) { |
| 1141 | /* The generic routines know nothing of memory types */ | 1152 | /* The generic routines know nothing of memory types */ |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 84b164d1eb2..838568a7dbf 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port) | |||
| 1280 | spin_lock_irq(&pdrvdata_lock); | 1280 | spin_lock_irq(&pdrvdata_lock); |
| 1281 | list_del(&port->cons.list); | 1281 | list_del(&port->cons.list); |
| 1282 | spin_unlock_irq(&pdrvdata_lock); | 1282 | spin_unlock_irq(&pdrvdata_lock); |
| 1283 | #if 0 | ||
| 1284 | /* | ||
| 1285 | * hvc_remove() not called as removing one hvc port | ||
| 1286 | * results in other hvc ports getting frozen. | ||
| 1287 | * | ||
| 1288 | * Once this is resolved in hvc, this functionality | ||
| 1289 | * will be enabled. Till that is done, the -EPIPE | ||
| 1290 | * return from get_chars() above will help | ||
| 1291 | * hvc_console.c to clean up on ports we remove here. | ||
| 1292 | */ | ||
| 1293 | hvc_remove(port->cons.hvc); | 1283 | hvc_remove(port->cons.hvc); |
| 1294 | #endif | ||
| 1295 | } | 1284 | } |
| 1296 | 1285 | ||
| 1297 | /* Remove unused data this port might have received. */ | 1286 | /* Remove unused data this port might have received. */ |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 432fc04c6bf..e522c702b04 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -3771,8 +3771,11 @@ static bool g4x_compute_wm0(struct drm_device *dev, | |||
| 3771 | int entries, tlb_miss; | 3771 | int entries, tlb_miss; |
| 3772 | 3772 | ||
| 3773 | crtc = intel_get_crtc_for_plane(dev, plane); | 3773 | crtc = intel_get_crtc_for_plane(dev, plane); |
| 3774 | if (crtc->fb == NULL || !crtc->enabled) | 3774 | if (crtc->fb == NULL || !crtc->enabled) { |
| 3775 | *cursor_wm = cursor->guard_size; | ||
| 3776 | *plane_wm = display->guard_size; | ||
| 3775 | return false; | 3777 | return false; |
| 3778 | } | ||
| 3776 | 3779 | ||
| 3777 | htotal = crtc->mode.htotal; | 3780 | htotal = crtc->mode.htotal; |
| 3778 | hdisplay = crtc->mode.hdisplay; | 3781 | hdisplay = crtc->mode.hdisplay; |
| @@ -6215,36 +6218,6 @@ cleanup_work: | |||
| 6215 | return ret; | 6218 | return ret; |
| 6216 | } | 6219 | } |
| 6217 | 6220 | ||
| 6218 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
| 6219 | { | ||
| 6220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 6221 | |||
| 6222 | /* Reset flags back to the 'unknown' status so that they | ||
| 6223 | * will be correctly set on the initial modeset. | ||
| 6224 | */ | ||
| 6225 | intel_crtc->dpms_mode = -1; | ||
| 6226 | } | ||
| 6227 | |||
| 6228 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | ||
| 6229 | .dpms = intel_crtc_dpms, | ||
| 6230 | .mode_fixup = intel_crtc_mode_fixup, | ||
| 6231 | .mode_set = intel_crtc_mode_set, | ||
| 6232 | .mode_set_base = intel_pipe_set_base, | ||
| 6233 | .mode_set_base_atomic = intel_pipe_set_base_atomic, | ||
| 6234 | .load_lut = intel_crtc_load_lut, | ||
| 6235 | .disable = intel_crtc_disable, | ||
| 6236 | }; | ||
| 6237 | |||
| 6238 | static const struct drm_crtc_funcs intel_crtc_funcs = { | ||
| 6239 | .reset = intel_crtc_reset, | ||
| 6240 | .cursor_set = intel_crtc_cursor_set, | ||
| 6241 | .cursor_move = intel_crtc_cursor_move, | ||
| 6242 | .gamma_set = intel_crtc_gamma_set, | ||
| 6243 | .set_config = drm_crtc_helper_set_config, | ||
| 6244 | .destroy = intel_crtc_destroy, | ||
| 6245 | .page_flip = intel_crtc_page_flip, | ||
| 6246 | }; | ||
| 6247 | |||
| 6248 | static void intel_sanitize_modesetting(struct drm_device *dev, | 6221 | static void intel_sanitize_modesetting(struct drm_device *dev, |
| 6249 | int pipe, int plane) | 6222 | int pipe, int plane) |
| 6250 | { | 6223 | { |
| @@ -6281,6 +6254,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev, | |||
| 6281 | intel_disable_pipe(dev_priv, pipe); | 6254 | intel_disable_pipe(dev_priv, pipe); |
| 6282 | } | 6255 | } |
| 6283 | 6256 | ||
| 6257 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
| 6258 | { | ||
| 6259 | struct drm_device *dev = crtc->dev; | ||
| 6260 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 6261 | |||
| 6262 | /* Reset flags back to the 'unknown' status so that they | ||
| 6263 | * will be correctly set on the initial modeset. | ||
| 6264 | */ | ||
| 6265 | intel_crtc->dpms_mode = -1; | ||
| 6266 | |||
| 6267 | /* We need to fix up any BIOS configuration that conflicts with | ||
| 6268 | * our expectations. | ||
| 6269 | */ | ||
| 6270 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
| 6271 | } | ||
| 6272 | |||
| 6273 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | ||
| 6274 | .dpms = intel_crtc_dpms, | ||
| 6275 | .mode_fixup = intel_crtc_mode_fixup, | ||
| 6276 | .mode_set = intel_crtc_mode_set, | ||
| 6277 | .mode_set_base = intel_pipe_set_base, | ||
| 6278 | .mode_set_base_atomic = intel_pipe_set_base_atomic, | ||
| 6279 | .load_lut = intel_crtc_load_lut, | ||
| 6280 | .disable = intel_crtc_disable, | ||
| 6281 | }; | ||
| 6282 | |||
| 6283 | static const struct drm_crtc_funcs intel_crtc_funcs = { | ||
| 6284 | .reset = intel_crtc_reset, | ||
| 6285 | .cursor_set = intel_crtc_cursor_set, | ||
| 6286 | .cursor_move = intel_crtc_cursor_move, | ||
| 6287 | .gamma_set = intel_crtc_gamma_set, | ||
| 6288 | .set_config = drm_crtc_helper_set_config, | ||
| 6289 | .destroy = intel_crtc_destroy, | ||
| 6290 | .page_flip = intel_crtc_page_flip, | ||
| 6291 | }; | ||
| 6292 | |||
| 6284 | static void intel_crtc_init(struct drm_device *dev, int pipe) | 6293 | static void intel_crtc_init(struct drm_device *dev, int pipe) |
| 6285 | { | 6294 | { |
| 6286 | drm_i915_private_t *dev_priv = dev->dev_private; | 6295 | drm_i915_private_t *dev_priv = dev->dev_private; |
| @@ -6330,8 +6339,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
| 6330 | 6339 | ||
| 6331 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, | 6340 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, |
| 6332 | (unsigned long)intel_crtc); | 6341 | (unsigned long)intel_crtc); |
| 6333 | |||
| 6334 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
| 6335 | } | 6342 | } |
| 6336 | 6343 | ||
| 6337 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 6344 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 4256b8ef394..6b22c1dcc01 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
| @@ -1151,10 +1151,10 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
| 1151 | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); | 1151 | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); |
| 1152 | { | 1152 | { |
| 1153 | int pipeconf_reg = PIPECONF(pipe); | 1153 | int pipeconf_reg = PIPECONF(pipe); |
| 1154 | int dspcntr_reg = DSPCNTR(pipe); | 1154 | int dspcntr_reg = DSPCNTR(intel_crtc->plane); |
| 1155 | int pipeconf = I915_READ(pipeconf_reg); | 1155 | int pipeconf = I915_READ(pipeconf_reg); |
| 1156 | int dspcntr = I915_READ(dspcntr_reg); | 1156 | int dspcntr = I915_READ(dspcntr_reg); |
| 1157 | int dspbase_reg = DSPADDR(pipe); | 1157 | int dspbase_reg = DSPADDR(intel_crtc->plane); |
| 1158 | int xpos = 0x0, ypos = 0x0; | 1158 | int xpos = 0x0, ypos = 0x0; |
| 1159 | unsigned int xsize, ysize; | 1159 | unsigned int xsize, ysize; |
| 1160 | /* Pipe must be off here */ | 1160 | /* Pipe must be off here */ |
| @@ -1378,7 +1378,9 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
| 1378 | if (type < 0) | 1378 | if (type < 0) |
| 1379 | return connector_status_disconnected; | 1379 | return connector_status_disconnected; |
| 1380 | 1380 | ||
| 1381 | intel_tv->type = type; | ||
| 1381 | intel_tv_find_better_format(connector); | 1382 | intel_tv_find_better_format(connector); |
| 1383 | |||
| 1382 | return connector_status_connected; | 1384 | return connector_status_connected; |
| 1383 | } | 1385 | } |
| 1384 | 1386 | ||
| @@ -1670,8 +1672,7 @@ intel_tv_init(struct drm_device *dev) | |||
| 1670 | * | 1672 | * |
| 1671 | * More recent chipsets favour HDMI rather than integrated S-Video. | 1673 | * More recent chipsets favour HDMI rather than integrated S-Video. |
| 1672 | */ | 1674 | */ |
| 1673 | connector->polled = | 1675 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
| 1674 | DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; | ||
| 1675 | 1676 | ||
| 1676 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, | 1677 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, |
| 1677 | DRM_MODE_CONNECTOR_SVIDEO); | 1678 | DRM_MODE_CONNECTOR_SVIDEO); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 43fd0167448..e9bc135d918 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -2580,7 +2580,7 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
| 2580 | u32 wptr, tmp; | 2580 | u32 wptr, tmp; |
| 2581 | 2581 | ||
| 2582 | if (rdev->wb.enabled) | 2582 | if (rdev->wb.enabled) |
| 2583 | wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; | 2583 | wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]); |
| 2584 | else | 2584 | else |
| 2585 | wptr = RREG32(IH_RB_WPTR); | 2585 | wptr = RREG32(IH_RB_WPTR); |
| 2586 | 2586 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 15d58292677..6f27593901c 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -3231,7 +3231,7 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
| 3231 | u32 wptr, tmp; | 3231 | u32 wptr, tmp; |
| 3232 | 3232 | ||
| 3233 | if (rdev->wb.enabled) | 3233 | if (rdev->wb.enabled) |
| 3234 | wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; | 3234 | wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]); |
| 3235 | else | 3235 | else |
| 3236 | wptr = RREG32(IH_RB_WPTR); | 3236 | wptr = RREG32(IH_RB_WPTR); |
| 3237 | 3237 | ||
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c index edfb92e4173..196ffafafd8 100644 --- a/drivers/hwmon/pmbus_core.c +++ b/drivers/hwmon/pmbus_core.c | |||
| @@ -139,7 +139,6 @@ struct pmbus_data { | |||
| 139 | * A single status register covers multiple attributes, | 139 | * A single status register covers multiple attributes, |
| 140 | * so we keep them all together. | 140 | * so we keep them all together. |
| 141 | */ | 141 | */ |
| 142 | u8 status_bits; | ||
| 143 | u8 status[PB_NUM_STATUS_REG]; | 142 | u8 status[PB_NUM_STATUS_REG]; |
| 144 | 143 | ||
| 145 | u8 currpage; | 144 | u8 currpage; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index fd1e1179913..a5ec5a7cb38 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
| @@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
| 1782 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
| 1783 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
| 1784 | g->flags |= GENHD_FL_REMOVABLE; | 1784 | g->flags |= GENHD_FL_REMOVABLE; |
| 1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
| 1786 | add_disk(g); | 1785 | add_disk(g); |
| 1787 | return 0; | 1786 | return 0; |
| 1788 | 1787 | ||
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 2a6bc50e8a4..02caa7dd51c 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
| @@ -79,6 +79,12 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) | |||
| 79 | return CDS_DRIVE_NOT_READY; | 79 | return CDS_DRIVE_NOT_READY; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | /* | ||
| 83 | * ide-cd always generates media changed event if media is missing, which | ||
| 84 | * makes it impossible to use for proper event reporting, so disk->events | ||
| 85 | * is cleared to 0 and the following function is used only to trigger | ||
| 86 | * revalidation and never propagated to userland. | ||
| 87 | */ | ||
| 82 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, | 88 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, |
| 83 | unsigned int clearing, int slot_nr) | 89 | unsigned int clearing, int slot_nr) |
| 84 | { | 90 | { |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index c4ffd488893..70ea8763567 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
| @@ -298,6 +298,12 @@ static unsigned int ide_gd_check_events(struct gendisk *disk, | |||
| 298 | return 0; | 298 | return 0; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | /* | ||
| 302 | * The following is used to force revalidation on the first open on | ||
| 303 | * removeable devices, and never gets reported to userland as | ||
| 304 | * genhd->events is 0. This is intended as removeable ide disk | ||
| 305 | * can't really detect MEDIA_CHANGE events. | ||
| 306 | */ | ||
| 301 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; | 307 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; |
| 302 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 308 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
| 303 | 309 | ||
| @@ -413,7 +419,6 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
| 413 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) | 419 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
| 414 | g->flags = GENHD_FL_REMOVABLE; | 420 | g->flags = GENHD_FL_REMOVABLE; |
| 415 | g->fops = &ide_gd_ops; | 421 | g->fops = &ide_gd_ops; |
| 416 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
| 417 | add_disk(g); | 422 | add_disk(g); |
| 418 | return 0; | 423 | return 0; |
| 419 | 424 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 6e853c61d87..7d6f7f18a92 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -3170,6 +3170,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
| 3170 | mddev->layout = mddev->new_layout; | 3170 | mddev->layout = mddev->new_layout; |
| 3171 | mddev->chunk_sectors = mddev->new_chunk_sectors; | 3171 | mddev->chunk_sectors = mddev->new_chunk_sectors; |
| 3172 | mddev->delta_disks = 0; | 3172 | mddev->delta_disks = 0; |
| 3173 | mddev->degraded = 0; | ||
| 3173 | if (mddev->pers->sync_request == NULL) { | 3174 | if (mddev->pers->sync_request == NULL) { |
| 3174 | /* this is now an array without redundancy, so | 3175 | /* this is now an array without redundancy, so |
| 3175 | * it must always be in_sync | 3176 | * it must always be in_sync |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f301e6ae220..49bf5f89143 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -5151,7 +5151,6 @@ static int run(mddev_t *mddev) | |||
| 5151 | 5151 | ||
| 5152 | mddev->queue->backing_dev_info.congested_data = mddev; | 5152 | mddev->queue->backing_dev_info.congested_data = mddev; |
| 5153 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 5153 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
| 5154 | mddev->queue->queue_lock = &conf->device_lock; | ||
| 5155 | 5154 | ||
| 5156 | chunk_size = mddev->chunk_sectors << 9; | 5155 | chunk_size = mddev->chunk_sectors << 9; |
| 5157 | blk_queue_io_min(mddev->queue, chunk_size); | 5156 | blk_queue_io_min(mddev->queue, chunk_size); |
| @@ -5679,6 +5678,7 @@ static void raid5_quiesce(mddev_t *mddev, int state) | |||
| 5679 | static void *raid45_takeover_raid0(mddev_t *mddev, int level) | 5678 | static void *raid45_takeover_raid0(mddev_t *mddev, int level) |
| 5680 | { | 5679 | { |
| 5681 | struct raid0_private_data *raid0_priv = mddev->private; | 5680 | struct raid0_private_data *raid0_priv = mddev->private; |
| 5681 | sector_t sectors; | ||
| 5682 | 5682 | ||
| 5683 | /* for raid0 takeover only one zone is supported */ | 5683 | /* for raid0 takeover only one zone is supported */ |
| 5684 | if (raid0_priv->nr_strip_zones > 1) { | 5684 | if (raid0_priv->nr_strip_zones > 1) { |
| @@ -5687,6 +5687,9 @@ static void *raid45_takeover_raid0(mddev_t *mddev, int level) | |||
| 5687 | return ERR_PTR(-EINVAL); | 5687 | return ERR_PTR(-EINVAL); |
| 5688 | } | 5688 | } |
| 5689 | 5689 | ||
| 5690 | sectors = raid0_priv->strip_zone[0].zone_end; | ||
| 5691 | sector_div(sectors, raid0_priv->strip_zone[0].nb_dev); | ||
| 5692 | mddev->dev_sectors = sectors; | ||
| 5690 | mddev->new_level = level; | 5693 | mddev->new_level = level; |
| 5691 | mddev->new_layout = ALGORITHM_PARITY_N; | 5694 | mddev->new_layout = ALGORITHM_PARITY_N; |
| 5692 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 5695 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index a3755ffc03d..bc8ce48f077 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
| @@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
| 2550 | const struct parport_pc_via_data *via) | 2550 | const struct parport_pc_via_data *via) |
| 2551 | { | 2551 | { |
| 2552 | short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; | 2552 | short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; |
| 2553 | struct resource *base_res; | ||
| 2554 | u32 ite8872set; | 2553 | u32 ite8872set; |
| 2555 | u32 ite8872_lpt, ite8872_lpthi; | 2554 | u32 ite8872_lpt, ite8872_lpthi; |
| 2556 | u8 ite8872_irq, type; | 2555 | u8 ite8872_irq, type; |
| @@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
| 2561 | 2560 | ||
| 2562 | /* make sure which one chip */ | 2561 | /* make sure which one chip */ |
| 2563 | for (i = 0; i < 5; i++) { | 2562 | for (i = 0; i < 5; i++) { |
| 2564 | base_res = request_region(inta_addr[i], 32, "it887x"); | 2563 | if (request_region(inta_addr[i], 32, "it887x")) { |
| 2565 | if (base_res) { | ||
| 2566 | int test; | 2564 | int test; |
| 2567 | pci_write_config_dword(pdev, 0x60, | 2565 | pci_write_config_dword(pdev, 0x60, |
| 2568 | 0xe5000000 | inta_addr[i]); | 2566 | 0xe5000000 | inta_addr[i]); |
| @@ -2571,7 +2569,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
| 2571 | test = inb(inta_addr[i]); | 2569 | test = inb(inta_addr[i]); |
| 2572 | if (test != 0xff) | 2570 | if (test != 0xff) |
| 2573 | break; | 2571 | break; |
| 2574 | release_region(inta_addr[i], 0x8); | 2572 | release_region(inta_addr[i], 32); |
| 2575 | } | 2573 | } |
| 2576 | } | 2574 | } |
| 2577 | if (i >= 5) { | 2575 | if (i >= 5) { |
| @@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
| 2635 | /* | 2633 | /* |
| 2636 | * Release the resource so that parport_pc_probe_port can get it. | 2634 | * Release the resource so that parport_pc_probe_port can get it. |
| 2637 | */ | 2635 | */ |
| 2638 | release_resource(base_res); | 2636 | release_region(inta_addr[i], 32); |
| 2639 | if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi, | 2637 | if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi, |
| 2640 | irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { | 2638 | irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { |
| 2641 | printk(KERN_INFO | 2639 | printk(KERN_INFO |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 505c1c7075f..d552d2c7784 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
| @@ -1299,7 +1299,7 @@ static void iommu_detach_domain(struct dmar_domain *domain, | |||
| 1299 | static struct iova_domain reserved_iova_list; | 1299 | static struct iova_domain reserved_iova_list; |
| 1300 | static struct lock_class_key reserved_rbtree_key; | 1300 | static struct lock_class_key reserved_rbtree_key; |
| 1301 | 1301 | ||
| 1302 | static void dmar_init_reserved_ranges(void) | 1302 | static int dmar_init_reserved_ranges(void) |
| 1303 | { | 1303 | { |
| 1304 | struct pci_dev *pdev = NULL; | 1304 | struct pci_dev *pdev = NULL; |
| 1305 | struct iova *iova; | 1305 | struct iova *iova; |
| @@ -1313,8 +1313,10 @@ static void dmar_init_reserved_ranges(void) | |||
| 1313 | /* IOAPIC ranges shouldn't be accessed by DMA */ | 1313 | /* IOAPIC ranges shouldn't be accessed by DMA */ |
| 1314 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), | 1314 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), |
| 1315 | IOVA_PFN(IOAPIC_RANGE_END)); | 1315 | IOVA_PFN(IOAPIC_RANGE_END)); |
| 1316 | if (!iova) | 1316 | if (!iova) { |
| 1317 | printk(KERN_ERR "Reserve IOAPIC range failed\n"); | 1317 | printk(KERN_ERR "Reserve IOAPIC range failed\n"); |
| 1318 | return -ENODEV; | ||
| 1319 | } | ||
| 1318 | 1320 | ||
| 1319 | /* Reserve all PCI MMIO to avoid peer-to-peer access */ | 1321 | /* Reserve all PCI MMIO to avoid peer-to-peer access */ |
| 1320 | for_each_pci_dev(pdev) { | 1322 | for_each_pci_dev(pdev) { |
| @@ -1327,11 +1329,13 @@ static void dmar_init_reserved_ranges(void) | |||
| 1327 | iova = reserve_iova(&reserved_iova_list, | 1329 | iova = reserve_iova(&reserved_iova_list, |
| 1328 | IOVA_PFN(r->start), | 1330 | IOVA_PFN(r->start), |
| 1329 | IOVA_PFN(r->end)); | 1331 | IOVA_PFN(r->end)); |
| 1330 | if (!iova) | 1332 | if (!iova) { |
| 1331 | printk(KERN_ERR "Reserve iova failed\n"); | 1333 | printk(KERN_ERR "Reserve iova failed\n"); |
| 1334 | return -ENODEV; | ||
| 1335 | } | ||
| 1332 | } | 1336 | } |
| 1333 | } | 1337 | } |
| 1334 | 1338 | return 0; | |
| 1335 | } | 1339 | } |
| 1336 | 1340 | ||
| 1337 | static void domain_reserve_special_ranges(struct dmar_domain *domain) | 1341 | static void domain_reserve_special_ranges(struct dmar_domain *domain) |
| @@ -1835,7 +1839,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw) | |||
| 1835 | 1839 | ||
| 1836 | ret = iommu_attach_domain(domain, iommu); | 1840 | ret = iommu_attach_domain(domain, iommu); |
| 1837 | if (ret) { | 1841 | if (ret) { |
| 1838 | domain_exit(domain); | 1842 | free_domain_mem(domain); |
| 1839 | goto error; | 1843 | goto error; |
| 1840 | } | 1844 | } |
| 1841 | 1845 | ||
| @@ -2213,7 +2217,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
| 2213 | return 0; | 2217 | return 0; |
| 2214 | } | 2218 | } |
| 2215 | 2219 | ||
| 2216 | int __init init_dmars(void) | 2220 | static int __init init_dmars(int force_on) |
| 2217 | { | 2221 | { |
| 2218 | struct dmar_drhd_unit *drhd; | 2222 | struct dmar_drhd_unit *drhd; |
| 2219 | struct dmar_rmrr_unit *rmrr; | 2223 | struct dmar_rmrr_unit *rmrr; |
| @@ -2393,8 +2397,15 @@ int __init init_dmars(void) | |||
| 2393 | * enable translation | 2397 | * enable translation |
| 2394 | */ | 2398 | */ |
| 2395 | for_each_drhd_unit(drhd) { | 2399 | for_each_drhd_unit(drhd) { |
| 2396 | if (drhd->ignored) | 2400 | if (drhd->ignored) { |
| 2401 | /* | ||
| 2402 | * we always have to disable PMRs or DMA may fail on | ||
| 2403 | * this device | ||
| 2404 | */ | ||
| 2405 | if (force_on) | ||
| 2406 | iommu_disable_protect_mem_regions(drhd->iommu); | ||
| 2397 | continue; | 2407 | continue; |
| 2408 | } | ||
| 2398 | iommu = drhd->iommu; | 2409 | iommu = drhd->iommu; |
| 2399 | 2410 | ||
| 2400 | iommu_flush_write_buffer(iommu); | 2411 | iommu_flush_write_buffer(iommu); |
| @@ -3240,9 +3251,15 @@ static int device_notifier(struct notifier_block *nb, | |||
| 3240 | if (!domain) | 3251 | if (!domain) |
| 3241 | return 0; | 3252 | return 0; |
| 3242 | 3253 | ||
| 3243 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) | 3254 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) { |
| 3244 | domain_remove_one_dev_info(domain, pdev); | 3255 | domain_remove_one_dev_info(domain, pdev); |
| 3245 | 3256 | ||
| 3257 | if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && | ||
| 3258 | !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) && | ||
| 3259 | list_empty(&domain->devices)) | ||
| 3260 | domain_exit(domain); | ||
| 3261 | } | ||
| 3262 | |||
| 3246 | return 0; | 3263 | return 0; |
| 3247 | } | 3264 | } |
| 3248 | 3265 | ||
| @@ -3277,12 +3294,21 @@ int __init intel_iommu_init(void) | |||
| 3277 | if (no_iommu || dmar_disabled) | 3294 | if (no_iommu || dmar_disabled) |
| 3278 | return -ENODEV; | 3295 | return -ENODEV; |
| 3279 | 3296 | ||
| 3280 | iommu_init_mempool(); | 3297 | if (iommu_init_mempool()) { |
| 3281 | dmar_init_reserved_ranges(); | 3298 | if (force_on) |
| 3299 | panic("tboot: Failed to initialize iommu memory\n"); | ||
| 3300 | return -ENODEV; | ||
| 3301 | } | ||
| 3302 | |||
| 3303 | if (dmar_init_reserved_ranges()) { | ||
| 3304 | if (force_on) | ||
| 3305 | panic("tboot: Failed to reserve iommu ranges\n"); | ||
| 3306 | return -ENODEV; | ||
| 3307 | } | ||
| 3282 | 3308 | ||
| 3283 | init_no_remapping_devices(); | 3309 | init_no_remapping_devices(); |
| 3284 | 3310 | ||
| 3285 | ret = init_dmars(); | 3311 | ret = init_dmars(force_on); |
| 3286 | if (ret) { | 3312 | if (ret) { |
| 3287 | if (force_on) | 3313 | if (force_on) |
| 3288 | panic("tboot: Failed to initialize DMARs\n"); | 3314 | panic("tboot: Failed to initialize DMARs\n"); |
| @@ -3391,6 +3417,11 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
| 3391 | domain->iommu_count--; | 3417 | domain->iommu_count--; |
| 3392 | domain_update_iommu_cap(domain); | 3418 | domain_update_iommu_cap(domain); |
| 3393 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); | 3419 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); |
| 3420 | |||
| 3421 | spin_lock_irqsave(&iommu->lock, tmp_flags); | ||
| 3422 | clear_bit(domain->id, iommu->domain_ids); | ||
| 3423 | iommu->domains[domain->id] = NULL; | ||
| 3424 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | ||
| 3394 | } | 3425 | } |
| 3395 | 3426 | ||
| 3396 | spin_unlock_irqrestore(&device_domain_lock, flags); | 3427 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| @@ -3607,9 +3638,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, | |||
| 3607 | 3638 | ||
| 3608 | pte = dmar_domain->pgd; | 3639 | pte = dmar_domain->pgd; |
| 3609 | if (dma_pte_present(pte)) { | 3640 | if (dma_pte_present(pte)) { |
| 3610 | free_pgtable_page(dmar_domain->pgd); | ||
| 3611 | dmar_domain->pgd = (struct dma_pte *) | 3641 | dmar_domain->pgd = (struct dma_pte *) |
| 3612 | phys_to_virt(dma_pte_addr(pte)); | 3642 | phys_to_virt(dma_pte_addr(pte)); |
| 3643 | free_pgtable_page(pte); | ||
| 3613 | } | 3644 | } |
| 3614 | dmar_domain->agaw--; | 3645 | dmar_domain->agaw--; |
| 3615 | } | 3646 | } |
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index 316f484999b..80f9c88214c 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c | |||
| @@ -220,6 +220,7 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
| 220 | } | 220 | } |
| 221 | clk_disable(rtap->clk); | 221 | clk_disable(rtap->clk); |
| 222 | 222 | ||
| 223 | platform_set_drvdata(pdev, rtap); | ||
| 223 | rtap->rtc = rtc_device_register("coh901331", &pdev->dev, &coh901331_ops, | 224 | rtap->rtc = rtc_device_register("coh901331", &pdev->dev, &coh901331_ops, |
| 224 | THIS_MODULE); | 225 | THIS_MODULE); |
| 225 | if (IS_ERR(rtap->rtc)) { | 226 | if (IS_ERR(rtap->rtc)) { |
| @@ -227,11 +228,10 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
| 227 | goto out_no_rtc; | 228 | goto out_no_rtc; |
| 228 | } | 229 | } |
| 229 | 230 | ||
| 230 | platform_set_drvdata(pdev, rtap); | ||
| 231 | |||
| 232 | return 0; | 231 | return 0; |
| 233 | 232 | ||
| 234 | out_no_rtc: | 233 | out_no_rtc: |
| 234 | platform_set_drvdata(pdev, NULL); | ||
| 235 | out_no_clk_enable: | 235 | out_no_clk_enable: |
| 236 | clk_put(rtap->clk); | 236 | clk_put(rtap->clk); |
| 237 | out_no_clk: | 237 | out_no_clk: |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ab55c2fa7ce..e9901b8f844 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -411,8 +411,6 @@ static void scsi_run_queue(struct request_queue *q) | |||
| 411 | list_splice_init(&shost->starved_list, &starved_list); | 411 | list_splice_init(&shost->starved_list, &starved_list); |
| 412 | 412 | ||
| 413 | while (!list_empty(&starved_list)) { | 413 | while (!list_empty(&starved_list)) { |
| 414 | int flagset; | ||
| 415 | |||
| 416 | /* | 414 | /* |
| 417 | * As long as shost is accepting commands and we have | 415 | * As long as shost is accepting commands and we have |
| 418 | * starved queues, call blk_run_queue. scsi_request_fn | 416 | * starved queues, call blk_run_queue. scsi_request_fn |
| @@ -435,20 +433,7 @@ static void scsi_run_queue(struct request_queue *q) | |||
| 435 | continue; | 433 | continue; |
| 436 | } | 434 | } |
| 437 | 435 | ||
| 438 | spin_unlock(shost->host_lock); | 436 | blk_run_queue_async(sdev->request_queue); |
| 439 | |||
| 440 | spin_lock(sdev->request_queue->queue_lock); | ||
| 441 | flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) && | ||
| 442 | !test_bit(QUEUE_FLAG_REENTER, | ||
| 443 | &sdev->request_queue->queue_flags); | ||
| 444 | if (flagset) | ||
| 445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
| 446 | __blk_run_queue(sdev->request_queue); | ||
| 447 | if (flagset) | ||
| 448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
| 449 | spin_unlock(sdev->request_queue->queue_lock); | ||
| 450 | |||
| 451 | spin_lock(shost->host_lock); | ||
| 452 | } | 437 | } |
| 453 | /* put any unprocessed entries back */ | 438 | /* put any unprocessed entries back */ |
| 454 | list_splice(&starved_list, &shost->starved_list); | 439 | list_splice(&starved_list, &shost->starved_list); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 28c33506e4a..815069d13f9 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
| @@ -3816,28 +3816,17 @@ fail_host_msg: | |||
| 3816 | static void | 3816 | static void |
| 3817 | fc_bsg_goose_queue(struct fc_rport *rport) | 3817 | fc_bsg_goose_queue(struct fc_rport *rport) |
| 3818 | { | 3818 | { |
| 3819 | int flagset; | ||
| 3820 | unsigned long flags; | ||
| 3821 | |||
| 3822 | if (!rport->rqst_q) | 3819 | if (!rport->rqst_q) |
| 3823 | return; | 3820 | return; |
| 3824 | 3821 | ||
| 3822 | /* | ||
| 3823 | * This get/put dance makes no sense | ||
| 3824 | */ | ||
| 3825 | get_device(&rport->dev); | 3825 | get_device(&rport->dev); |
| 3826 | 3826 | blk_run_queue_async(rport->rqst_q); | |
| 3827 | spin_lock_irqsave(rport->rqst_q->queue_lock, flags); | ||
| 3828 | flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) && | ||
| 3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); | ||
| 3830 | if (flagset) | ||
| 3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); | ||
| 3832 | __blk_run_queue(rport->rqst_q); | ||
| 3833 | if (flagset) | ||
| 3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); | ||
| 3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); | ||
| 3836 | |||
| 3837 | put_device(&rport->dev); | 3827 | put_device(&rport->dev); |
| 3838 | } | 3828 | } |
| 3839 | 3829 | ||
| 3840 | |||
| 3841 | /** | 3830 | /** |
| 3842 | * fc_bsg_rport_dispatch - process rport bsg requests and dispatch to LLDD | 3831 | * fc_bsg_rport_dispatch - process rport bsg requests and dispatch to LLDD |
| 3843 | * @q: rport request queue | 3832 | * @q: rport request queue |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 47f8cdb207f..74273e638c0 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
| @@ -1658,8 +1658,12 @@ static void gsm_queue(struct gsm_mux *gsm) | |||
| 1658 | 1658 | ||
| 1659 | if ((gsm->control & ~PF) == UI) | 1659 | if ((gsm->control & ~PF) == UI) |
| 1660 | gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len); | 1660 | gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len); |
| 1661 | /* generate final CRC with received FCS */ | 1661 | if (gsm->encoding == 0){ |
| 1662 | gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs); | 1662 | /* WARNING: gsm->received_fcs is used for gsm->encoding = 0 only. |
| 1663 | In this case it contain the last piece of data | ||
| 1664 | required to generate final CRC */ | ||
| 1665 | gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs); | ||
| 1666 | } | ||
| 1663 | if (gsm->fcs != GOOD_FCS) { | 1667 | if (gsm->fcs != GOOD_FCS) { |
| 1664 | gsm->bad_fcs++; | 1668 | gsm->bad_fcs++; |
| 1665 | if (debug & 4) | 1669 | if (debug & 4) |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index cb36b0d4ef3..62df72d9f0a 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
| @@ -382,12 +382,13 @@ static void imx_start_tx(struct uart_port *port) | |||
| 382 | static irqreturn_t imx_rtsint(int irq, void *dev_id) | 382 | static irqreturn_t imx_rtsint(int irq, void *dev_id) |
| 383 | { | 383 | { |
| 384 | struct imx_port *sport = dev_id; | 384 | struct imx_port *sport = dev_id; |
| 385 | unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS; | 385 | unsigned int val; |
| 386 | unsigned long flags; | 386 | unsigned long flags; |
| 387 | 387 | ||
| 388 | spin_lock_irqsave(&sport->port.lock, flags); | 388 | spin_lock_irqsave(&sport->port.lock, flags); |
| 389 | 389 | ||
| 390 | writel(USR1_RTSD, sport->port.membase + USR1); | 390 | writel(USR1_RTSD, sport->port.membase + USR1); |
| 391 | val = readl(sport->port.membase + USR1) & USR1_RTSS; | ||
| 391 | uart_handle_cts_change(&sport->port, !!val); | 392 | uart_handle_cts_change(&sport->port, !!val); |
| 392 | wake_up_interruptible(&sport->port.state->port.delta_msr_wait); | 393 | wake_up_interruptible(&sport->port.state->port.delta_msr_wait); |
| 393 | 394 | ||
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 4fb5b2bf234..4bcc8b82640 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
| @@ -590,15 +590,10 @@ static struct virtio_config_ops virtio_pci_config_ops = { | |||
| 590 | 590 | ||
| 591 | static void virtio_pci_release_dev(struct device *_d) | 591 | static void virtio_pci_release_dev(struct device *_d) |
| 592 | { | 592 | { |
| 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, dev); | 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, |
| 594 | dev); | ||
| 594 | struct virtio_pci_device *vp_dev = to_vp_device(dev); | 595 | struct virtio_pci_device *vp_dev = to_vp_device(dev); |
| 595 | struct pci_dev *pci_dev = vp_dev->pci_dev; | ||
| 596 | 596 | ||
| 597 | vp_del_vqs(dev); | ||
| 598 | pci_set_drvdata(pci_dev, NULL); | ||
| 599 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
| 600 | pci_release_regions(pci_dev); | ||
| 601 | pci_disable_device(pci_dev); | ||
| 602 | kfree(vp_dev); | 597 | kfree(vp_dev); |
| 603 | } | 598 | } |
| 604 | 599 | ||
| @@ -681,6 +676,12 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | |||
| 681 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); | 676 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); |
| 682 | 677 | ||
| 683 | unregister_virtio_device(&vp_dev->vdev); | 678 | unregister_virtio_device(&vp_dev->vdev); |
| 679 | |||
| 680 | vp_del_vqs(&vp_dev->vdev); | ||
| 681 | pci_set_drvdata(pci_dev, NULL); | ||
| 682 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
| 683 | pci_release_regions(pci_dev); | ||
| 684 | pci_disable_device(pci_dev); | ||
| 684 | } | 685 | } |
| 685 | 686 | ||
| 686 | #ifdef CONFIG_PM | 687 | #ifdef CONFIG_PM |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cc2f73e0347..b0043fb26a4 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq) | |||
| 371 | /* detach_buf clears data, so grab it now. */ | 371 | /* detach_buf clears data, so grab it now. */ |
| 372 | buf = vq->data[i]; | 372 | buf = vq->data[i]; |
| 373 | detach_buf(vq, i); | 373 | detach_buf(vq, i); |
| 374 | vq->vring.avail->idx--; | ||
| 374 | END_USE(vq); | 375 | END_USE(vq); |
| 375 | return buf; | 376 | return buf; |
| 376 | } | 377 | } |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 1ac94125bf9..a2eee574784 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/sysrq.h> | 8 | #include <linux/sysrq.h> |
| 9 | #include <linux/stop_machine.h> | 9 | #include <linux/stop_machine.h> |
| 10 | #include <linux/freezer.h> | 10 | #include <linux/freezer.h> |
| 11 | #include <linux/syscore_ops.h> | ||
| 11 | 12 | ||
| 12 | #include <xen/xen.h> | 13 | #include <xen/xen.h> |
| 13 | #include <xen/xenbus.h> | 14 | #include <xen/xenbus.h> |
| @@ -70,8 +71,13 @@ static int xen_suspend(void *data) | |||
| 70 | BUG_ON(!irqs_disabled()); | 71 | BUG_ON(!irqs_disabled()); |
| 71 | 72 | ||
| 72 | err = sysdev_suspend(PMSG_FREEZE); | 73 | err = sysdev_suspend(PMSG_FREEZE); |
| 74 | if (!err) { | ||
| 75 | err = syscore_suspend(); | ||
| 76 | if (err) | ||
| 77 | sysdev_resume(); | ||
| 78 | } | ||
| 73 | if (err) { | 79 | if (err) { |
| 74 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", | 80 | printk(KERN_ERR "xen_suspend: system core suspend failed: %d\n", |
| 75 | err); | 81 | err); |
| 76 | return err; | 82 | return err; |
| 77 | } | 83 | } |
| @@ -95,6 +101,7 @@ static int xen_suspend(void *data) | |||
| 95 | xen_timer_resume(); | 101 | xen_timer_resume(); |
| 96 | } | 102 | } |
| 97 | 103 | ||
| 104 | syscore_resume(); | ||
| 98 | sysdev_resume(); | 105 | sysdev_resume(); |
| 99 | 106 | ||
| 100 | return 0; | 107 | return 0; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 68c84c8c24b..228cf36ece8 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -2824,6 +2824,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, | |||
| 2824 | 2824 | ||
| 2825 | spin_lock(&delayed_refs->lock); | 2825 | spin_lock(&delayed_refs->lock); |
| 2826 | if (delayed_refs->num_entries == 0) { | 2826 | if (delayed_refs->num_entries == 0) { |
| 2827 | spin_unlock(&delayed_refs->lock); | ||
| 2827 | printk(KERN_INFO "delayed_refs has NO entry\n"); | 2828 | printk(KERN_INFO "delayed_refs has NO entry\n"); |
| 2828 | return ret; | 2829 | return ret; |
| 2829 | } | 2830 | } |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 31f33ba56fe..cd52f7f556e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -8059,6 +8059,10 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root, | |||
| 8059 | u64 group_start = group->key.objectid; | 8059 | u64 group_start = group->key.objectid; |
| 8060 | new_extents = kmalloc(sizeof(*new_extents), | 8060 | new_extents = kmalloc(sizeof(*new_extents), |
| 8061 | GFP_NOFS); | 8061 | GFP_NOFS); |
| 8062 | if (!new_extents) { | ||
| 8063 | ret = -ENOMEM; | ||
| 8064 | goto out; | ||
| 8065 | } | ||
| 8062 | nr_extents = 1; | 8066 | nr_extents = 1; |
| 8063 | ret = get_new_locations(reloc_inode, | 8067 | ret = get_new_locations(reloc_inode, |
| 8064 | extent_key, | 8068 | extent_key, |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 31513860508..ba41da59e31 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -2681,7 +2681,7 @@ int extent_readpages(struct extent_io_tree *tree, | |||
| 2681 | prefetchw(&page->flags); | 2681 | prefetchw(&page->flags); |
| 2682 | list_del(&page->lru); | 2682 | list_del(&page->lru); |
| 2683 | if (!add_to_page_cache_lru(page, mapping, | 2683 | if (!add_to_page_cache_lru(page, mapping, |
| 2684 | page->index, GFP_KERNEL)) { | 2684 | page->index, GFP_NOFS)) { |
| 2685 | __extent_read_full_page(tree, page, get_extent, | 2685 | __extent_read_full_page(tree, page, get_extent, |
| 2686 | &bio, 0, &bio_flags); | 2686 | &bio, 0, &bio_flags); |
| 2687 | } | 2687 | } |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 11d2e9cea09..63731a1fb0a 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
| @@ -1768,10 +1768,13 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group) | |||
| 1768 | 1768 | ||
| 1769 | while ((node = rb_last(&block_group->free_space_offset)) != NULL) { | 1769 | while ((node = rb_last(&block_group->free_space_offset)) != NULL) { |
| 1770 | info = rb_entry(node, struct btrfs_free_space, offset_index); | 1770 | info = rb_entry(node, struct btrfs_free_space, offset_index); |
| 1771 | unlink_free_space(block_group, info); | 1771 | if (!info->bitmap) { |
| 1772 | if (info->bitmap) | 1772 | unlink_free_space(block_group, info); |
| 1773 | kfree(info->bitmap); | 1773 | kmem_cache_free(btrfs_free_space_cachep, info); |
| 1774 | kmem_cache_free(btrfs_free_space_cachep, info); | 1774 | } else { |
| 1775 | free_bitmap(block_group, info); | ||
| 1776 | } | ||
| 1777 | |||
| 1775 | if (need_resched()) { | 1778 | if (need_resched()) { |
| 1776 | spin_unlock(&block_group->tree_lock); | 1779 | spin_unlock(&block_group->tree_lock); |
| 1777 | cond_resched(); | 1780 | cond_resched(); |
| @@ -2301,7 +2304,7 @@ int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group, | |||
| 2301 | start = entry->offset; | 2304 | start = entry->offset; |
| 2302 | bytes = min(entry->bytes, end - start); | 2305 | bytes = min(entry->bytes, end - start); |
| 2303 | unlink_free_space(block_group, entry); | 2306 | unlink_free_space(block_group, entry); |
| 2304 | kfree(entry); | 2307 | kmem_cache_free(btrfs_free_space_cachep, entry); |
| 2305 | } | 2308 | } |
| 2306 | 2309 | ||
| 2307 | spin_unlock(&block_group->tree_lock); | 2310 | spin_unlock(&block_group->tree_lock); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fcd66b6a808..7cd8ab0ef04 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -954,6 +954,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
| 954 | 1, 0, NULL, GFP_NOFS); | 954 | 1, 0, NULL, GFP_NOFS); |
| 955 | while (start < end) { | 955 | while (start < end) { |
| 956 | async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); | 956 | async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); |
| 957 | BUG_ON(!async_cow); | ||
| 957 | async_cow->inode = inode; | 958 | async_cow->inode = inode; |
| 958 | async_cow->root = root; | 959 | async_cow->root = root; |
| 959 | async_cow->locked_page = locked_page; | 960 | async_cow->locked_page = locked_page; |
| @@ -4731,9 +4732,10 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
| 4731 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, | 4732 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, |
| 4732 | dentry->d_name.len, dir->i_ino, objectid, | 4733 | dentry->d_name.len, dir->i_ino, objectid, |
| 4733 | BTRFS_I(dir)->block_group, mode, &index); | 4734 | BTRFS_I(dir)->block_group, mode, &index); |
| 4734 | err = PTR_ERR(inode); | 4735 | if (IS_ERR(inode)) { |
| 4735 | if (IS_ERR(inode)) | 4736 | err = PTR_ERR(inode); |
| 4736 | goto out_unlock; | 4737 | goto out_unlock; |
| 4738 | } | ||
| 4737 | 4739 | ||
| 4738 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 4740 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
| 4739 | if (err) { | 4741 | if (err) { |
| @@ -4792,9 +4794,10 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
| 4792 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, | 4794 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, |
| 4793 | dentry->d_name.len, dir->i_ino, objectid, | 4795 | dentry->d_name.len, dir->i_ino, objectid, |
| 4794 | BTRFS_I(dir)->block_group, mode, &index); | 4796 | BTRFS_I(dir)->block_group, mode, &index); |
| 4795 | err = PTR_ERR(inode); | 4797 | if (IS_ERR(inode)) { |
| 4796 | if (IS_ERR(inode)) | 4798 | err = PTR_ERR(inode); |
| 4797 | goto out_unlock; | 4799 | goto out_unlock; |
| 4800 | } | ||
| 4798 | 4801 | ||
| 4799 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 4802 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
| 4800 | if (err) { | 4803 | if (err) { |
| @@ -4999,6 +5002,8 @@ static noinline int uncompress_inline(struct btrfs_path *path, | |||
| 4999 | inline_size = btrfs_file_extent_inline_item_len(leaf, | 5002 | inline_size = btrfs_file_extent_inline_item_len(leaf, |
| 5000 | btrfs_item_nr(leaf, path->slots[0])); | 5003 | btrfs_item_nr(leaf, path->slots[0])); |
| 5001 | tmp = kmalloc(inline_size, GFP_NOFS); | 5004 | tmp = kmalloc(inline_size, GFP_NOFS); |
| 5005 | if (!tmp) | ||
| 5006 | return -ENOMEM; | ||
| 5002 | ptr = btrfs_file_extent_inline_start(item); | 5007 | ptr = btrfs_file_extent_inline_start(item); |
| 5003 | 5008 | ||
| 5004 | read_extent_buffer(leaf, tmp, ptr, inline_size); | 5009 | read_extent_buffer(leaf, tmp, ptr, inline_size); |
| @@ -6036,7 +6041,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
| 6036 | ret = btrfs_map_block(map_tree, READ, start_sector << 9, | 6041 | ret = btrfs_map_block(map_tree, READ, start_sector << 9, |
| 6037 | &map_length, NULL, 0); | 6042 | &map_length, NULL, 0); |
| 6038 | if (ret) { | 6043 | if (ret) { |
| 6039 | bio_put(bio); | 6044 | bio_put(orig_bio); |
| 6040 | return -EIO; | 6045 | return -EIO; |
| 6041 | } | 6046 | } |
| 6042 | 6047 | ||
| @@ -7273,9 +7278,10 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
| 7273 | dentry->d_name.len, dir->i_ino, objectid, | 7278 | dentry->d_name.len, dir->i_ino, objectid, |
| 7274 | BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, | 7279 | BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, |
| 7275 | &index); | 7280 | &index); |
| 7276 | err = PTR_ERR(inode); | 7281 | if (IS_ERR(inode)) { |
| 7277 | if (IS_ERR(inode)) | 7282 | err = PTR_ERR(inode); |
| 7278 | goto out_unlock; | 7283 | goto out_unlock; |
| 7284 | } | ||
| 7279 | 7285 | ||
| 7280 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 7286 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
| 7281 | if (err) { | 7287 | if (err) { |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index c50271ad315..f997ec0c1ba 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -2209,8 +2209,10 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | |||
| 2209 | 2209 | ||
| 2210 | log = root->log_root; | 2210 | log = root->log_root; |
| 2211 | path = btrfs_alloc_path(); | 2211 | path = btrfs_alloc_path(); |
| 2212 | if (!path) | 2212 | if (!path) { |
| 2213 | return -ENOMEM; | 2213 | err = -ENOMEM; |
| 2214 | goto out_unlock; | ||
| 2215 | } | ||
| 2214 | 2216 | ||
| 2215 | di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, | 2217 | di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, |
| 2216 | name, name_len, -1); | 2218 | name, name_len, -1); |
| @@ -2271,6 +2273,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | |||
| 2271 | } | 2273 | } |
| 2272 | fail: | 2274 | fail: |
| 2273 | btrfs_free_path(path); | 2275 | btrfs_free_path(path); |
| 2276 | out_unlock: | ||
| 2274 | mutex_unlock(&BTRFS_I(dir)->log_mutex); | 2277 | mutex_unlock(&BTRFS_I(dir)->log_mutex); |
| 2275 | if (ret == -ENOSPC) { | 2278 | if (ret == -ENOSPC) { |
| 2276 | root->fs_info->last_trans_log_full_commit = trans->transid; | 2279 | root->fs_info->last_trans_log_full_commit = trans->transid; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 309a57b9fc8..c7367ae5a3e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -155,6 +155,15 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) | |||
| 155 | unsigned long limit; | 155 | unsigned long limit; |
| 156 | unsigned long last_waited = 0; | 156 | unsigned long last_waited = 0; |
| 157 | int force_reg = 0; | 157 | int force_reg = 0; |
| 158 | struct blk_plug plug; | ||
| 159 | |||
| 160 | /* | ||
| 161 | * this function runs all the bios we've collected for | ||
| 162 | * a particular device. We don't want to wander off to | ||
| 163 | * another device without first sending all of these down. | ||
| 164 | * So, setup a plug here and finish it off before we return | ||
| 165 | */ | ||
| 166 | blk_start_plug(&plug); | ||
| 158 | 167 | ||
| 159 | bdi = blk_get_backing_dev_info(device->bdev); | 168 | bdi = blk_get_backing_dev_info(device->bdev); |
| 160 | fs_info = device->dev_root->fs_info; | 169 | fs_info = device->dev_root->fs_info; |
| @@ -294,6 +303,7 @@ loop_lock: | |||
| 294 | spin_unlock(&device->io_lock); | 303 | spin_unlock(&device->io_lock); |
| 295 | 304 | ||
| 296 | done: | 305 | done: |
| 306 | blk_finish_plug(&plug); | ||
| 297 | return 0; | 307 | return 0; |
| 298 | } | 308 | } |
| 299 | 309 | ||
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index db9d55b507d..4bc862a80ef 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -807,8 +807,7 @@ static int | |||
| 807 | cifs_parse_mount_options(char *options, const char *devname, | 807 | cifs_parse_mount_options(char *options, const char *devname, |
| 808 | struct smb_vol *vol) | 808 | struct smb_vol *vol) |
| 809 | { | 809 | { |
| 810 | char *value; | 810 | char *value, *data, *end; |
| 811 | char *data; | ||
| 812 | unsigned int temp_len, i, j; | 811 | unsigned int temp_len, i, j; |
| 813 | char separator[2]; | 812 | char separator[2]; |
| 814 | short int override_uid = -1; | 813 | short int override_uid = -1; |
| @@ -851,6 +850,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
| 851 | if (!options) | 850 | if (!options) |
| 852 | return 1; | 851 | return 1; |
| 853 | 852 | ||
| 853 | end = options + strlen(options); | ||
| 854 | if (strncmp(options, "sep=", 4) == 0) { | 854 | if (strncmp(options, "sep=", 4) == 0) { |
| 855 | if (options[4] != 0) { | 855 | if (options[4] != 0) { |
| 856 | separator[0] = options[4]; | 856 | separator[0] = options[4]; |
| @@ -916,6 +916,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
| 916 | the only illegal character in a password is null */ | 916 | the only illegal character in a password is null */ |
| 917 | 917 | ||
| 918 | if ((value[temp_len] == 0) && | 918 | if ((value[temp_len] == 0) && |
| 919 | (value + temp_len < end) && | ||
| 919 | (value[temp_len+1] == separator[0])) { | 920 | (value[temp_len+1] == separator[0])) { |
| 920 | /* reinsert comma */ | 921 | /* reinsert comma */ |
| 921 | value[temp_len] = separator[0]; | 922 | value[temp_len] = separator[0]; |
diff --git a/fs/dcache.c b/fs/dcache.c index 129a3573099..22a0ef41bad 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -99,12 +99,9 @@ static struct kmem_cache *dentry_cache __read_mostly; | |||
| 99 | static unsigned int d_hash_mask __read_mostly; | 99 | static unsigned int d_hash_mask __read_mostly; |
| 100 | static unsigned int d_hash_shift __read_mostly; | 100 | static unsigned int d_hash_shift __read_mostly; |
| 101 | 101 | ||
| 102 | struct dcache_hash_bucket { | 102 | static struct hlist_bl_head *dentry_hashtable __read_mostly; |
| 103 | struct hlist_bl_head head; | ||
| 104 | }; | ||
| 105 | static struct dcache_hash_bucket *dentry_hashtable __read_mostly; | ||
| 106 | 103 | ||
| 107 | static inline struct dcache_hash_bucket *d_hash(struct dentry *parent, | 104 | static inline struct hlist_bl_head *d_hash(struct dentry *parent, |
| 108 | unsigned long hash) | 105 | unsigned long hash) |
| 109 | { | 106 | { |
| 110 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; | 107 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; |
| @@ -112,16 +109,6 @@ static inline struct dcache_hash_bucket *d_hash(struct dentry *parent, | |||
| 112 | return dentry_hashtable + (hash & D_HASHMASK); | 109 | return dentry_hashtable + (hash & D_HASHMASK); |
| 113 | } | 110 | } |
| 114 | 111 | ||
| 115 | static inline void spin_lock_bucket(struct dcache_hash_bucket *b) | ||
| 116 | { | ||
| 117 | bit_spin_lock(0, (unsigned long *)&b->head.first); | ||
| 118 | } | ||
| 119 | |||
| 120 | static inline void spin_unlock_bucket(struct dcache_hash_bucket *b) | ||
| 121 | { | ||
| 122 | __bit_spin_unlock(0, (unsigned long *)&b->head.first); | ||
| 123 | } | ||
| 124 | |||
| 125 | /* Statistics gathering. */ | 112 | /* Statistics gathering. */ |
| 126 | struct dentry_stat_t dentry_stat = { | 113 | struct dentry_stat_t dentry_stat = { |
| 127 | .age_limit = 45, | 114 | .age_limit = 45, |
| @@ -167,8 +154,8 @@ static void d_free(struct dentry *dentry) | |||
| 167 | if (dentry->d_op && dentry->d_op->d_release) | 154 | if (dentry->d_op && dentry->d_op->d_release) |
| 168 | dentry->d_op->d_release(dentry); | 155 | dentry->d_op->d_release(dentry); |
| 169 | 156 | ||
| 170 | /* if dentry was never inserted into hash, immediate free is OK */ | 157 | /* if dentry was never visible to RCU, immediate free is OK */ |
| 171 | if (hlist_bl_unhashed(&dentry->d_hash)) | 158 | if (!(dentry->d_flags & DCACHE_RCUACCESS)) |
| 172 | __d_free(&dentry->d_u.d_rcu); | 159 | __d_free(&dentry->d_u.d_rcu); |
| 173 | else | 160 | else |
| 174 | call_rcu(&dentry->d_u.d_rcu, __d_free); | 161 | call_rcu(&dentry->d_u.d_rcu, __d_free); |
| @@ -330,28 +317,19 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) | |||
| 330 | */ | 317 | */ |
| 331 | void __d_drop(struct dentry *dentry) | 318 | void __d_drop(struct dentry *dentry) |
| 332 | { | 319 | { |
| 333 | if (!(dentry->d_flags & DCACHE_UNHASHED)) { | 320 | if (!d_unhashed(dentry)) { |
| 334 | if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) { | 321 | struct hlist_bl_head *b; |
| 335 | bit_spin_lock(0, | 322 | if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) |
| 336 | (unsigned long *)&dentry->d_sb->s_anon.first); | 323 | b = &dentry->d_sb->s_anon; |
| 337 | dentry->d_flags |= DCACHE_UNHASHED; | 324 | else |
| 338 | hlist_bl_del_init(&dentry->d_hash); | ||
| 339 | __bit_spin_unlock(0, | ||
| 340 | (unsigned long *)&dentry->d_sb->s_anon.first); | ||
| 341 | } else { | ||
| 342 | struct dcache_hash_bucket *b; | ||
| 343 | b = d_hash(dentry->d_parent, dentry->d_name.hash); | 325 | b = d_hash(dentry->d_parent, dentry->d_name.hash); |
| 344 | spin_lock_bucket(b); | 326 | |
| 345 | /* | 327 | hlist_bl_lock(b); |
| 346 | * We may not actually need to put DCACHE_UNHASHED | 328 | __hlist_bl_del(&dentry->d_hash); |
| 347 | * manipulations under the hash lock, but follow | 329 | dentry->d_hash.pprev = NULL; |
| 348 | * the principle of least surprise. | 330 | hlist_bl_unlock(b); |
| 349 | */ | 331 | |
| 350 | dentry->d_flags |= DCACHE_UNHASHED; | 332 | dentry_rcuwalk_barrier(dentry); |
| 351 | hlist_bl_del_rcu(&dentry->d_hash); | ||
| 352 | spin_unlock_bucket(b); | ||
| 353 | dentry_rcuwalk_barrier(dentry); | ||
| 354 | } | ||
| 355 | } | 333 | } |
| 356 | } | 334 | } |
| 357 | EXPORT_SYMBOL(__d_drop); | 335 | EXPORT_SYMBOL(__d_drop); |
| @@ -1304,7 +1282,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) | |||
| 1304 | dname[name->len] = 0; | 1282 | dname[name->len] = 0; |
| 1305 | 1283 | ||
| 1306 | dentry->d_count = 1; | 1284 | dentry->d_count = 1; |
| 1307 | dentry->d_flags = DCACHE_UNHASHED; | 1285 | dentry->d_flags = 0; |
| 1308 | spin_lock_init(&dentry->d_lock); | 1286 | spin_lock_init(&dentry->d_lock); |
| 1309 | seqcount_init(&dentry->d_seq); | 1287 | seqcount_init(&dentry->d_seq); |
| 1310 | dentry->d_inode = NULL; | 1288 | dentry->d_inode = NULL; |
| @@ -1606,10 +1584,9 @@ struct dentry *d_obtain_alias(struct inode *inode) | |||
| 1606 | tmp->d_inode = inode; | 1584 | tmp->d_inode = inode; |
| 1607 | tmp->d_flags |= DCACHE_DISCONNECTED; | 1585 | tmp->d_flags |= DCACHE_DISCONNECTED; |
| 1608 | list_add(&tmp->d_alias, &inode->i_dentry); | 1586 | list_add(&tmp->d_alias, &inode->i_dentry); |
| 1609 | bit_spin_lock(0, (unsigned long *)&tmp->d_sb->s_anon.first); | 1587 | hlist_bl_lock(&tmp->d_sb->s_anon); |
| 1610 | tmp->d_flags &= ~DCACHE_UNHASHED; | ||
| 1611 | hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); | 1588 | hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); |
| 1612 | __bit_spin_unlock(0, (unsigned long *)&tmp->d_sb->s_anon.first); | 1589 | hlist_bl_unlock(&tmp->d_sb->s_anon); |
| 1613 | spin_unlock(&tmp->d_lock); | 1590 | spin_unlock(&tmp->d_lock); |
| 1614 | spin_unlock(&inode->i_lock); | 1591 | spin_unlock(&inode->i_lock); |
| 1615 | security_d_instantiate(tmp, inode); | 1592 | security_d_instantiate(tmp, inode); |
| @@ -1789,7 +1766,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | |||
| 1789 | unsigned int len = name->len; | 1766 | unsigned int len = name->len; |
| 1790 | unsigned int hash = name->hash; | 1767 | unsigned int hash = name->hash; |
| 1791 | const unsigned char *str = name->name; | 1768 | const unsigned char *str = name->name; |
| 1792 | struct dcache_hash_bucket *b = d_hash(parent, hash); | 1769 | struct hlist_bl_head *b = d_hash(parent, hash); |
| 1793 | struct hlist_bl_node *node; | 1770 | struct hlist_bl_node *node; |
| 1794 | struct dentry *dentry; | 1771 | struct dentry *dentry; |
| 1795 | 1772 | ||
| @@ -1813,7 +1790,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | |||
| 1813 | * | 1790 | * |
| 1814 | * See Documentation/filesystems/path-lookup.txt for more details. | 1791 | * See Documentation/filesystems/path-lookup.txt for more details. |
| 1815 | */ | 1792 | */ |
| 1816 | hlist_bl_for_each_entry_rcu(dentry, node, &b->head, d_hash) { | 1793 | hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { |
| 1817 | struct inode *i; | 1794 | struct inode *i; |
| 1818 | const char *tname; | 1795 | const char *tname; |
| 1819 | int tlen; | 1796 | int tlen; |
| @@ -1908,7 +1885,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) | |||
| 1908 | unsigned int len = name->len; | 1885 | unsigned int len = name->len; |
| 1909 | unsigned int hash = name->hash; | 1886 | unsigned int hash = name->hash; |
| 1910 | const unsigned char *str = name->name; | 1887 | const unsigned char *str = name->name; |
| 1911 | struct dcache_hash_bucket *b = d_hash(parent, hash); | 1888 | struct hlist_bl_head *b = d_hash(parent, hash); |
| 1912 | struct hlist_bl_node *node; | 1889 | struct hlist_bl_node *node; |
| 1913 | struct dentry *found = NULL; | 1890 | struct dentry *found = NULL; |
| 1914 | struct dentry *dentry; | 1891 | struct dentry *dentry; |
| @@ -1935,7 +1912,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) | |||
| 1935 | */ | 1912 | */ |
| 1936 | rcu_read_lock(); | 1913 | rcu_read_lock(); |
| 1937 | 1914 | ||
| 1938 | hlist_bl_for_each_entry_rcu(dentry, node, &b->head, d_hash) { | 1915 | hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { |
| 1939 | const char *tname; | 1916 | const char *tname; |
| 1940 | int tlen; | 1917 | int tlen; |
| 1941 | 1918 | ||
| @@ -2086,13 +2063,13 @@ again: | |||
| 2086 | } | 2063 | } |
| 2087 | EXPORT_SYMBOL(d_delete); | 2064 | EXPORT_SYMBOL(d_delete); |
| 2088 | 2065 | ||
| 2089 | static void __d_rehash(struct dentry * entry, struct dcache_hash_bucket *b) | 2066 | static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) |
| 2090 | { | 2067 | { |
| 2091 | BUG_ON(!d_unhashed(entry)); | 2068 | BUG_ON(!d_unhashed(entry)); |
| 2092 | spin_lock_bucket(b); | 2069 | hlist_bl_lock(b); |
| 2093 | entry->d_flags &= ~DCACHE_UNHASHED; | 2070 | entry->d_flags |= DCACHE_RCUACCESS; |
| 2094 | hlist_bl_add_head_rcu(&entry->d_hash, &b->head); | 2071 | hlist_bl_add_head_rcu(&entry->d_hash, b); |
| 2095 | spin_unlock_bucket(b); | 2072 | hlist_bl_unlock(b); |
| 2096 | } | 2073 | } |
| 2097 | 2074 | ||
| 2098 | static void _d_rehash(struct dentry * entry) | 2075 | static void _d_rehash(struct dentry * entry) |
| @@ -3025,7 +3002,7 @@ static void __init dcache_init_early(void) | |||
| 3025 | 3002 | ||
| 3026 | dentry_hashtable = | 3003 | dentry_hashtable = |
| 3027 | alloc_large_system_hash("Dentry cache", | 3004 | alloc_large_system_hash("Dentry cache", |
| 3028 | sizeof(struct dcache_hash_bucket), | 3005 | sizeof(struct hlist_bl_head), |
| 3029 | dhash_entries, | 3006 | dhash_entries, |
| 3030 | 13, | 3007 | 13, |
| 3031 | HASH_EARLY, | 3008 | HASH_EARLY, |
| @@ -3034,7 +3011,7 @@ static void __init dcache_init_early(void) | |||
| 3034 | 0); | 3011 | 0); |
| 3035 | 3012 | ||
| 3036 | for (loop = 0; loop < (1 << d_hash_shift); loop++) | 3013 | for (loop = 0; loop < (1 << d_hash_shift); loop++) |
| 3037 | INIT_HLIST_BL_HEAD(&dentry_hashtable[loop].head); | 3014 | INIT_HLIST_BL_HEAD(dentry_hashtable + loop); |
| 3038 | } | 3015 | } |
| 3039 | 3016 | ||
| 3040 | static void __init dcache_init(void) | 3017 | static void __init dcache_init(void) |
| @@ -3057,7 +3034,7 @@ static void __init dcache_init(void) | |||
| 3057 | 3034 | ||
| 3058 | dentry_hashtable = | 3035 | dentry_hashtable = |
| 3059 | alloc_large_system_hash("Dentry cache", | 3036 | alloc_large_system_hash("Dentry cache", |
| 3060 | sizeof(struct dcache_hash_bucket), | 3037 | sizeof(struct hlist_bl_head), |
| 3061 | dhash_entries, | 3038 | dhash_entries, |
| 3062 | 13, | 3039 | 13, |
| 3063 | 0, | 3040 | 0, |
| @@ -3066,7 +3043,7 @@ static void __init dcache_init(void) | |||
| 3066 | 0); | 3043 | 0); |
| 3067 | 3044 | ||
| 3068 | for (loop = 0; loop < (1 << d_hash_shift); loop++) | 3045 | for (loop = 0; loop < (1 << d_hash_shift); loop++) |
| 3069 | INIT_HLIST_BL_HEAD(&dentry_hashtable[loop].head); | 3046 | INIT_HLIST_BL_HEAD(dentry_hashtable + loop); |
| 3070 | } | 3047 | } |
| 3071 | 3048 | ||
| 3072 | /* SLAB cache for __getname() consumers */ | 3049 | /* SLAB cache for __getname() consumers */ |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index d2a70a4561f..b8d5c809102 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
| @@ -1452,6 +1452,25 @@ static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) | |||
| 1452 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | 1452 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
| 1453 | } | 1453 | } |
| 1454 | 1454 | ||
| 1455 | void ecryptfs_i_size_init(const char *page_virt, struct inode *inode) | ||
| 1456 | { | ||
| 1457 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
| 1458 | struct ecryptfs_crypt_stat *crypt_stat; | ||
| 1459 | u64 file_size; | ||
| 1460 | |||
| 1461 | crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; | ||
| 1462 | mount_crypt_stat = | ||
| 1463 | &ecryptfs_superblock_to_private(inode->i_sb)->mount_crypt_stat; | ||
| 1464 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | ||
| 1465 | file_size = i_size_read(ecryptfs_inode_to_lower(inode)); | ||
| 1466 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
| 1467 | file_size += crypt_stat->metadata_size; | ||
| 1468 | } else | ||
| 1469 | file_size = get_unaligned_be64(page_virt); | ||
| 1470 | i_size_write(inode, (loff_t)file_size); | ||
| 1471 | crypt_stat->flags |= ECRYPTFS_I_SIZE_INITIALIZED; | ||
| 1472 | } | ||
| 1473 | |||
| 1455 | /** | 1474 | /** |
| 1456 | * ecryptfs_read_headers_virt | 1475 | * ecryptfs_read_headers_virt |
| 1457 | * @page_virt: The virtual address into which to read the headers | 1476 | * @page_virt: The virtual address into which to read the headers |
| @@ -1482,6 +1501,8 @@ static int ecryptfs_read_headers_virt(char *page_virt, | |||
| 1482 | rc = -EINVAL; | 1501 | rc = -EINVAL; |
| 1483 | goto out; | 1502 | goto out; |
| 1484 | } | 1503 | } |
| 1504 | if (!(crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED)) | ||
| 1505 | ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); | ||
| 1485 | offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; | 1506 | offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; |
| 1486 | rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), | 1507 | rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), |
| 1487 | &bytes_read); | 1508 | &bytes_read); |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index bd3cafd0949..e70282775e2 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
| @@ -269,6 +269,7 @@ struct ecryptfs_crypt_stat { | |||
| 269 | #define ECRYPTFS_ENCFN_USE_MOUNT_FNEK 0x00000800 | 269 | #define ECRYPTFS_ENCFN_USE_MOUNT_FNEK 0x00000800 |
| 270 | #define ECRYPTFS_ENCFN_USE_FEK 0x00001000 | 270 | #define ECRYPTFS_ENCFN_USE_FEK 0x00001000 |
| 271 | #define ECRYPTFS_UNLINK_SIGS 0x00002000 | 271 | #define ECRYPTFS_UNLINK_SIGS 0x00002000 |
| 272 | #define ECRYPTFS_I_SIZE_INITIALIZED 0x00004000 | ||
| 272 | u32 flags; | 273 | u32 flags; |
| 273 | unsigned int file_version; | 274 | unsigned int file_version; |
| 274 | size_t iv_bytes; | 275 | size_t iv_bytes; |
| @@ -295,6 +296,8 @@ struct ecryptfs_crypt_stat { | |||
| 295 | struct ecryptfs_inode_info { | 296 | struct ecryptfs_inode_info { |
| 296 | struct inode vfs_inode; | 297 | struct inode vfs_inode; |
| 297 | struct inode *wii_inode; | 298 | struct inode *wii_inode; |
| 299 | struct mutex lower_file_mutex; | ||
| 300 | atomic_t lower_file_count; | ||
| 298 | struct file *lower_file; | 301 | struct file *lower_file; |
| 299 | struct ecryptfs_crypt_stat crypt_stat; | 302 | struct ecryptfs_crypt_stat crypt_stat; |
| 300 | }; | 303 | }; |
| @@ -626,6 +629,7 @@ struct ecryptfs_open_req { | |||
| 626 | int ecryptfs_interpose(struct dentry *hidden_dentry, | 629 | int ecryptfs_interpose(struct dentry *hidden_dentry, |
| 627 | struct dentry *this_dentry, struct super_block *sb, | 630 | struct dentry *this_dentry, struct super_block *sb, |
| 628 | u32 flags); | 631 | u32 flags); |
| 632 | void ecryptfs_i_size_init(const char *page_virt, struct inode *inode); | ||
| 629 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | 633 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, |
| 630 | struct dentry *lower_dentry, | 634 | struct dentry *lower_dentry, |
| 631 | struct inode *ecryptfs_dir_inode); | 635 | struct inode *ecryptfs_dir_inode); |
| @@ -757,7 +761,8 @@ int ecryptfs_privileged_open(struct file **lower_file, | |||
| 757 | struct dentry *lower_dentry, | 761 | struct dentry *lower_dentry, |
| 758 | struct vfsmount *lower_mnt, | 762 | struct vfsmount *lower_mnt, |
| 759 | const struct cred *cred); | 763 | const struct cred *cred); |
| 760 | int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry); | 764 | int ecryptfs_get_lower_file(struct dentry *ecryptfs_dentry); |
| 765 | void ecryptfs_put_lower_file(struct inode *inode); | ||
| 761 | int | 766 | int |
| 762 | ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, | 767 | ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, |
| 763 | size_t *packet_size, | 768 | size_t *packet_size, |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index cedc913d11b..566e5472f78 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
| @@ -191,10 +191,10 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 191 | | ECRYPTFS_ENCRYPTED); | 191 | | ECRYPTFS_ENCRYPTED); |
| 192 | } | 192 | } |
| 193 | mutex_unlock(&crypt_stat->cs_mutex); | 193 | mutex_unlock(&crypt_stat->cs_mutex); |
| 194 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 194 | rc = ecryptfs_get_lower_file(ecryptfs_dentry); |
| 195 | if (rc) { | 195 | if (rc) { |
| 196 | printk(KERN_ERR "%s: Error attempting to initialize " | 196 | printk(KERN_ERR "%s: Error attempting to initialize " |
| 197 | "the persistent file for the dentry with name " | 197 | "the lower file for the dentry with name " |
| 198 | "[%s]; rc = [%d]\n", __func__, | 198 | "[%s]; rc = [%d]\n", __func__, |
| 199 | ecryptfs_dentry->d_name.name, rc); | 199 | ecryptfs_dentry->d_name.name, rc); |
| 200 | goto out_free; | 200 | goto out_free; |
| @@ -202,9 +202,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 202 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) | 202 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) |
| 203 | == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) { | 203 | == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) { |
| 204 | rc = -EPERM; | 204 | rc = -EPERM; |
| 205 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " | 205 | printk(KERN_WARNING "%s: Lower file is RO; eCryptfs " |
| 206 | "file must hence be opened RO\n", __func__); | 206 | "file must hence be opened RO\n", __func__); |
| 207 | goto out_free; | 207 | goto out_put; |
| 208 | } | 208 | } |
| 209 | ecryptfs_set_file_lower( | 209 | ecryptfs_set_file_lower( |
| 210 | file, ecryptfs_inode_to_private(inode)->lower_file); | 210 | file, ecryptfs_inode_to_private(inode)->lower_file); |
| @@ -232,10 +232,11 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 232 | "Plaintext passthrough mode is not " | 232 | "Plaintext passthrough mode is not " |
| 233 | "enabled; returning -EIO\n"); | 233 | "enabled; returning -EIO\n"); |
| 234 | mutex_unlock(&crypt_stat->cs_mutex); | 234 | mutex_unlock(&crypt_stat->cs_mutex); |
| 235 | goto out_free; | 235 | goto out_put; |
| 236 | } | 236 | } |
| 237 | rc = 0; | 237 | rc = 0; |
| 238 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | 238 | crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
| 239 | | ECRYPTFS_ENCRYPTED); | ||
| 239 | mutex_unlock(&crypt_stat->cs_mutex); | 240 | mutex_unlock(&crypt_stat->cs_mutex); |
| 240 | goto out; | 241 | goto out; |
| 241 | } | 242 | } |
| @@ -245,6 +246,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
| 245 | "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, | 246 | "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, |
| 246 | (unsigned long long)i_size_read(inode)); | 247 | (unsigned long long)i_size_read(inode)); |
| 247 | goto out; | 248 | goto out; |
| 249 | out_put: | ||
| 250 | ecryptfs_put_lower_file(inode); | ||
| 248 | out_free: | 251 | out_free: |
| 249 | kmem_cache_free(ecryptfs_file_info_cache, | 252 | kmem_cache_free(ecryptfs_file_info_cache, |
| 250 | ecryptfs_file_to_private(file)); | 253 | ecryptfs_file_to_private(file)); |
| @@ -254,17 +257,13 @@ out: | |||
| 254 | 257 | ||
| 255 | static int ecryptfs_flush(struct file *file, fl_owner_t td) | 258 | static int ecryptfs_flush(struct file *file, fl_owner_t td) |
| 256 | { | 259 | { |
| 257 | int rc = 0; | 260 | return file->f_mode & FMODE_WRITE |
| 258 | struct file *lower_file = NULL; | 261 | ? filemap_write_and_wait(file->f_mapping) : 0; |
| 259 | |||
| 260 | lower_file = ecryptfs_file_to_lower(file); | ||
| 261 | if (lower_file->f_op && lower_file->f_op->flush) | ||
| 262 | rc = lower_file->f_op->flush(lower_file, td); | ||
| 263 | return rc; | ||
| 264 | } | 262 | } |
| 265 | 263 | ||
| 266 | static int ecryptfs_release(struct inode *inode, struct file *file) | 264 | static int ecryptfs_release(struct inode *inode, struct file *file) |
| 267 | { | 265 | { |
| 266 | ecryptfs_put_lower_file(inode); | ||
| 268 | kmem_cache_free(ecryptfs_file_info_cache, | 267 | kmem_cache_free(ecryptfs_file_info_cache, |
| 269 | ecryptfs_file_to_private(file)); | 268 | ecryptfs_file_to_private(file)); |
| 270 | return 0; | 269 | return 0; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index f99051b7ada..4d4cc6a90cd 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -168,19 +168,18 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry) | |||
| 168 | "context; rc = [%d]\n", rc); | 168 | "context; rc = [%d]\n", rc); |
| 169 | goto out; | 169 | goto out; |
| 170 | } | 170 | } |
| 171 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 171 | rc = ecryptfs_get_lower_file(ecryptfs_dentry); |
| 172 | if (rc) { | 172 | if (rc) { |
| 173 | printk(KERN_ERR "%s: Error attempting to initialize " | 173 | printk(KERN_ERR "%s: Error attempting to initialize " |
| 174 | "the persistent file for the dentry with name " | 174 | "the lower file for the dentry with name " |
| 175 | "[%s]; rc = [%d]\n", __func__, | 175 | "[%s]; rc = [%d]\n", __func__, |
| 176 | ecryptfs_dentry->d_name.name, rc); | 176 | ecryptfs_dentry->d_name.name, rc); |
| 177 | goto out; | 177 | goto out; |
| 178 | } | 178 | } |
| 179 | rc = ecryptfs_write_metadata(ecryptfs_dentry); | 179 | rc = ecryptfs_write_metadata(ecryptfs_dentry); |
| 180 | if (rc) { | 180 | if (rc) |
| 181 | printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc); | 181 | printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc); |
| 182 | goto out; | 182 | ecryptfs_put_lower_file(ecryptfs_dentry->d_inode); |
| 183 | } | ||
| 184 | out: | 183 | out: |
| 185 | return rc; | 184 | return rc; |
| 186 | } | 185 | } |
| @@ -226,11 +225,9 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
| 226 | struct dentry *lower_dir_dentry; | 225 | struct dentry *lower_dir_dentry; |
| 227 | struct vfsmount *lower_mnt; | 226 | struct vfsmount *lower_mnt; |
| 228 | struct inode *lower_inode; | 227 | struct inode *lower_inode; |
| 229 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
| 230 | struct ecryptfs_crypt_stat *crypt_stat; | 228 | struct ecryptfs_crypt_stat *crypt_stat; |
| 231 | char *page_virt = NULL; | 229 | char *page_virt = NULL; |
| 232 | u64 file_size; | 230 | int put_lower = 0, rc = 0; |
| 233 | int rc = 0; | ||
| 234 | 231 | ||
| 235 | lower_dir_dentry = lower_dentry->d_parent; | 232 | lower_dir_dentry = lower_dentry->d_parent; |
| 236 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( | 233 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( |
| @@ -277,14 +274,15 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
| 277 | rc = -ENOMEM; | 274 | rc = -ENOMEM; |
| 278 | goto out; | 275 | goto out; |
| 279 | } | 276 | } |
| 280 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 277 | rc = ecryptfs_get_lower_file(ecryptfs_dentry); |
| 281 | if (rc) { | 278 | if (rc) { |
| 282 | printk(KERN_ERR "%s: Error attempting to initialize " | 279 | printk(KERN_ERR "%s: Error attempting to initialize " |
| 283 | "the persistent file for the dentry with name " | 280 | "the lower file for the dentry with name " |
| 284 | "[%s]; rc = [%d]\n", __func__, | 281 | "[%s]; rc = [%d]\n", __func__, |
| 285 | ecryptfs_dentry->d_name.name, rc); | 282 | ecryptfs_dentry->d_name.name, rc); |
| 286 | goto out_free_kmem; | 283 | goto out_free_kmem; |
| 287 | } | 284 | } |
| 285 | put_lower = 1; | ||
| 288 | crypt_stat = &ecryptfs_inode_to_private( | 286 | crypt_stat = &ecryptfs_inode_to_private( |
| 289 | ecryptfs_dentry->d_inode)->crypt_stat; | 287 | ecryptfs_dentry->d_inode)->crypt_stat; |
| 290 | /* TODO: lock for crypt_stat comparison */ | 288 | /* TODO: lock for crypt_stat comparison */ |
| @@ -302,18 +300,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
| 302 | } | 300 | } |
| 303 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; | 301 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; |
| 304 | } | 302 | } |
| 305 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 303 | ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); |
| 306 | ecryptfs_dentry->d_sb)->mount_crypt_stat; | ||
| 307 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | ||
| 308 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
| 309 | file_size = (crypt_stat->metadata_size | ||
| 310 | + i_size_read(lower_dentry->d_inode)); | ||
| 311 | else | ||
| 312 | file_size = i_size_read(lower_dentry->d_inode); | ||
| 313 | } else { | ||
| 314 | file_size = get_unaligned_be64(page_virt); | ||
| 315 | } | ||
| 316 | i_size_write(ecryptfs_dentry->d_inode, (loff_t)file_size); | ||
| 317 | out_free_kmem: | 304 | out_free_kmem: |
| 318 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); | 305 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); |
| 319 | goto out; | 306 | goto out; |
| @@ -322,6 +309,8 @@ out_put: | |||
| 322 | mntput(lower_mnt); | 309 | mntput(lower_mnt); |
| 323 | d_drop(ecryptfs_dentry); | 310 | d_drop(ecryptfs_dentry); |
| 324 | out: | 311 | out: |
| 312 | if (put_lower) | ||
| 313 | ecryptfs_put_lower_file(ecryptfs_dentry->d_inode); | ||
| 325 | return rc; | 314 | return rc; |
| 326 | } | 315 | } |
| 327 | 316 | ||
| @@ -538,8 +527,6 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 538 | dget(lower_dentry); | 527 | dget(lower_dentry); |
| 539 | rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry); | 528 | rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry); |
| 540 | dput(lower_dentry); | 529 | dput(lower_dentry); |
| 541 | if (!rc) | ||
| 542 | d_delete(lower_dentry); | ||
| 543 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 530 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); |
| 544 | dir->i_nlink = lower_dir_dentry->d_inode->i_nlink; | 531 | dir->i_nlink = lower_dir_dentry->d_inode->i_nlink; |
| 545 | unlock_dir(lower_dir_dentry); | 532 | unlock_dir(lower_dir_dentry); |
| @@ -610,8 +597,8 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 610 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); | 597 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); |
| 611 | out_lock: | 598 | out_lock: |
| 612 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); | 599 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); |
| 613 | dput(lower_new_dentry->d_parent); | 600 | dput(lower_new_dir_dentry); |
| 614 | dput(lower_old_dentry->d_parent); | 601 | dput(lower_old_dir_dentry); |
| 615 | dput(lower_new_dentry); | 602 | dput(lower_new_dentry); |
| 616 | dput(lower_old_dentry); | 603 | dput(lower_old_dentry); |
| 617 | return rc; | 604 | return rc; |
| @@ -759,8 +746,11 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
| 759 | 746 | ||
| 760 | if (unlikely((ia->ia_size == i_size))) { | 747 | if (unlikely((ia->ia_size == i_size))) { |
| 761 | lower_ia->ia_valid &= ~ATTR_SIZE; | 748 | lower_ia->ia_valid &= ~ATTR_SIZE; |
| 762 | goto out; | 749 | return 0; |
| 763 | } | 750 | } |
| 751 | rc = ecryptfs_get_lower_file(dentry); | ||
| 752 | if (rc) | ||
| 753 | return rc; | ||
| 764 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; | 754 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; |
| 765 | /* Switch on growing or shrinking file */ | 755 | /* Switch on growing or shrinking file */ |
| 766 | if (ia->ia_size > i_size) { | 756 | if (ia->ia_size > i_size) { |
| @@ -838,6 +828,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
| 838 | lower_ia->ia_valid &= ~ATTR_SIZE; | 828 | lower_ia->ia_valid &= ~ATTR_SIZE; |
| 839 | } | 829 | } |
| 840 | out: | 830 | out: |
| 831 | ecryptfs_put_lower_file(inode); | ||
| 841 | return rc; | 832 | return rc; |
| 842 | } | 833 | } |
| 843 | 834 | ||
| @@ -913,7 +904,13 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 913 | 904 | ||
| 914 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 905 | mount_crypt_stat = &ecryptfs_superblock_to_private( |
| 915 | dentry->d_sb)->mount_crypt_stat; | 906 | dentry->d_sb)->mount_crypt_stat; |
| 907 | rc = ecryptfs_get_lower_file(dentry); | ||
| 908 | if (rc) { | ||
| 909 | mutex_unlock(&crypt_stat->cs_mutex); | ||
| 910 | goto out; | ||
| 911 | } | ||
| 916 | rc = ecryptfs_read_metadata(dentry); | 912 | rc = ecryptfs_read_metadata(dentry); |
| 913 | ecryptfs_put_lower_file(inode); | ||
| 917 | if (rc) { | 914 | if (rc) { |
| 918 | if (!(mount_crypt_stat->flags | 915 | if (!(mount_crypt_stat->flags |
| 919 | & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { | 916 | & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { |
| @@ -927,10 +924,17 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 927 | goto out; | 924 | goto out; |
| 928 | } | 925 | } |
| 929 | rc = 0; | 926 | rc = 0; |
| 930 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | 927 | crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
| 928 | | ECRYPTFS_ENCRYPTED); | ||
| 931 | } | 929 | } |
| 932 | } | 930 | } |
| 933 | mutex_unlock(&crypt_stat->cs_mutex); | 931 | mutex_unlock(&crypt_stat->cs_mutex); |
| 932 | if (S_ISREG(inode->i_mode)) { | ||
| 933 | rc = filemap_write_and_wait(inode->i_mapping); | ||
| 934 | if (rc) | ||
| 935 | goto out; | ||
| 936 | fsstack_copy_attr_all(inode, lower_inode); | ||
| 937 | } | ||
| 934 | memcpy(&lower_ia, ia, sizeof(lower_ia)); | 938 | memcpy(&lower_ia, ia, sizeof(lower_ia)); |
| 935 | if (ia->ia_valid & ATTR_FILE) | 939 | if (ia->ia_valid & ATTR_FILE) |
| 936 | lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); | 940 | lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); |
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index 0851ab6980f..69f994a7d52 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
| @@ -44,7 +44,7 @@ static struct task_struct *ecryptfs_kthread; | |||
| 44 | * @ignored: ignored | 44 | * @ignored: ignored |
| 45 | * | 45 | * |
| 46 | * The eCryptfs kernel thread that has the responsibility of getting | 46 | * The eCryptfs kernel thread that has the responsibility of getting |
| 47 | * the lower persistent file with RW permissions. | 47 | * the lower file with RW permissions. |
| 48 | * | 48 | * |
| 49 | * Returns zero on success; non-zero otherwise | 49 | * Returns zero on success; non-zero otherwise |
| 50 | */ | 50 | */ |
| @@ -141,8 +141,8 @@ int ecryptfs_privileged_open(struct file **lower_file, | |||
| 141 | int rc = 0; | 141 | int rc = 0; |
| 142 | 142 | ||
| 143 | /* Corresponding dput() and mntput() are done when the | 143 | /* Corresponding dput() and mntput() are done when the |
| 144 | * persistent file is fput() when the eCryptfs inode is | 144 | * lower file is fput() when all eCryptfs files for the inode are |
| 145 | * destroyed. */ | 145 | * released. */ |
| 146 | dget(lower_dentry); | 146 | dget(lower_dentry); |
| 147 | mntget(lower_mnt); | 147 | mntget(lower_mnt); |
| 148 | flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; | 148 | flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index fdb2eb0ad09..89b93389af8 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -96,7 +96,7 @@ void __ecryptfs_printk(const char *fmt, ...) | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | /** | 98 | /** |
| 99 | * ecryptfs_init_persistent_file | 99 | * ecryptfs_init_lower_file |
| 100 | * @ecryptfs_dentry: Fully initialized eCryptfs dentry object, with | 100 | * @ecryptfs_dentry: Fully initialized eCryptfs dentry object, with |
| 101 | * the lower dentry and the lower mount set | 101 | * the lower dentry and the lower mount set |
| 102 | * | 102 | * |
| @@ -104,42 +104,70 @@ void __ecryptfs_printk(const char *fmt, ...) | |||
| 104 | * inode. All I/O operations to the lower inode occur through that | 104 | * inode. All I/O operations to the lower inode occur through that |
| 105 | * file. When the first eCryptfs dentry that interposes with the first | 105 | * file. When the first eCryptfs dentry that interposes with the first |
| 106 | * lower dentry for that inode is created, this function creates the | 106 | * lower dentry for that inode is created, this function creates the |
| 107 | * persistent file struct and associates it with the eCryptfs | 107 | * lower file struct and associates it with the eCryptfs |
| 108 | * inode. When the eCryptfs inode is destroyed, the file is closed. | 108 | * inode. When all eCryptfs files associated with the inode are released, the |
| 109 | * file is closed. | ||
| 109 | * | 110 | * |
| 110 | * The persistent file will be opened with read/write permissions, if | 111 | * The lower file will be opened with read/write permissions, if |
| 111 | * possible. Otherwise, it is opened read-only. | 112 | * possible. Otherwise, it is opened read-only. |
| 112 | * | 113 | * |
| 113 | * This function does nothing if a lower persistent file is already | 114 | * This function does nothing if a lower file is already |
| 114 | * associated with the eCryptfs inode. | 115 | * associated with the eCryptfs inode. |
| 115 | * | 116 | * |
| 116 | * Returns zero on success; non-zero otherwise | 117 | * Returns zero on success; non-zero otherwise |
| 117 | */ | 118 | */ |
| 118 | int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry) | 119 | static int ecryptfs_init_lower_file(struct dentry *dentry, |
| 120 | struct file **lower_file) | ||
| 119 | { | 121 | { |
| 120 | const struct cred *cred = current_cred(); | 122 | const struct cred *cred = current_cred(); |
| 121 | struct ecryptfs_inode_info *inode_info = | 123 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 122 | ecryptfs_inode_to_private(ecryptfs_dentry->d_inode); | 124 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); |
| 123 | int rc = 0; | 125 | int rc; |
| 124 | 126 | ||
| 125 | if (!inode_info->lower_file) { | 127 | rc = ecryptfs_privileged_open(lower_file, lower_dentry, lower_mnt, |
| 126 | struct dentry *lower_dentry; | 128 | cred); |
| 127 | struct vfsmount *lower_mnt = | 129 | if (rc) { |
| 128 | ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); | 130 | printk(KERN_ERR "Error opening lower file " |
| 131 | "for lower_dentry [0x%p] and lower_mnt [0x%p]; " | ||
| 132 | "rc = [%d]\n", lower_dentry, lower_mnt, rc); | ||
| 133 | (*lower_file) = NULL; | ||
| 134 | } | ||
| 135 | return rc; | ||
| 136 | } | ||
| 129 | 137 | ||
| 130 | lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); | 138 | int ecryptfs_get_lower_file(struct dentry *dentry) |
| 131 | rc = ecryptfs_privileged_open(&inode_info->lower_file, | 139 | { |
| 132 | lower_dentry, lower_mnt, cred); | 140 | struct ecryptfs_inode_info *inode_info = |
| 133 | if (rc) { | 141 | ecryptfs_inode_to_private(dentry->d_inode); |
| 134 | printk(KERN_ERR "Error opening lower persistent file " | 142 | int count, rc = 0; |
| 135 | "for lower_dentry [0x%p] and lower_mnt [0x%p]; " | 143 | |
| 136 | "rc = [%d]\n", lower_dentry, lower_mnt, rc); | 144 | mutex_lock(&inode_info->lower_file_mutex); |
| 137 | inode_info->lower_file = NULL; | 145 | count = atomic_inc_return(&inode_info->lower_file_count); |
| 138 | } | 146 | if (WARN_ON_ONCE(count < 1)) |
| 147 | rc = -EINVAL; | ||
| 148 | else if (count == 1) { | ||
| 149 | rc = ecryptfs_init_lower_file(dentry, | ||
| 150 | &inode_info->lower_file); | ||
| 151 | if (rc) | ||
| 152 | atomic_set(&inode_info->lower_file_count, 0); | ||
| 139 | } | 153 | } |
| 154 | mutex_unlock(&inode_info->lower_file_mutex); | ||
| 140 | return rc; | 155 | return rc; |
| 141 | } | 156 | } |
| 142 | 157 | ||
| 158 | void ecryptfs_put_lower_file(struct inode *inode) | ||
| 159 | { | ||
| 160 | struct ecryptfs_inode_info *inode_info; | ||
| 161 | |||
| 162 | inode_info = ecryptfs_inode_to_private(inode); | ||
| 163 | if (atomic_dec_and_mutex_lock(&inode_info->lower_file_count, | ||
| 164 | &inode_info->lower_file_mutex)) { | ||
| 165 | fput(inode_info->lower_file); | ||
| 166 | inode_info->lower_file = NULL; | ||
| 167 | mutex_unlock(&inode_info->lower_file_mutex); | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 143 | static struct inode *ecryptfs_get_inode(struct inode *lower_inode, | 171 | static struct inode *ecryptfs_get_inode(struct inode *lower_inode, |
| 144 | struct super_block *sb) | 172 | struct super_block *sb) |
| 145 | { | 173 | { |
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index bacc882e1ae..245b517bf1b 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
| @@ -55,6 +55,8 @@ static struct inode *ecryptfs_alloc_inode(struct super_block *sb) | |||
| 55 | if (unlikely(!inode_info)) | 55 | if (unlikely(!inode_info)) |
| 56 | goto out; | 56 | goto out; |
| 57 | ecryptfs_init_crypt_stat(&inode_info->crypt_stat); | 57 | ecryptfs_init_crypt_stat(&inode_info->crypt_stat); |
| 58 | mutex_init(&inode_info->lower_file_mutex); | ||
| 59 | atomic_set(&inode_info->lower_file_count, 0); | ||
| 58 | inode_info->lower_file = NULL; | 60 | inode_info->lower_file = NULL; |
| 59 | inode = &inode_info->vfs_inode; | 61 | inode = &inode_info->vfs_inode; |
| 60 | out: | 62 | out: |
| @@ -77,8 +79,7 @@ static void ecryptfs_i_callback(struct rcu_head *head) | |||
| 77 | * | 79 | * |
| 78 | * This is used during the final destruction of the inode. All | 80 | * This is used during the final destruction of the inode. All |
| 79 | * allocation of memory related to the inode, including allocated | 81 | * allocation of memory related to the inode, including allocated |
| 80 | * memory in the crypt_stat struct, will be released here. This | 82 | * memory in the crypt_stat struct, will be released here. |
| 81 | * function also fput()'s the persistent file for the lower inode. | ||
| 82 | * There should be no chance that this deallocation will be missed. | 83 | * There should be no chance that this deallocation will be missed. |
| 83 | */ | 84 | */ |
| 84 | static void ecryptfs_destroy_inode(struct inode *inode) | 85 | static void ecryptfs_destroy_inode(struct inode *inode) |
| @@ -86,16 +87,7 @@ static void ecryptfs_destroy_inode(struct inode *inode) | |||
| 86 | struct ecryptfs_inode_info *inode_info; | 87 | struct ecryptfs_inode_info *inode_info; |
| 87 | 88 | ||
| 88 | inode_info = ecryptfs_inode_to_private(inode); | 89 | inode_info = ecryptfs_inode_to_private(inode); |
| 89 | if (inode_info->lower_file) { | 90 | BUG_ON(inode_info->lower_file); |
| 90 | struct dentry *lower_dentry = | ||
| 91 | inode_info->lower_file->f_dentry; | ||
| 92 | |||
| 93 | BUG_ON(!lower_dentry); | ||
| 94 | if (lower_dentry->d_inode) { | ||
| 95 | fput(inode_info->lower_file); | ||
| 96 | inode_info->lower_file = NULL; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); | 91 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); |
| 100 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); | 92 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); |
| 101 | } | 93 | } |
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index f07643e21bf..7a4fb630a32 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
| @@ -93,14 +93,12 @@ static unsigned int gl_hash(const struct gfs2_sbd *sdp, | |||
| 93 | 93 | ||
| 94 | static inline void spin_lock_bucket(unsigned int hash) | 94 | static inline void spin_lock_bucket(unsigned int hash) |
| 95 | { | 95 | { |
| 96 | struct hlist_bl_head *bl = &gl_hash_table[hash]; | 96 | hlist_bl_lock(&gl_hash_table[hash]); |
| 97 | bit_spin_lock(0, (unsigned long *)bl); | ||
| 98 | } | 97 | } |
| 99 | 98 | ||
| 100 | static inline void spin_unlock_bucket(unsigned int hash) | 99 | static inline void spin_unlock_bucket(unsigned int hash) |
| 101 | { | 100 | { |
| 102 | struct hlist_bl_head *bl = &gl_hash_table[hash]; | 101 | hlist_bl_unlock(&gl_hash_table[hash]); |
| 103 | __bit_spin_unlock(0, (unsigned long *)bl); | ||
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | static void gfs2_glock_dealloc(struct rcu_head *rcu) | 104 | static void gfs2_glock_dealloc(struct rcu_head *rcu) |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index aa309aa93fe..4cf04e11c66 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp) | |||
| 258 | if (atomic_dec_and_test(&fp->fi_delegees)) { | 258 | if (atomic_dec_and_test(&fp->fi_delegees)) { |
| 259 | vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease); | 259 | vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease); |
| 260 | fp->fi_lease = NULL; | 260 | fp->fi_lease = NULL; |
| 261 | fput(fp->fi_deleg_file); | ||
| 261 | fp->fi_deleg_file = NULL; | 262 | fp->fi_deleg_file = NULL; |
| 262 | } | 263 | } |
| 263 | } | 264 | } |
| @@ -402,8 +403,8 @@ static void free_generic_stateid(struct nfs4_stateid *stp) | |||
| 402 | if (stp->st_access_bmap) { | 403 | if (stp->st_access_bmap) { |
| 403 | oflag = nfs4_access_bmap_to_omode(stp); | 404 | oflag = nfs4_access_bmap_to_omode(stp); |
| 404 | nfs4_file_put_access(stp->st_file, oflag); | 405 | nfs4_file_put_access(stp->st_file, oflag); |
| 405 | put_nfs4_file(stp->st_file); | ||
| 406 | } | 406 | } |
| 407 | put_nfs4_file(stp->st_file); | ||
| 407 | kmem_cache_free(stateid_slab, stp); | 408 | kmem_cache_free(stateid_slab, stp); |
| 408 | } | 409 | } |
| 409 | 410 | ||
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2e1cebde90d..129f3c9f62d 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -1363,7 +1363,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1363 | goto out; | 1363 | goto out; |
| 1364 | if (!(iap->ia_valid & ATTR_MODE)) | 1364 | if (!(iap->ia_valid & ATTR_MODE)) |
| 1365 | iap->ia_mode = 0; | 1365 | iap->ia_mode = 0; |
| 1366 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | 1366 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC); |
| 1367 | if (err) | 1367 | if (err) |
| 1368 | goto out; | 1368 | goto out; |
| 1369 | 1369 | ||
| @@ -1385,6 +1385,13 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1385 | if (IS_ERR(dchild)) | 1385 | if (IS_ERR(dchild)) |
| 1386 | goto out_nfserr; | 1386 | goto out_nfserr; |
| 1387 | 1387 | ||
| 1388 | /* If file doesn't exist, check for permissions to create one */ | ||
| 1389 | if (!dchild->d_inode) { | ||
| 1390 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | ||
| 1391 | if (err) | ||
| 1392 | goto out; | ||
| 1393 | } | ||
| 1394 | |||
| 1388 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); | 1395 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); |
| 1389 | if (err) | 1396 | if (err) |
| 1390 | goto out; | 1397 | goto out; |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 936f2cbfe6b..3dbad6fbd1e 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
| @@ -317,6 +317,32 @@ int ubifs_recover_master_node(struct ubifs_info *c) | |||
| 317 | goto out_free; | 317 | goto out_free; |
| 318 | } | 318 | } |
| 319 | memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ); | 319 | memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ); |
| 320 | |||
| 321 | /* | ||
| 322 | * We had to recover the master node, which means there was an | ||
| 323 | * unclean reboot. However, it is possible that the master node | ||
| 324 | * is clean at this point, i.e., %UBIFS_MST_DIRTY is not set. | ||
| 325 | * E.g., consider the following chain of events: | ||
| 326 | * | ||
| 327 | * 1. UBIFS was cleanly unmounted, so the master node is clean | ||
| 328 | * 2. UBIFS is being mounted R/W and starts changing the master | ||
| 329 | * node in the first (%UBIFS_MST_LNUM). A power cut happens, | ||
| 330 | * so this LEB ends up with some amount of garbage at the | ||
| 331 | * end. | ||
| 332 | * 3. UBIFS is being mounted R/O. We reach this place and | ||
| 333 | * recover the master node from the second LEB | ||
| 334 | * (%UBIFS_MST_LNUM + 1). But we cannot update the media | ||
| 335 | * because we are being mounted R/O. We have to defer the | ||
| 336 | * operation. | ||
| 337 | * 4. However, this master node (@c->mst_node) is marked as | ||
| 338 | * clean (since the step 1). And if we just return, the | ||
| 339 | * mount code will be confused and won't recover the master | ||
| 340 | * node when it is re-mounter R/W later. | ||
| 341 | * | ||
| 342 | * Thus, to force the recovery by marking the master node as | ||
| 343 | * dirty. | ||
| 344 | */ | ||
| 345 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); | ||
| 320 | } else { | 346 | } else { |
| 321 | /* Write the recovered master node */ | 347 | /* Write the recovered master node */ |
| 322 | c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1; | 348 | c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1; |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index c75f6133206..be6c7b008f3 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -1671,14 +1671,25 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
| 1671 | if (err) | 1671 | if (err) |
| 1672 | goto out; | 1672 | goto out; |
| 1673 | 1673 | ||
| 1674 | dbg_gen("re-mounted read-write"); | ||
| 1675 | c->remounting_rw = 0; | ||
| 1676 | |||
| 1674 | if (c->need_recovery) { | 1677 | if (c->need_recovery) { |
| 1675 | c->need_recovery = 0; | 1678 | c->need_recovery = 0; |
| 1676 | ubifs_msg("deferred recovery completed"); | 1679 | ubifs_msg("deferred recovery completed"); |
| 1680 | } else { | ||
| 1681 | /* | ||
| 1682 | * Do not run the debugging space check if the were doing | ||
| 1683 | * recovery, because when we saved the information we had the | ||
| 1684 | * file-system in a state where the TNC and lprops has been | ||
| 1685 | * modified in memory, but all the I/O operations (including a | ||
| 1686 | * commit) were deferred. So the file-system was in | ||
| 1687 | * "non-committed" state. Now the file-system is in committed | ||
| 1688 | * state, and of course the amount of free space will change | ||
| 1689 | * because, for example, the old index size was imprecise. | ||
| 1690 | */ | ||
| 1691 | err = dbg_check_space_info(c); | ||
| 1677 | } | 1692 | } |
| 1678 | |||
| 1679 | dbg_gen("re-mounted read-write"); | ||
| 1680 | c->remounting_rw = 0; | ||
| 1681 | err = dbg_check_space_info(c); | ||
| 1682 | mutex_unlock(&c->umount_mutex); | 1693 | mutex_unlock(&c->umount_mutex); |
| 1683 | return err; | 1694 | return err; |
| 1684 | 1695 | ||
| @@ -1761,10 +1772,12 @@ static void ubifs_put_super(struct super_block *sb) | |||
| 1761 | * of the media. For example, there will be dirty inodes if we failed | 1772 | * of the media. For example, there will be dirty inodes if we failed |
| 1762 | * to write them back because of I/O errors. | 1773 | * to write them back because of I/O errors. |
| 1763 | */ | 1774 | */ |
| 1764 | ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0); | 1775 | if (!c->ro_error) { |
| 1765 | ubifs_assert(c->budg_idx_growth == 0); | 1776 | ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0); |
| 1766 | ubifs_assert(c->budg_dd_growth == 0); | 1777 | ubifs_assert(c->budg_idx_growth == 0); |
| 1767 | ubifs_assert(c->budg_data_growth == 0); | 1778 | ubifs_assert(c->budg_dd_growth == 0); |
| 1779 | ubifs_assert(c->budg_data_growth == 0); | ||
| 1780 | } | ||
| 1768 | 1781 | ||
| 1769 | /* | 1782 | /* |
| 1770 | * The 'c->umount_lock' prevents races between UBIFS memory shrinker | 1783 | * The 'c->umount_lock' prevents races between UBIFS memory shrinker |
diff --git a/fs/xattr.c b/fs/xattr.c index a19acdb81cd..f1ef94974de 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
| @@ -666,7 +666,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz | |||
| 666 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); | 666 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); |
| 667 | if (!handler) | 667 | if (!handler) |
| 668 | return -EOPNOTSUPP; | 668 | return -EOPNOTSUPP; |
| 669 | return handler->set(dentry, name, value, size, 0, handler->flags); | 669 | return handler->set(dentry, name, value, size, flags, handler->flags); |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | /* | 672 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/linux-2.6/xfs_message.c index 3ca79560911..9f76cceb678 100644 --- a/fs/xfs/linux-2.6/xfs_message.c +++ b/fs/xfs/linux-2.6/xfs_message.c | |||
| @@ -34,8 +34,10 @@ __xfs_printk( | |||
| 34 | const struct xfs_mount *mp, | 34 | const struct xfs_mount *mp, |
| 35 | struct va_format *vaf) | 35 | struct va_format *vaf) |
| 36 | { | 36 | { |
| 37 | if (mp && mp->m_fsname) | 37 | if (mp && mp->m_fsname) { |
| 38 | printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf); | 38 | printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf); |
| 39 | return; | ||
| 40 | } | ||
| 39 | printk("%sXFS: %pV\n", level, vaf); | 41 | printk("%sXFS: %pV\n", level, vaf); |
| 40 | } | 42 | } |
| 41 | 43 | ||
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h index e612575a259..b4326bfa684 100644 --- a/include/linux/bit_spinlock.h +++ b/include/linux/bit_spinlock.h | |||
| @@ -23,11 +23,11 @@ static inline void bit_spin_lock(int bitnum, unsigned long *addr) | |||
| 23 | preempt_disable(); | 23 | preempt_disable(); |
| 24 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 24 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
| 25 | while (unlikely(test_and_set_bit_lock(bitnum, addr))) { | 25 | while (unlikely(test_and_set_bit_lock(bitnum, addr))) { |
| 26 | while (test_bit(bitnum, addr)) { | 26 | preempt_enable(); |
| 27 | preempt_enable(); | 27 | do { |
| 28 | cpu_relax(); | 28 | cpu_relax(); |
| 29 | preempt_disable(); | 29 | } while (test_bit(bitnum, addr)); |
| 30 | } | 30 | preempt_disable(); |
| 31 | } | 31 | } |
| 32 | #endif | 32 | #endif |
| 33 | __acquire(bitlock); | 33 | __acquire(bitlock); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index cbbfd98ad4a..2ad95fa1d13 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -388,20 +388,19 @@ struct request_queue | |||
| 388 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ | 388 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ |
| 389 | #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ | 389 | #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ |
| 390 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ | 390 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ |
| 391 | #define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ | 391 | #define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */ |
| 392 | #define QUEUE_FLAG_ELVSWITCH 7 /* don't use elevator, just do FIFO */ | 392 | #define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ |
| 393 | #define QUEUE_FLAG_BIDI 8 /* queue supports bidi requests */ | 393 | #define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ |
| 394 | #define QUEUE_FLAG_NOMERGES 9 /* disable merge attempts */ | 394 | #define QUEUE_FLAG_SAME_COMP 9 /* force complete on same CPU */ |
| 395 | #define QUEUE_FLAG_SAME_COMP 10 /* force complete on same CPU */ | 395 | #define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */ |
| 396 | #define QUEUE_FLAG_FAIL_IO 11 /* fake timeout */ | 396 | #define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */ |
| 397 | #define QUEUE_FLAG_STACKABLE 12 /* supports request stacking */ | 397 | #define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */ |
| 398 | #define QUEUE_FLAG_NONROT 13 /* non-rotational device (SSD) */ | ||
| 399 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ | 398 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
| 400 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ | 399 | #define QUEUE_FLAG_IO_STAT 13 /* do IO stats */ |
| 401 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ | 400 | #define QUEUE_FLAG_DISCARD 14 /* supports DISCARD */ |
| 402 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ | 401 | #define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */ |
| 403 | #define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */ | 402 | #define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ |
| 404 | #define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */ | 403 | #define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ |
| 405 | 404 | ||
| 406 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 405 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 407 | (1 << QUEUE_FLAG_STACKABLE) | \ | 406 | (1 << QUEUE_FLAG_STACKABLE) | \ |
| @@ -699,6 +698,7 @@ extern void blk_sync_queue(struct request_queue *q); | |||
| 699 | extern void __blk_stop_queue(struct request_queue *q); | 698 | extern void __blk_stop_queue(struct request_queue *q); |
| 700 | extern void __blk_run_queue(struct request_queue *q); | 699 | extern void __blk_run_queue(struct request_queue *q); |
| 701 | extern void blk_run_queue(struct request_queue *); | 700 | extern void blk_run_queue(struct request_queue *); |
| 701 | extern void blk_run_queue_async(struct request_queue *q); | ||
| 702 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 702 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
| 703 | struct rq_map_data *, void __user *, unsigned long, | 703 | struct rq_map_data *, void __user *, unsigned long, |
| 704 | gfp_t); | 704 | gfp_t); |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f2afed4fa94..19d90a55541 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -197,7 +197,7 @@ struct dentry_operations { | |||
| 197 | * typically using d_splice_alias. */ | 197 | * typically using d_splice_alias. */ |
| 198 | 198 | ||
| 199 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ | 199 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ |
| 200 | #define DCACHE_UNHASHED 0x0010 | 200 | #define DCACHE_RCUACCESS 0x0010 /* Entry has ever been RCU-visible */ |
| 201 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 | 201 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 |
| 202 | /* Parent inode is watched by inotify */ | 202 | /* Parent inode is watched by inotify */ |
| 203 | 203 | ||
| @@ -384,7 +384,7 @@ extern struct dentry *dget_parent(struct dentry *dentry); | |||
| 384 | 384 | ||
| 385 | static inline int d_unhashed(struct dentry *dentry) | 385 | static inline int d_unhashed(struct dentry *dentry) |
| 386 | { | 386 | { |
| 387 | return (dentry->d_flags & DCACHE_UNHASHED); | 387 | return hlist_bl_unhashed(&dentry->d_hash); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | static inline int d_unlinked(struct dentry *dentry) | 390 | static inline int d_unlinked(struct dentry *dentry) |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 7f675aa81d8..04f32a3eb26 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -137,8 +137,6 @@ enum { | |||
| 137 | ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ | 137 | ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ |
| 138 | ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ | 138 | ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ |
| 139 | ATA_DFLAG_AN = (1 << 7), /* AN configured */ | 139 | ATA_DFLAG_AN = (1 << 7), /* AN configured */ |
| 140 | ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */ | ||
| 141 | ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */ | ||
| 142 | ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ | 140 | ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ |
| 143 | ATA_DFLAG_CFG_MASK = (1 << 12) - 1, | 141 | ATA_DFLAG_CFG_MASK = (1 << 12) - 1, |
| 144 | 142 | ||
| @@ -198,6 +196,7 @@ enum { | |||
| 198 | * management */ | 196 | * management */ |
| 199 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | 197 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity |
| 200 | * led */ | 198 | * led */ |
| 199 | ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ | ||
| 201 | 200 | ||
| 202 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ | 201 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ |
| 203 | 202 | ||
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index 5bad17d1acd..31f9d75adc5 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_LIST_BL_H | 2 | #define _LINUX_LIST_BL_H |
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <linux/bit_spinlock.h> | ||
| 5 | 6 | ||
| 6 | /* | 7 | /* |
| 7 | * Special version of lists, where head of the list has a lock in the lowest | 8 | * Special version of lists, where head of the list has a lock in the lowest |
| @@ -114,6 +115,16 @@ static inline void hlist_bl_del_init(struct hlist_bl_node *n) | |||
| 114 | } | 115 | } |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 118 | static inline void hlist_bl_lock(struct hlist_bl_head *b) | ||
| 119 | { | ||
| 120 | bit_spin_lock(0, (unsigned long *)b); | ||
| 121 | } | ||
| 122 | |||
| 123 | static inline void hlist_bl_unlock(struct hlist_bl_head *b) | ||
| 124 | { | ||
| 125 | __bit_spin_unlock(0, (unsigned long *)b); | ||
| 126 | } | ||
| 127 | |||
| 117 | /** | 128 | /** |
| 118 | * hlist_bl_for_each_entry - iterate over list of given type | 129 | * hlist_bl_for_each_entry - iterate over list of given type |
| 119 | * @tpos: the type * to use as a loop cursor. | 130 | * @tpos: the type * to use as a loop cursor. |
diff --git a/include/linux/security.h b/include/linux/security.h index ca02f171673..8ce59ef3e5a 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -1456,7 +1456,7 @@ struct security_operations { | |||
| 1456 | struct inode *new_dir, struct dentry *new_dentry); | 1456 | struct inode *new_dir, struct dentry *new_dentry); |
| 1457 | int (*inode_readlink) (struct dentry *dentry); | 1457 | int (*inode_readlink) (struct dentry *dentry); |
| 1458 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1458 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
| 1459 | int (*inode_permission) (struct inode *inode, int mask); | 1459 | int (*inode_permission) (struct inode *inode, int mask, unsigned flags); |
| 1460 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); | 1460 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); |
| 1461 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); | 1461 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); |
| 1462 | int (*inode_setxattr) (struct dentry *dentry, const char *name, | 1462 | int (*inode_setxattr) (struct dentry *dentry, const char *name, |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 55936f9cb25..87b77de03dd 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
| 34 | #include <linux/swap.h> | 34 | #include <linux/swap.h> |
| 35 | #include <linux/kmsg_dump.h> | 35 | #include <linux/kmsg_dump.h> |
| 36 | #include <linux/syscore_ops.h> | ||
| 36 | 37 | ||
| 37 | #include <asm/page.h> | 38 | #include <asm/page.h> |
| 38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
| @@ -1532,6 +1533,11 @@ int kernel_kexec(void) | |||
| 1532 | local_irq_disable(); | 1533 | local_irq_disable(); |
| 1533 | /* Suspend system devices */ | 1534 | /* Suspend system devices */ |
| 1534 | error = sysdev_suspend(PMSG_FREEZE); | 1535 | error = sysdev_suspend(PMSG_FREEZE); |
| 1536 | if (!error) { | ||
| 1537 | error = syscore_suspend(); | ||
| 1538 | if (error) | ||
| 1539 | sysdev_resume(); | ||
| 1540 | } | ||
| 1535 | if (error) | 1541 | if (error) |
| 1536 | goto Enable_irqs; | 1542 | goto Enable_irqs; |
| 1537 | } else | 1543 | } else |
| @@ -1546,6 +1552,7 @@ int kernel_kexec(void) | |||
| 1546 | 1552 | ||
| 1547 | #ifdef CONFIG_KEXEC_JUMP | 1553 | #ifdef CONFIG_KEXEC_JUMP |
| 1548 | if (kexec_image->preserve_context) { | 1554 | if (kexec_image->preserve_context) { |
| 1555 | syscore_resume(); | ||
| 1549 | sysdev_resume(); | 1556 | sysdev_resume(); |
| 1550 | Enable_irqs: | 1557 | Enable_irqs: |
| 1551 | local_irq_enable(); | 1558 | local_irq_enable(); |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index aeabd26e334..50aae660174 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
| @@ -273,8 +273,11 @@ static int create_image(int platform_mode) | |||
| 273 | local_irq_disable(); | 273 | local_irq_disable(); |
| 274 | 274 | ||
| 275 | error = sysdev_suspend(PMSG_FREEZE); | 275 | error = sysdev_suspend(PMSG_FREEZE); |
| 276 | if (!error) | 276 | if (!error) { |
| 277 | error = syscore_suspend(); | 277 | error = syscore_suspend(); |
| 278 | if (error) | ||
| 279 | sysdev_resume(); | ||
| 280 | } | ||
| 278 | if (error) { | 281 | if (error) { |
| 279 | printk(KERN_ERR "PM: Some system devices failed to power down, " | 282 | printk(KERN_ERR "PM: Some system devices failed to power down, " |
| 280 | "aborting hibernation\n"); | 283 | "aborting hibernation\n"); |
| @@ -407,8 +410,11 @@ static int resume_target_kernel(bool platform_mode) | |||
| 407 | local_irq_disable(); | 410 | local_irq_disable(); |
| 408 | 411 | ||
| 409 | error = sysdev_suspend(PMSG_QUIESCE); | 412 | error = sysdev_suspend(PMSG_QUIESCE); |
| 410 | if (!error) | 413 | if (!error) { |
| 411 | error = syscore_suspend(); | 414 | error = syscore_suspend(); |
| 415 | if (error) | ||
| 416 | sysdev_resume(); | ||
| 417 | } | ||
| 412 | if (error) | 418 | if (error) |
| 413 | goto Enable_irqs; | 419 | goto Enable_irqs; |
| 414 | 420 | ||
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 2814c32aed5..8935369d503 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
| @@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_t state) | |||
| 164 | BUG_ON(!irqs_disabled()); | 164 | BUG_ON(!irqs_disabled()); |
| 165 | 165 | ||
| 166 | error = sysdev_suspend(PMSG_SUSPEND); | 166 | error = sysdev_suspend(PMSG_SUSPEND); |
| 167 | if (!error) | 167 | if (!error) { |
| 168 | error = syscore_suspend(); | 168 | error = syscore_suspend(); |
| 169 | if (error) | ||
| 170 | sysdev_resume(); | ||
| 171 | } | ||
| 169 | if (!error) { | 172 | if (!error) { |
| 170 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { | 173 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { |
| 171 | error = suspend_ops->enter(state); | 174 | error = suspend_ops->enter(state); |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 659326c3e89..006ad817cd5 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
| @@ -332,7 +332,7 @@ static int conf_choice(struct menu *menu) | |||
| 332 | } | 332 | } |
| 333 | if (!child) | 333 | if (!child) |
| 334 | continue; | 334 | continue; |
| 335 | if (line[strlen(line) - 1] == '?') { | 335 | if (line[0] && line[strlen(line) - 1] == '?') { |
| 336 | print_help(child); | 336 | print_help(child); |
| 337 | continue; | 337 | continue; |
| 338 | } | 338 | } |
diff --git a/security/capability.c b/security/capability.c index 2984ea4f776..bbb51156261 100644 --- a/security/capability.c +++ b/security/capability.c | |||
| @@ -181,7 +181,7 @@ static int cap_inode_follow_link(struct dentry *dentry, | |||
| 181 | return 0; | 181 | return 0; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | static int cap_inode_permission(struct inode *inode, int mask) | 184 | static int cap_inode_permission(struct inode *inode, int mask, unsigned flags) |
| 185 | { | 185 | { |
| 186 | return 0; | 186 | return 0; |
| 187 | } | 187 | } |
diff --git a/security/security.c b/security/security.c index 101142369db..4ba6d4cc061 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -518,16 +518,14 @@ int security_inode_permission(struct inode *inode, int mask) | |||
| 518 | { | 518 | { |
| 519 | if (unlikely(IS_PRIVATE(inode))) | 519 | if (unlikely(IS_PRIVATE(inode))) |
| 520 | return 0; | 520 | return 0; |
| 521 | return security_ops->inode_permission(inode, mask); | 521 | return security_ops->inode_permission(inode, mask, 0); |
| 522 | } | 522 | } |
| 523 | 523 | ||
| 524 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) | 524 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) |
| 525 | { | 525 | { |
| 526 | if (unlikely(IS_PRIVATE(inode))) | 526 | if (unlikely(IS_PRIVATE(inode))) |
| 527 | return 0; | 527 | return 0; |
| 528 | if (flags) | 528 | return security_ops->inode_permission(inode, MAY_EXEC, flags); |
| 529 | return -ECHILD; | ||
| 530 | return security_ops->inode_permission(inode, MAY_EXEC); | ||
| 531 | } | 529 | } |
| 532 | 530 | ||
| 533 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | 531 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) |
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 9da6420e205..1d027e29ce8 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
| @@ -471,6 +471,7 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
| 471 | * @avd: access vector decisions | 471 | * @avd: access vector decisions |
| 472 | * @result: result from avc_has_perm_noaudit | 472 | * @result: result from avc_has_perm_noaudit |
| 473 | * @a: auxiliary audit data | 473 | * @a: auxiliary audit data |
| 474 | * @flags: VFS walk flags | ||
| 474 | * | 475 | * |
| 475 | * Audit the granting or denial of permissions in accordance | 476 | * Audit the granting or denial of permissions in accordance |
| 476 | * with the policy. This function is typically called by | 477 | * with the policy. This function is typically called by |
| @@ -481,9 +482,10 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
| 481 | * be performed under a lock, to allow the lock to be released | 482 | * be performed under a lock, to allow the lock to be released |
| 482 | * before calling the auditing code. | 483 | * before calling the auditing code. |
| 483 | */ | 484 | */ |
| 484 | void avc_audit(u32 ssid, u32 tsid, | 485 | int avc_audit(u32 ssid, u32 tsid, |
| 485 | u16 tclass, u32 requested, | 486 | u16 tclass, u32 requested, |
| 486 | struct av_decision *avd, int result, struct common_audit_data *a) | 487 | struct av_decision *avd, int result, struct common_audit_data *a, |
| 488 | unsigned flags) | ||
| 487 | { | 489 | { |
| 488 | struct common_audit_data stack_data; | 490 | struct common_audit_data stack_data; |
| 489 | u32 denied, audited; | 491 | u32 denied, audited; |
| @@ -515,11 +517,24 @@ void avc_audit(u32 ssid, u32 tsid, | |||
| 515 | else | 517 | else |
| 516 | audited = requested & avd->auditallow; | 518 | audited = requested & avd->auditallow; |
| 517 | if (!audited) | 519 | if (!audited) |
| 518 | return; | 520 | return 0; |
| 521 | |||
| 519 | if (!a) { | 522 | if (!a) { |
| 520 | a = &stack_data; | 523 | a = &stack_data; |
| 521 | COMMON_AUDIT_DATA_INIT(a, NONE); | 524 | COMMON_AUDIT_DATA_INIT(a, NONE); |
| 522 | } | 525 | } |
| 526 | |||
| 527 | /* | ||
| 528 | * When in a RCU walk do the audit on the RCU retry. This is because | ||
| 529 | * the collection of the dname in an inode audit message is not RCU | ||
| 530 | * safe. Note this may drop some audits when the situation changes | ||
| 531 | * during retry. However this is logically just as if the operation | ||
| 532 | * happened a little later. | ||
| 533 | */ | ||
| 534 | if ((a->type == LSM_AUDIT_DATA_FS) && | ||
| 535 | (flags & IPERM_FLAG_RCU)) | ||
| 536 | return -ECHILD; | ||
| 537 | |||
| 523 | a->selinux_audit_data.tclass = tclass; | 538 | a->selinux_audit_data.tclass = tclass; |
| 524 | a->selinux_audit_data.requested = requested; | 539 | a->selinux_audit_data.requested = requested; |
| 525 | a->selinux_audit_data.ssid = ssid; | 540 | a->selinux_audit_data.ssid = ssid; |
| @@ -529,6 +544,7 @@ void avc_audit(u32 ssid, u32 tsid, | |||
| 529 | a->lsm_pre_audit = avc_audit_pre_callback; | 544 | a->lsm_pre_audit = avc_audit_pre_callback; |
| 530 | a->lsm_post_audit = avc_audit_post_callback; | 545 | a->lsm_post_audit = avc_audit_post_callback; |
| 531 | common_lsm_audit(a); | 546 | common_lsm_audit(a); |
| 547 | return 0; | ||
| 532 | } | 548 | } |
| 533 | 549 | ||
| 534 | /** | 550 | /** |
| @@ -793,6 +809,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
| 793 | * @tclass: target security class | 809 | * @tclass: target security class |
| 794 | * @requested: requested permissions, interpreted based on @tclass | 810 | * @requested: requested permissions, interpreted based on @tclass |
| 795 | * @auditdata: auxiliary audit data | 811 | * @auditdata: auxiliary audit data |
| 812 | * @flags: VFS walk flags | ||
| 796 | * | 813 | * |
| 797 | * Check the AVC to determine whether the @requested permissions are granted | 814 | * Check the AVC to determine whether the @requested permissions are granted |
| 798 | * for the SID pair (@ssid, @tsid), interpreting the permissions | 815 | * for the SID pair (@ssid, @tsid), interpreting the permissions |
| @@ -802,14 +819,19 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
| 802 | * permissions are granted, -%EACCES if any permissions are denied, or | 819 | * permissions are granted, -%EACCES if any permissions are denied, or |
| 803 | * another -errno upon other errors. | 820 | * another -errno upon other errors. |
| 804 | */ | 821 | */ |
| 805 | int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, | 822 | int avc_has_perm_flags(u32 ssid, u32 tsid, u16 tclass, |
| 806 | u32 requested, struct common_audit_data *auditdata) | 823 | u32 requested, struct common_audit_data *auditdata, |
| 824 | unsigned flags) | ||
| 807 | { | 825 | { |
| 808 | struct av_decision avd; | 826 | struct av_decision avd; |
| 809 | int rc; | 827 | int rc, rc2; |
| 810 | 828 | ||
| 811 | rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd); | 829 | rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd); |
| 812 | avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata); | 830 | |
| 831 | rc2 = avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata, | ||
| 832 | flags); | ||
| 833 | if (rc2) | ||
| 834 | return rc2; | ||
| 813 | return rc; | 835 | return rc; |
| 814 | } | 836 | } |
| 815 | 837 | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index f9c3764e485..f7cf0ea6fae 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -1446,8 +1446,11 @@ static int task_has_capability(struct task_struct *tsk, | |||
| 1446 | } | 1446 | } |
| 1447 | 1447 | ||
| 1448 | rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd); | 1448 | rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd); |
| 1449 | if (audit == SECURITY_CAP_AUDIT) | 1449 | if (audit == SECURITY_CAP_AUDIT) { |
| 1450 | avc_audit(sid, sid, sclass, av, &avd, rc, &ad); | 1450 | int rc2 = avc_audit(sid, sid, sclass, av, &avd, rc, &ad, 0); |
| 1451 | if (rc2) | ||
| 1452 | return rc2; | ||
| 1453 | } | ||
| 1451 | return rc; | 1454 | return rc; |
| 1452 | } | 1455 | } |
| 1453 | 1456 | ||
| @@ -1467,7 +1470,8 @@ static int task_has_system(struct task_struct *tsk, | |||
| 1467 | static int inode_has_perm(const struct cred *cred, | 1470 | static int inode_has_perm(const struct cred *cred, |
| 1468 | struct inode *inode, | 1471 | struct inode *inode, |
| 1469 | u32 perms, | 1472 | u32 perms, |
| 1470 | struct common_audit_data *adp) | 1473 | struct common_audit_data *adp, |
| 1474 | unsigned flags) | ||
| 1471 | { | 1475 | { |
| 1472 | struct inode_security_struct *isec; | 1476 | struct inode_security_struct *isec; |
| 1473 | struct common_audit_data ad; | 1477 | struct common_audit_data ad; |
| @@ -1487,7 +1491,7 @@ static int inode_has_perm(const struct cred *cred, | |||
| 1487 | ad.u.fs.inode = inode; | 1491 | ad.u.fs.inode = inode; |
| 1488 | } | 1492 | } |
| 1489 | 1493 | ||
| 1490 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, adp); | 1494 | return avc_has_perm_flags(sid, isec->sid, isec->sclass, perms, adp, flags); |
| 1491 | } | 1495 | } |
| 1492 | 1496 | ||
| 1493 | /* Same as inode_has_perm, but pass explicit audit data containing | 1497 | /* Same as inode_has_perm, but pass explicit audit data containing |
| @@ -1504,7 +1508,7 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
| 1504 | COMMON_AUDIT_DATA_INIT(&ad, FS); | 1508 | COMMON_AUDIT_DATA_INIT(&ad, FS); |
| 1505 | ad.u.fs.path.mnt = mnt; | 1509 | ad.u.fs.path.mnt = mnt; |
| 1506 | ad.u.fs.path.dentry = dentry; | 1510 | ad.u.fs.path.dentry = dentry; |
| 1507 | return inode_has_perm(cred, inode, av, &ad); | 1511 | return inode_has_perm(cred, inode, av, &ad, 0); |
| 1508 | } | 1512 | } |
| 1509 | 1513 | ||
| 1510 | /* Check whether a task can use an open file descriptor to | 1514 | /* Check whether a task can use an open file descriptor to |
| @@ -1540,7 +1544,7 @@ static int file_has_perm(const struct cred *cred, | |||
| 1540 | /* av is zero if only checking access to the descriptor. */ | 1544 | /* av is zero if only checking access to the descriptor. */ |
| 1541 | rc = 0; | 1545 | rc = 0; |
| 1542 | if (av) | 1546 | if (av) |
| 1543 | rc = inode_has_perm(cred, inode, av, &ad); | 1547 | rc = inode_has_perm(cred, inode, av, &ad, 0); |
| 1544 | 1548 | ||
| 1545 | out: | 1549 | out: |
| 1546 | return rc; | 1550 | return rc; |
| @@ -2103,7 +2107,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
| 2103 | file = file_priv->file; | 2107 | file = file_priv->file; |
| 2104 | inode = file->f_path.dentry->d_inode; | 2108 | inode = file->f_path.dentry->d_inode; |
| 2105 | if (inode_has_perm(cred, inode, | 2109 | if (inode_has_perm(cred, inode, |
| 2106 | FILE__READ | FILE__WRITE, NULL)) { | 2110 | FILE__READ | FILE__WRITE, NULL, 0)) { |
| 2107 | drop_tty = 1; | 2111 | drop_tty = 1; |
| 2108 | } | 2112 | } |
| 2109 | } | 2113 | } |
| @@ -2635,7 +2639,7 @@ static int selinux_inode_follow_link(struct dentry *dentry, struct nameidata *na | |||
| 2635 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); | 2639 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); |
| 2636 | } | 2640 | } |
| 2637 | 2641 | ||
| 2638 | static int selinux_inode_permission(struct inode *inode, int mask) | 2642 | static int selinux_inode_permission(struct inode *inode, int mask, unsigned flags) |
| 2639 | { | 2643 | { |
| 2640 | const struct cred *cred = current_cred(); | 2644 | const struct cred *cred = current_cred(); |
| 2641 | struct common_audit_data ad; | 2645 | struct common_audit_data ad; |
| @@ -2657,7 +2661,7 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
| 2657 | 2661 | ||
| 2658 | perms = file_mask_to_av(inode->i_mode, mask); | 2662 | perms = file_mask_to_av(inode->i_mode, mask); |
| 2659 | 2663 | ||
| 2660 | return inode_has_perm(cred, inode, perms, &ad); | 2664 | return inode_has_perm(cred, inode, perms, &ad, flags); |
| 2661 | } | 2665 | } |
| 2662 | 2666 | ||
| 2663 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) | 2667 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) |
| @@ -3205,7 +3209,7 @@ static int selinux_dentry_open(struct file *file, const struct cred *cred) | |||
| 3205 | * new inode label or new policy. | 3209 | * new inode label or new policy. |
| 3206 | * This check is not redundant - do not remove. | 3210 | * This check is not redundant - do not remove. |
| 3207 | */ | 3211 | */ |
| 3208 | return inode_has_perm(cred, inode, open_file_to_av(file), NULL); | 3212 | return inode_has_perm(cred, inode, open_file_to_av(file), NULL, 0); |
| 3209 | } | 3213 | } |
| 3210 | 3214 | ||
| 3211 | /* task security operations */ | 3215 | /* task security operations */ |
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h index 5615081b73e..e77b2ac2908 100644 --- a/security/selinux/include/avc.h +++ b/security/selinux/include/avc.h | |||
| @@ -54,11 +54,11 @@ struct avc_cache_stats { | |||
| 54 | 54 | ||
| 55 | void __init avc_init(void); | 55 | void __init avc_init(void); |
| 56 | 56 | ||
| 57 | void avc_audit(u32 ssid, u32 tsid, | 57 | int avc_audit(u32 ssid, u32 tsid, |
| 58 | u16 tclass, u32 requested, | 58 | u16 tclass, u32 requested, |
| 59 | struct av_decision *avd, | 59 | struct av_decision *avd, |
| 60 | int result, | 60 | int result, |
| 61 | struct common_audit_data *a); | 61 | struct common_audit_data *a, unsigned flags); |
| 62 | 62 | ||
| 63 | #define AVC_STRICT 1 /* Ignore permissive mode. */ | 63 | #define AVC_STRICT 1 /* Ignore permissive mode. */ |
| 64 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, | 64 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, |
| @@ -66,9 +66,17 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
| 66 | unsigned flags, | 66 | unsigned flags, |
| 67 | struct av_decision *avd); | 67 | struct av_decision *avd); |
| 68 | 68 | ||
| 69 | int avc_has_perm(u32 ssid, u32 tsid, | 69 | int avc_has_perm_flags(u32 ssid, u32 tsid, |
| 70 | u16 tclass, u32 requested, | 70 | u16 tclass, u32 requested, |
| 71 | struct common_audit_data *auditdata); | 71 | struct common_audit_data *auditdata, |
| 72 | unsigned); | ||
| 73 | |||
| 74 | static inline int avc_has_perm(u32 ssid, u32 tsid, | ||
| 75 | u16 tclass, u32 requested, | ||
| 76 | struct common_audit_data *auditdata) | ||
| 77 | { | ||
| 78 | return avc_has_perm_flags(ssid, tsid, tclass, requested, auditdata, 0); | ||
| 79 | } | ||
| 72 | 80 | ||
| 73 | u32 avc_policy_seqno(void); | 81 | u32 avc_policy_seqno(void); |
| 74 | 82 | ||
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index c6f8fcadae0..400a5d5cde6 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -686,7 +686,7 @@ static int smack_inode_rename(struct inode *old_inode, | |||
| 686 | * | 686 | * |
| 687 | * Returns 0 if access is permitted, -EACCES otherwise | 687 | * Returns 0 if access is permitted, -EACCES otherwise |
| 688 | */ | 688 | */ |
| 689 | static int smack_inode_permission(struct inode *inode, int mask) | 689 | static int smack_inode_permission(struct inode *inode, int mask, unsigned flags) |
| 690 | { | 690 | { |
| 691 | struct smk_audit_info ad; | 691 | struct smk_audit_info ad; |
| 692 | 692 | ||
| @@ -696,6 +696,10 @@ static int smack_inode_permission(struct inode *inode, int mask) | |||
| 696 | */ | 696 | */ |
| 697 | if (mask == 0) | 697 | if (mask == 0) |
| 698 | return 0; | 698 | return 0; |
| 699 | |||
| 700 | /* May be droppable after audit */ | ||
| 701 | if (flags & IPERM_FLAG_RCU) | ||
| 702 | return -ECHILD; | ||
| 699 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); | 703 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); |
| 700 | smk_ad_setfield_u_fs_inode(&ad, inode); | 704 | smk_ad_setfield_u_fs_inode(&ad, inode); |
| 701 | return smk_curacc(smk_of_inode(inode), mask, &ad); | 705 | return smk_curacc(smk_of_inode(inode), mask, &ad); |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 430f41db604..759ade12e75 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
| @@ -937,6 +937,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec) | |||
| 937 | } | 937 | } |
| 938 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); | 938 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); |
| 939 | 939 | ||
| 940 | #ifdef SND_HDA_NEEDS_RESUME | ||
| 940 | /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ | 941 | /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ |
| 941 | static void restore_shutup_pins(struct hda_codec *codec) | 942 | static void restore_shutup_pins(struct hda_codec *codec) |
| 942 | { | 943 | { |
| @@ -953,6 +954,7 @@ static void restore_shutup_pins(struct hda_codec *codec) | |||
| 953 | } | 954 | } |
| 954 | codec->pins_shutup = 0; | 955 | codec->pins_shutup = 0; |
| 955 | } | 956 | } |
| 957 | #endif | ||
| 956 | 958 | ||
| 957 | static void init_hda_cache(struct hda_cache_rec *cache, | 959 | static void init_hda_cache(struct hda_cache_rec *cache, |
| 958 | unsigned int record_size); | 960 | unsigned int record_size); |
| @@ -1329,6 +1331,7 @@ static void purify_inactive_streams(struct hda_codec *codec) | |||
| 1329 | } | 1331 | } |
| 1330 | } | 1332 | } |
| 1331 | 1333 | ||
| 1334 | #ifdef SND_HDA_NEEDS_RESUME | ||
| 1332 | /* clean up all streams; called from suspend */ | 1335 | /* clean up all streams; called from suspend */ |
| 1333 | static void hda_cleanup_all_streams(struct hda_codec *codec) | 1336 | static void hda_cleanup_all_streams(struct hda_codec *codec) |
| 1334 | { | 1337 | { |
| @@ -1340,6 +1343,7 @@ static void hda_cleanup_all_streams(struct hda_codec *codec) | |||
| 1340 | really_cleanup_stream(codec, p); | 1343 | really_cleanup_stream(codec, p); |
| 1341 | } | 1344 | } |
| 1342 | } | 1345 | } |
| 1346 | #endif | ||
| 1343 | 1347 | ||
| 1344 | /* | 1348 | /* |
| 1345 | * amp access functions | 1349 | * amp access functions |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 52928d9a72d..d3bd2c10180 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -14868,6 +14868,23 @@ static void alc269_fixup_hweq(struct hda_codec *codec, | |||
| 14868 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); | 14868 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 14869 | } | 14869 | } |
| 14870 | 14870 | ||
| 14871 | static void alc271_fixup_dmic(struct hda_codec *codec, | ||
| 14872 | const struct alc_fixup *fix, int action) | ||
| 14873 | { | ||
| 14874 | static struct hda_verb verbs[] = { | ||
| 14875 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | ||
| 14876 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | ||
| 14877 | {} | ||
| 14878 | }; | ||
| 14879 | unsigned int cfg; | ||
| 14880 | |||
| 14881 | if (strcmp(codec->chip_name, "ALC271X")) | ||
| 14882 | return; | ||
| 14883 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); | ||
| 14884 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) | ||
| 14885 | snd_hda_sequence_write(codec, verbs); | ||
| 14886 | } | ||
| 14887 | |||
| 14871 | enum { | 14888 | enum { |
| 14872 | ALC269_FIXUP_SONY_VAIO, | 14889 | ALC269_FIXUP_SONY_VAIO, |
| 14873 | ALC275_FIXUP_SONY_VAIO_GPIO2, | 14890 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
| @@ -14876,6 +14893,7 @@ enum { | |||
| 14876 | ALC269_FIXUP_ASUS_G73JW, | 14893 | ALC269_FIXUP_ASUS_G73JW, |
| 14877 | ALC269_FIXUP_LENOVO_EAPD, | 14894 | ALC269_FIXUP_LENOVO_EAPD, |
| 14878 | ALC275_FIXUP_SONY_HWEQ, | 14895 | ALC275_FIXUP_SONY_HWEQ, |
| 14896 | ALC271_FIXUP_DMIC, | ||
| 14879 | }; | 14897 | }; |
| 14880 | 14898 | ||
| 14881 | static const struct alc_fixup alc269_fixups[] = { | 14899 | static const struct alc_fixup alc269_fixups[] = { |
| @@ -14929,7 +14947,11 @@ static const struct alc_fixup alc269_fixups[] = { | |||
| 14929 | .v.func = alc269_fixup_hweq, | 14947 | .v.func = alc269_fixup_hweq, |
| 14930 | .chained = true, | 14948 | .chained = true, |
| 14931 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 | 14949 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
| 14932 | } | 14950 | }, |
| 14951 | [ALC271_FIXUP_DMIC] = { | ||
| 14952 | .type = ALC_FIXUP_FUNC, | ||
| 14953 | .v.func = alc271_fixup_dmic, | ||
| 14954 | }, | ||
| 14933 | }; | 14955 | }; |
| 14934 | 14956 | ||
| 14935 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | 14957 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| @@ -14938,6 +14960,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 14938 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | 14960 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14939 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 14961 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14940 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 14962 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
| 14963 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), | ||
| 14941 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), | 14964 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
| 14942 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | 14965 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 14943 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | 14966 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index f7cd346fd72..f5ccdbf7ebc 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
| @@ -308,8 +308,6 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) | |||
| 308 | snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes, | 308 | snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes, |
| 309 | ARRAY_SIZE(jz4740_codec_dapm_routes)); | 309 | ARRAY_SIZE(jz4740_codec_dapm_routes)); |
| 310 | 310 | ||
| 311 | snd_soc_dapm_new_widgets(codec); | ||
| 312 | |||
| 313 | jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 311 | jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 314 | 312 | ||
| 315 | return 0; | 313 | return 0; |
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index a54d2a5b28f..4d9fb279e14 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c | |||
| @@ -927,7 +927,7 @@ static struct platform_driver sn95031_codec_driver = { | |||
| 927 | .owner = THIS_MODULE, | 927 | .owner = THIS_MODULE, |
| 928 | }, | 928 | }, |
| 929 | .probe = sn95031_device_probe, | 929 | .probe = sn95031_device_probe, |
| 930 | .remove = sn95031_device_remove, | 930 | .remove = __devexit_p(sn95031_device_remove), |
| 931 | }; | 931 | }; |
| 932 | 932 | ||
| 933 | static int __init sn95031_init(void) | 933 | static int __init sn95031_init(void) |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index ae1cadfae84..f52b623bb69 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
| @@ -247,8 +247,6 @@ static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int re | |||
| 247 | case WM8903_REVISION_NUMBER: | 247 | case WM8903_REVISION_NUMBER: |
| 248 | case WM8903_INTERRUPT_STATUS_1: | 248 | case WM8903_INTERRUPT_STATUS_1: |
| 249 | case WM8903_WRITE_SEQUENCER_4: | 249 | case WM8903_WRITE_SEQUENCER_4: |
| 250 | case WM8903_POWER_MANAGEMENT_3: | ||
| 251 | case WM8903_POWER_MANAGEMENT_2: | ||
| 252 | case WM8903_DC_SERVO_READBACK_1: | 250 | case WM8903_DC_SERVO_READBACK_1: |
| 253 | case WM8903_DC_SERVO_READBACK_2: | 251 | case WM8903_DC_SERVO_READBACK_2: |
| 254 | case WM8903_DC_SERVO_READBACK_3: | 252 | case WM8903_DC_SERVO_READBACK_3: |
| @@ -875,34 +873,40 @@ SND_SOC_DAPM_MIXER("Left Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 1, 0, | |||
| 875 | SND_SOC_DAPM_MIXER("Right Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 0, 0, | 873 | SND_SOC_DAPM_MIXER("Right Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 0, 0, |
| 876 | right_speaker_mixer, ARRAY_SIZE(right_speaker_mixer)), | 874 | right_speaker_mixer, ARRAY_SIZE(right_speaker_mixer)), |
| 877 | 875 | ||
| 878 | SND_SOC_DAPM_PGA_S("Left Headphone Output PGA", 0, WM8903_ANALOGUE_HP_0, | 876 | SND_SOC_DAPM_PGA_S("Left Headphone Output PGA", 0, WM8903_POWER_MANAGEMENT_2, |
| 879 | 4, 0, NULL, 0), | 877 | 1, 0, NULL, 0), |
| 880 | SND_SOC_DAPM_PGA_S("Right Headphone Output PGA", 0, WM8903_ANALOGUE_HP_0, | 878 | SND_SOC_DAPM_PGA_S("Right Headphone Output PGA", 0, WM8903_POWER_MANAGEMENT_2, |
| 881 | 0, 0, NULL, 0), | 879 | 0, 0, NULL, 0), |
| 882 | 880 | ||
| 883 | SND_SOC_DAPM_PGA_S("Left Line Output PGA", 0, WM8903_ANALOGUE_LINEOUT_0, 4, 0, | 881 | SND_SOC_DAPM_PGA_S("Left Line Output PGA", 0, WM8903_POWER_MANAGEMENT_3, 1, 0, |
| 884 | NULL, 0), | 882 | NULL, 0), |
| 885 | SND_SOC_DAPM_PGA_S("Right Line Output PGA", 0, WM8903_ANALOGUE_LINEOUT_0, 0, 0, | 883 | SND_SOC_DAPM_PGA_S("Right Line Output PGA", 0, WM8903_POWER_MANAGEMENT_3, 0, 0, |
| 886 | NULL, 0), | 884 | NULL, 0), |
| 887 | 885 | ||
| 888 | SND_SOC_DAPM_PGA_S("HPL_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 7, 0, NULL, 0), | 886 | SND_SOC_DAPM_PGA_S("HPL_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 7, 0, NULL, 0), |
| 889 | SND_SOC_DAPM_PGA_S("HPL_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 6, 0, NULL, 0), | 887 | SND_SOC_DAPM_PGA_S("HPL_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 6, 0, NULL, 0), |
| 890 | SND_SOC_DAPM_PGA_S("HPL_ENA_DLY", 1, WM8903_ANALOGUE_HP_0, 5, 0, NULL, 0), | 888 | SND_SOC_DAPM_PGA_S("HPL_ENA_DLY", 2, WM8903_ANALOGUE_HP_0, 5, 0, NULL, 0), |
| 889 | SND_SOC_DAPM_PGA_S("HPL_ENA", 1, WM8903_ANALOGUE_HP_0, 4, 0, NULL, 0), | ||
| 891 | SND_SOC_DAPM_PGA_S("HPR_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 3, 0, NULL, 0), | 890 | SND_SOC_DAPM_PGA_S("HPR_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 3, 0, NULL, 0), |
| 892 | SND_SOC_DAPM_PGA_S("HPR_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 2, 0, NULL, 0), | 891 | SND_SOC_DAPM_PGA_S("HPR_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 2, 0, NULL, 0), |
| 893 | SND_SOC_DAPM_PGA_S("HPR_ENA_DLY", 1, WM8903_ANALOGUE_HP_0, 1, 0, NULL, 0), | 892 | SND_SOC_DAPM_PGA_S("HPR_ENA_DLY", 2, WM8903_ANALOGUE_HP_0, 1, 0, NULL, 0), |
| 893 | SND_SOC_DAPM_PGA_S("HPR_ENA", 1, WM8903_ANALOGUE_HP_0, 0, 0, NULL, 0), | ||
| 894 | 894 | ||
| 895 | SND_SOC_DAPM_PGA_S("LINEOUTL_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 7, 0, | 895 | SND_SOC_DAPM_PGA_S("LINEOUTL_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 7, 0, |
| 896 | NULL, 0), | 896 | NULL, 0), |
| 897 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 6, 0, | 897 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 6, 0, |
| 898 | NULL, 0), | 898 | NULL, 0), |
| 899 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_DLY", 1, WM8903_ANALOGUE_LINEOUT_0, 5, 0, | 899 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_DLY", 2, WM8903_ANALOGUE_LINEOUT_0, 5, 0, |
| 900 | NULL, 0), | ||
| 901 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA", 1, WM8903_ANALOGUE_LINEOUT_0, 4, 0, | ||
| 900 | NULL, 0), | 902 | NULL, 0), |
| 901 | SND_SOC_DAPM_PGA_S("LINEOUTR_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 3, 0, | 903 | SND_SOC_DAPM_PGA_S("LINEOUTR_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 3, 0, |
| 902 | NULL, 0), | 904 | NULL, 0), |
| 903 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 2, 0, | 905 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 2, 0, |
| 904 | NULL, 0), | 906 | NULL, 0), |
| 905 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_DLY", 1, WM8903_ANALOGUE_LINEOUT_0, 1, 0, | 907 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_DLY", 2, WM8903_ANALOGUE_LINEOUT_0, 1, 0, |
| 908 | NULL, 0), | ||
| 909 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA", 1, WM8903_ANALOGUE_LINEOUT_0, 0, 0, | ||
| 906 | NULL, 0), | 910 | NULL, 0), |
| 907 | 911 | ||
| 908 | SND_SOC_DAPM_SUPPLY("DCS Master", WM8903_DC_SERVO_0, 4, 0, NULL, 0), | 912 | SND_SOC_DAPM_SUPPLY("DCS Master", WM8903_DC_SERVO_0, 4, 0, NULL, 0), |
| @@ -1037,10 +1041,14 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
| 1037 | { "Left Speaker PGA", NULL, "Left Speaker Mixer" }, | 1041 | { "Left Speaker PGA", NULL, "Left Speaker Mixer" }, |
| 1038 | { "Right Speaker PGA", NULL, "Right Speaker Mixer" }, | 1042 | { "Right Speaker PGA", NULL, "Right Speaker Mixer" }, |
| 1039 | 1043 | ||
| 1040 | { "HPL_ENA_DLY", NULL, "Left Headphone Output PGA" }, | 1044 | { "HPL_ENA", NULL, "Left Headphone Output PGA" }, |
| 1041 | { "HPR_ENA_DLY", NULL, "Right Headphone Output PGA" }, | 1045 | { "HPR_ENA", NULL, "Right Headphone Output PGA" }, |
| 1042 | { "LINEOUTL_ENA_DLY", NULL, "Left Line Output PGA" }, | 1046 | { "HPL_ENA_DLY", NULL, "HPL_ENA" }, |
| 1043 | { "LINEOUTR_ENA_DLY", NULL, "Right Line Output PGA" }, | 1047 | { "HPR_ENA_DLY", NULL, "HPR_ENA" }, |
| 1048 | { "LINEOUTL_ENA", NULL, "Left Line Output PGA" }, | ||
| 1049 | { "LINEOUTR_ENA", NULL, "Right Line Output PGA" }, | ||
| 1050 | { "LINEOUTL_ENA_DLY", NULL, "LINEOUTL_ENA" }, | ||
| 1051 | { "LINEOUTR_ENA_DLY", NULL, "LINEOUTR_ENA" }, | ||
| 1044 | 1052 | ||
| 1045 | { "HPL_DCS", NULL, "DCS Master" }, | 1053 | { "HPL_DCS", NULL, "DCS Master" }, |
| 1046 | { "HPR_DCS", NULL, "DCS Master" }, | 1054 | { "HPR_DCS", NULL, "DCS Master" }, |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 3290333b2bb..84e1bd1d282 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -3261,20 +3261,36 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 3261 | wm8994_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 3261 | wm8994_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 3262 | 3262 | ||
| 3263 | /* Latch volume updates (right only; we always do left then right). */ | 3263 | /* Latch volume updates (right only; we always do left then right). */ |
| 3264 | snd_soc_update_bits(codec, WM8994_AIF1_DAC1_LEFT_VOLUME, | ||
| 3265 | WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); | ||
| 3264 | snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME, | 3266 | snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME, |
| 3265 | WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); | 3267 | WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); |
| 3268 | snd_soc_update_bits(codec, WM8994_AIF1_DAC2_LEFT_VOLUME, | ||
| 3269 | WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU); | ||
| 3266 | snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME, | 3270 | snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME, |
| 3267 | WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU); | 3271 | WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU); |
| 3272 | snd_soc_update_bits(codec, WM8994_AIF2_DAC_LEFT_VOLUME, | ||
| 3273 | WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU); | ||
| 3268 | snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME, | 3274 | snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME, |
| 3269 | WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU); | 3275 | WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU); |
| 3276 | snd_soc_update_bits(codec, WM8994_AIF1_ADC1_LEFT_VOLUME, | ||
| 3277 | WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU); | ||
| 3270 | snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME, | 3278 | snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME, |
| 3271 | WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU); | 3279 | WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU); |
| 3280 | snd_soc_update_bits(codec, WM8994_AIF1_ADC2_LEFT_VOLUME, | ||
| 3281 | WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU); | ||
| 3272 | snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME, | 3282 | snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME, |
| 3273 | WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU); | 3283 | WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU); |
| 3284 | snd_soc_update_bits(codec, WM8994_AIF2_ADC_LEFT_VOLUME, | ||
| 3285 | WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU); | ||
| 3274 | snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME, | 3286 | snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME, |
| 3275 | WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU); | 3287 | WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU); |
| 3288 | snd_soc_update_bits(codec, WM8994_DAC1_LEFT_VOLUME, | ||
| 3289 | WM8994_DAC1_VU, WM8994_DAC1_VU); | ||
| 3276 | snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME, | 3290 | snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME, |
| 3277 | WM8994_DAC1_VU, WM8994_DAC1_VU); | 3291 | WM8994_DAC1_VU, WM8994_DAC1_VU); |
| 3292 | snd_soc_update_bits(codec, WM8994_DAC2_LEFT_VOLUME, | ||
| 3293 | WM8994_DAC2_VU, WM8994_DAC2_VU); | ||
| 3278 | snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME, | 3294 | snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME, |
| 3279 | WM8994_DAC2_VU, WM8994_DAC2_VU); | 3295 | WM8994_DAC2_VU, WM8994_DAC2_VU); |
| 3280 | 3296 | ||
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 7b6b3c18e29..4005e9af5d6 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
| @@ -740,12 +740,12 @@ static const struct snd_soc_dapm_route analogue_routes[] = { | |||
| 740 | 740 | ||
| 741 | { "SPKL", "Input Switch", "MIXINL" }, | 741 | { "SPKL", "Input Switch", "MIXINL" }, |
| 742 | { "SPKL", "IN1LP Switch", "IN1LP" }, | 742 | { "SPKL", "IN1LP Switch", "IN1LP" }, |
| 743 | { "SPKL", "Output Switch", "Left Output Mixer" }, | 743 | { "SPKL", "Output Switch", "Left Output PGA" }, |
| 744 | { "SPKL", NULL, "TOCLK" }, | 744 | { "SPKL", NULL, "TOCLK" }, |
| 745 | 745 | ||
| 746 | { "SPKR", "Input Switch", "MIXINR" }, | 746 | { "SPKR", "Input Switch", "MIXINR" }, |
| 747 | { "SPKR", "IN1RP Switch", "IN1RP" }, | 747 | { "SPKR", "IN1RP Switch", "IN1RP" }, |
| 748 | { "SPKR", "Output Switch", "Right Output Mixer" }, | 748 | { "SPKR", "Output Switch", "Right Output PGA" }, |
| 749 | { "SPKR", NULL, "TOCLK" }, | 749 | { "SPKR", NULL, "TOCLK" }, |
| 750 | 750 | ||
| 751 | { "SPKL Boost", "Direct Voice Switch", "Direct Voice" }, | 751 | { "SPKL Boost", "Direct Voice Switch", "Direct Voice" }, |
| @@ -767,8 +767,8 @@ static const struct snd_soc_dapm_route analogue_routes[] = { | |||
| 767 | { "SPKOUTRP", NULL, "SPKR Driver" }, | 767 | { "SPKOUTRP", NULL, "SPKR Driver" }, |
| 768 | { "SPKOUTRN", NULL, "SPKR Driver" }, | 768 | { "SPKOUTRN", NULL, "SPKR Driver" }, |
| 769 | 769 | ||
| 770 | { "Left Headphone Mux", "Mixer", "Left Output Mixer" }, | 770 | { "Left Headphone Mux", "Mixer", "Left Output PGA" }, |
| 771 | { "Right Headphone Mux", "Mixer", "Right Output Mixer" }, | 771 | { "Right Headphone Mux", "Mixer", "Right Output PGA" }, |
| 772 | 772 | ||
| 773 | { "Headphone PGA", NULL, "Left Headphone Mux" }, | 773 | { "Headphone PGA", NULL, "Left Headphone Mux" }, |
| 774 | { "Headphone PGA", NULL, "Right Headphone Mux" }, | 774 | { "Headphone PGA", NULL, "Right Headphone Mux" }, |
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index b2e9198a983..d567c322a2f 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c | |||
| @@ -116,18 +116,20 @@ struct snd_soc_dai_driver sst_platform_dai[] = { | |||
| 116 | static inline void sst_set_stream_status(struct sst_runtime_stream *stream, | 116 | static inline void sst_set_stream_status(struct sst_runtime_stream *stream, |
| 117 | int state) | 117 | int state) |
| 118 | { | 118 | { |
| 119 | spin_lock(&stream->status_lock); | 119 | unsigned long flags; |
| 120 | spin_lock_irqsave(&stream->status_lock, flags); | ||
| 120 | stream->stream_status = state; | 121 | stream->stream_status = state; |
| 121 | spin_unlock(&stream->status_lock); | 122 | spin_unlock_irqrestore(&stream->status_lock, flags); |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | static inline int sst_get_stream_status(struct sst_runtime_stream *stream) | 125 | static inline int sst_get_stream_status(struct sst_runtime_stream *stream) |
| 125 | { | 126 | { |
| 126 | int state; | 127 | int state; |
| 128 | unsigned long flags; | ||
| 127 | 129 | ||
| 128 | spin_lock(&stream->status_lock); | 130 | spin_lock_irqsave(&stream->status_lock, flags); |
| 129 | state = stream->stream_status; | 131 | state = stream->stream_status; |
| 130 | spin_unlock(&stream->status_lock); | 132 | spin_unlock_irqrestore(&stream->status_lock, flags); |
| 131 | return state; | 133 | return state; |
| 132 | } | 134 | } |
| 133 | 135 | ||
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 38aac7d57a5..9c7e8b48aed 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c | |||
| @@ -350,8 +350,8 @@ static int s3c_pcm_set_fmt(struct snd_soc_dai *cpu_dai, | |||
| 350 | ctl = readl(regs + S3C_PCM_CTL); | 350 | ctl = readl(regs + S3C_PCM_CTL); |
| 351 | 351 | ||
| 352 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 352 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
| 353 | case SND_SOC_DAIFMT_NB_NF: | 353 | case SND_SOC_DAIFMT_IB_NF: |
| 354 | /* Nothing to do, NB_NF by default */ | 354 | /* Nothing to do, IB_NF by default */ |
| 355 | break; | 355 | break; |
| 356 | default: | 356 | default: |
| 357 | dev_err(pcm->dev, "Unsupported clock inversion!\n"); | 357 | dev_err(pcm->dev, "Unsupported clock inversion!\n"); |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 0c9997e2d8c..23c0e83d4c1 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
| @@ -1200,10 +1200,11 @@ static int fsi_probe(struct platform_device *pdev) | |||
| 1200 | master->fsib.master = master; | 1200 | master->fsib.master = master; |
| 1201 | 1201 | ||
| 1202 | pm_runtime_enable(&pdev->dev); | 1202 | pm_runtime_enable(&pdev->dev); |
| 1203 | pm_runtime_resume(&pdev->dev); | ||
| 1204 | dev_set_drvdata(&pdev->dev, master); | 1203 | dev_set_drvdata(&pdev->dev, master); |
| 1205 | 1204 | ||
| 1205 | pm_runtime_get_sync(&pdev->dev); | ||
| 1206 | fsi_soft_all_reset(master); | 1206 | fsi_soft_all_reset(master); |
| 1207 | pm_runtime_put_sync(&pdev->dev); | ||
| 1207 | 1208 | ||
| 1208 | ret = request_irq(irq, &fsi_interrupt, IRQF_DISABLED, | 1209 | ret = request_irq(irq, &fsi_interrupt, IRQF_DISABLED, |
| 1209 | id_entry->name, master); | 1210 | id_entry->name, master); |
| @@ -1218,8 +1219,17 @@ static int fsi_probe(struct platform_device *pdev) | |||
| 1218 | goto exit_free_irq; | 1219 | goto exit_free_irq; |
| 1219 | } | 1220 | } |
| 1220 | 1221 | ||
| 1221 | return snd_soc_register_dais(&pdev->dev, fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); | 1222 | ret = snd_soc_register_dais(&pdev->dev, fsi_soc_dai, |
| 1223 | ARRAY_SIZE(fsi_soc_dai)); | ||
| 1224 | if (ret < 0) { | ||
| 1225 | dev_err(&pdev->dev, "cannot snd dai register\n"); | ||
| 1226 | goto exit_snd_soc; | ||
| 1227 | } | ||
| 1228 | |||
| 1229 | return ret; | ||
| 1222 | 1230 | ||
| 1231 | exit_snd_soc: | ||
| 1232 | snd_soc_unregister_platform(&pdev->dev); | ||
| 1223 | exit_free_irq: | 1233 | exit_free_irq: |
| 1224 | free_irq(irq, master); | 1234 | free_irq(irq, master); |
| 1225 | exit_iounmap: | 1235 | exit_iounmap: |
| @@ -1238,12 +1248,11 @@ static int fsi_remove(struct platform_device *pdev) | |||
| 1238 | 1248 | ||
| 1239 | master = dev_get_drvdata(&pdev->dev); | 1249 | master = dev_get_drvdata(&pdev->dev); |
| 1240 | 1250 | ||
| 1241 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai)); | 1251 | free_irq(master->irq, master); |
| 1242 | snd_soc_unregister_platform(&pdev->dev); | ||
| 1243 | |||
| 1244 | pm_runtime_disable(&pdev->dev); | 1252 | pm_runtime_disable(&pdev->dev); |
| 1245 | 1253 | ||
| 1246 | free_irq(master->irq, master); | 1254 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai)); |
| 1255 | snd_soc_unregister_platform(&pdev->dev); | ||
| 1247 | 1256 | ||
| 1248 | iounmap(master->base); | 1257 | iounmap(master->base); |
| 1249 | kfree(master); | 1258 | kfree(master); |
| @@ -1321,3 +1330,4 @@ module_exit(fsi_mobile_exit); | |||
| 1321 | MODULE_LICENSE("GPL"); | 1330 | MODULE_LICENSE("GPL"); |
| 1322 | MODULE_DESCRIPTION("SuperH onchip FSI audio driver"); | 1331 | MODULE_DESCRIPTION("SuperH onchip FSI audio driver"); |
| 1323 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); | 1332 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); |
| 1333 | MODULE_ALIAS("platform:fsi-pcm-audio"); | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b76b74db096..d8562ce4de7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -629,6 +629,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
| 629 | runtime->hw.rates |= codec_dai_drv->capture.rates; | 629 | runtime->hw.rates |= codec_dai_drv->capture.rates; |
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | ret = -EINVAL; | ||
| 632 | snd_pcm_limit_hw_rates(runtime); | 633 | snd_pcm_limit_hw_rates(runtime); |
| 633 | if (!runtime->hw.rates) { | 634 | if (!runtime->hw.rates) { |
| 634 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", | 635 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", |
| @@ -640,7 +641,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
| 640 | codec_dai->name, cpu_dai->name); | 641 | codec_dai->name, cpu_dai->name); |
| 641 | goto config_err; | 642 | goto config_err; |
| 642 | } | 643 | } |
| 643 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { | 644 | if (!runtime->hw.channels_min || !runtime->hw.channels_max || |
| 645 | runtime->hw.channels_min > runtime->hw.channels_max) { | ||
| 644 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", | 646 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", |
| 645 | codec_dai->name, cpu_dai->name); | 647 | codec_dai->name, cpu_dai->name); |
| 646 | goto config_err; | 648 | goto config_err; |
| @@ -2060,6 +2062,7 @@ const struct dev_pm_ops snd_soc_pm_ops = { | |||
| 2060 | .resume = snd_soc_resume, | 2062 | .resume = snd_soc_resume, |
| 2061 | .poweroff = snd_soc_poweroff, | 2063 | .poweroff = snd_soc_poweroff, |
| 2062 | }; | 2064 | }; |
| 2065 | EXPORT_SYMBOL_GPL(snd_soc_pm_ops); | ||
| 2063 | 2066 | ||
| 2064 | /* ASoC platform driver */ | 2067 | /* ASoC platform driver */ |
| 2065 | static struct platform_driver soc_driver = { | 2068 | static struct platform_driver soc_driver = { |
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c index 8585957477e..556a5713392 100644 --- a/sound/soc/tegra/harmony.c +++ b/sound/soc/tegra/harmony.c | |||
| @@ -370,6 +370,7 @@ static struct platform_driver tegra_snd_harmony_driver = { | |||
| 370 | .driver = { | 370 | .driver = { |
| 371 | .name = DRV_NAME, | 371 | .name = DRV_NAME, |
| 372 | .owner = THIS_MODULE, | 372 | .owner = THIS_MODULE, |
| 373 | .pm = &snd_soc_pm_ops, | ||
| 373 | }, | 374 | }, |
| 374 | .probe = tegra_snd_harmony_probe, | 375 | .probe = tegra_snd_harmony_probe, |
| 375 | .remove = __devexit_p(tegra_snd_harmony_remove), | 376 | .remove = __devexit_p(tegra_snd_harmony_remove), |
