From 76aa861bac39a0aa2ae7e53743d3ba78ba7e7049 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Thu, 17 Nov 2011 17:20:40 -0500 Subject: [PATCH] compat: add CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP Some kernels have versions of (struct bin_attribute)->{read,write} that require a struct file * as their first argument. This change accommodates them in the firmware loader class. Signed-off-by: John W. Linville Signed-off-by: Luis R. Rodriguez --- compat/compat_firmware_class.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compat/compat_firmware_class.c b/compat/compat_firmware_class.c index 79cd543..4eb5ba7 100644 --- a/compat/compat_firmware_class.c +++ b/compat/compat_firmware_class.c @@ -314,9 +314,15 @@ static ssize_t firmware_loading_store(struct device *dev, static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); +#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP) +static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buffer, loff_t offset, size_t count) +#else static ssize_t firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) +#endif { struct device *dev = to_dev(kobj); struct firmware_priv *fw_priv = to_firmware_priv(dev); @@ -407,9 +413,15 @@ static int fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) * Data written to the 'data' attribute will be later handed to * the driver as a firmware image. **/ +#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP) +static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buffer, loff_t offset, size_t count) +#else static ssize_t firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr, char *buffer, loff_t offset, size_t count) +#endif { struct device *dev = to_dev(kobj); struct firmware_priv *fw_priv = to_firmware_priv(dev); -- 2.41.0