diff mbox

[08/21] header: backport devm_acpi_dev_add_driver_gpios()

Message ID 20170821222817.17376-9-hauke@hauke-m.de (mailing list archive)
State Accepted
Headers show

Commit Message

Hauke Mehrtens Aug. 21, 2017, 10:28 p.m. UTC
This is used by some NFC drivers to get information from the ACPI.
This was added in kernel 4.13, but backporting it to older kernel
versions than 3.19 is hard because such old kernel versions do not even
have struct acpi_gpio_mapping. This only adds the empty version of this
function as this normally needed some extra support in the generic ACPI
code and I do not care about this functionality.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/acpi.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Johannes Berg Sept. 6, 2017, 3:01 p.m. UTC | #1
On Tue, 2017-08-22 at 00:28 +0200, Hauke Mehrtens wrote:
> This is used by some NFC drivers to get information from the ACPI.
> This was added in kernel 4.13, but backporting it to older kernel
> versions than 3.19 is hard because such old kernel versions do not
> even
> have struct acpi_gpio_mapping. This only adds the empty version of
> this
> function as this normally needed some extra support in the generic
> ACPI
> code and I do not care about this functionality.


> +#if LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0)

This I don't understand - you said it's hard to do for <3.19, and then
make a simple no-op for all, but don't do it for <3.19 at all?

Why not just LINUX_VERION_LESS(4,13,0)?

> +#define devm_acpi_dev_add_driver_gpios
> LINUX_BACKPORT(devm_acpi_dev_add_driver_gpios)
> +static inline int devm_acpi_dev_add_driver_gpios(struct device *dev,
> +			      const struct acpi_gpio_mapping *gpios)
> +{
> +	return -ENXIO;
> +}
> +#endif /* LINUX_VERSION_IN_RANGE(4,19,0, 4,13,0) */

Also, typo here.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Hauke Mehrtens Sept. 6, 2017, 9:58 p.m. UTC | #2
On 09/06/2017 05:01 PM, Johannes Berg wrote:
> On Tue, 2017-08-22 at 00:28 +0200, Hauke Mehrtens wrote:
>> This is used by some NFC drivers to get information from the ACPI.
>> This was added in kernel 4.13, but backporting it to older kernel
>> versions than 3.19 is hard because such old kernel versions do not
>> even
>> have struct acpi_gpio_mapping. This only adds the empty version of
>> this
>> function as this normally needed some extra support in the generic
>> ACPI
>> code and I do not care about this functionality.
> 
> 
>> +#if LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0)
> 
> This I don't understand - you said it's hard to do for <3.19, and then
> make a simple no-op for all, but don't do it for <3.19 at all?
> 
> Why not just LINUX_VERION_LESS(4,13,0)?

struct acpi_gpio_mapping was added to kernel 3.19. We could add here a
dummy struct acpi_gpio_mapping, but the drivers anyway need more
adjustments to compile properly.

>> +#define devm_acpi_dev_add_driver_gpios
>> LINUX_BACKPORT(devm_acpi_dev_add_driver_gpios)
>> +static inline int devm_acpi_dev_add_driver_gpios(struct device *dev,
>> +			      const struct acpi_gpio_mapping *gpios)
>> +{
>> +	return -ENXIO;
>> +}
>> +#endif /* LINUX_VERSION_IN_RANGE(4,19,0, 4,13,0) */

This should be
+#endif /* LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0) */

> 
> Also, typo here.
> 
> johannes
> --
> To unsubscribe from this list: send the line "unsubscribe backports" in
> 

--
To unsubscribe from this list: send the line "unsubscribe backports" in
Johannes Berg Sept. 8, 2017, 9:25 a.m. UTC | #3
On Wed, 2017-09-06 at 23:58 +0200, Hauke Mehrtens wrote:
> 
> > This I don't understand - you said it's hard to do for <3.19, and
> > then
> > make a simple no-op for all, but don't do it for <3.19 at all?
> > 
> > Why not just LINUX_VERION_LESS(4,13,0)?
> 
> struct acpi_gpio_mapping was added to kernel 3.19. We could add here
> a dummy struct acpi_gpio_mapping, but the drivers anyway need more
> adjustments to compile properly.

Ok.

> > > +#define devm_acpi_dev_add_driver_gpios
> > > LINUX_BACKPORT(devm_acpi_dev_add_driver_gpios)
> > > +static inline int devm_acpi_dev_add_driver_gpios(struct device
> > > *dev,
> > > +			      const struct acpi_gpio_mapping
> > > *gpios)
> > > +{
> > > +	return -ENXIO;
> > > +}
> > > +#endif /* LINUX_VERSION_IN_RANGE(4,19,0, 4,13,0) */
> 
> This should be
> +#endif /* LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0) */

Right. I'll fix this and apply then.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Johannes Berg Sept. 8, 2017, 9:28 a.m. UTC | #4
On Fri, 2017-09-08 at 11:25 +0200, Johannes Berg wrote:
> 
> Right. I'll fix this and apply then.

Heh, turns out I accidentally applied it already anyway - so I just
fixed the version thing then.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
diff mbox

Patch

diff --git a/backport/backport-include/linux/acpi.h b/backport/backport-include/linux/acpi.h
index c63648b6..fe183626 100644
--- a/backport/backport-include/linux/acpi.h
+++ b/backport/backport-include/linux/acpi.h
@@ -60,4 +60,13 @@  static inline struct acpi_device *_acpi_get_companion(struct device *dev)
 static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {}
 #endif /* LINUX_VERSION_IS_LESS(3, 19, 0) */
 
+#if LINUX_VERSION_IN_RANGE(3,19,0, 4,13,0)
+#define devm_acpi_dev_add_driver_gpios LINUX_BACKPORT(devm_acpi_dev_add_driver_gpios)
+static inline int devm_acpi_dev_add_driver_gpios(struct device *dev,
+			      const struct acpi_gpio_mapping *gpios)
+{
+	return -ENXIO;
+}
+#endif /* LINUX_VERSION_IN_RANGE(4,19,0, 4,13,0) */
+
 #endif /* __BACKPORT_LINUX_ACPI_H */