--- v4
+++ v2
@@ -6,14 +6,17 @@
sysfs operations are skipped while the code remains buildable and
type-checked.
+v2:
+- Replace CONFIG_FB_DEVICE ifdefs with runtime checks
+- Use dev_of_fbinfo() to guard sysfs creation and removal
+
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Suggested-by: Helge Deller <deller@gmx.de>
-Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
drivers/staging/fbtft/Kconfig | 5 ++++-
- drivers/staging/fbtft/fbtft-sysfs.c | 20 ++++++++++++++++----
- 2 files changed, 20 insertions(+), 5 deletions(-)
+ drivers/staging/fbtft/fbtft-sysfs.c | 18 ++++++++++++++----
+ 2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index c2655768209a..578412a2f379 100644
@@ -36,17 +39,16 @@
if FB_TFT
diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
-index e45c90a03a90..d05599d80011 100644
+index e45c90a03a90..848702fc871a 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
-@@ -203,14 +203,26 @@ static struct device_attribute debug_device_attr =
+@@ -203,14 +203,24 @@ static struct device_attribute debug_device_attr =
void fbtft_sysfs_init(struct fbtft_par *par)
{
- device_create_file(par->info->dev, &debug_device_attr);
-+ struct device *dev;
++ struct device *dev = dev_of_fbinfo(par->info);
+
-+ dev = dev_of_fbinfo(par->info);
+ if (!dev)
+ return;
+
@@ -59,9 +61,8 @@
void fbtft_sysfs_exit(struct fbtft_par *par)
{
- device_remove_file(par->info->dev, &debug_device_attr);
-+ struct device *dev;
++ struct device *dev = dev_of_fbinfo(par->info);
+
-+ dev = dev_of_fbinfo(par->info);
+ if (!dev)
+ return;
+