drm/tiny/repaper: Make driver OF-independent
PATCH 1/4 drm/tiny/repaper: Make driver OF-independent
There is one OF call in the driver that limits its area of use. Replace it to generic device_get_match_data() and get rid of OF dependency.
While here, cast SPI driver data to certain enumerator type.
--- drivers/gpu/drm/tiny/repaper.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/tiny/repaper.c +6 -5
@@ -17,7 +17,7 @@#include <linux/dma-buf.h> #include <linux/gpio/consumer.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/property.h> #include <linux/sched/clock.h> #include <linux/spi/spi.h> #include <linux/thermal.h>
@@ -40,6 +40,7 @@#define REPAPER_RID_G2_COG_ID 0x12enum repaper_model { +EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 ,E2200CS021 ,
@@ -995,21 +996,21 @@ static int repaper_probe(struct spi_device *spi) {const struct drm_display_mode *mode;const struct spi_device_id *spi_id; -const struct of_device_id *match;struct device *dev = &spi->dev;enum repaper_model model;const char *thermal_zone;struct repaper_epd *epd;size_t line_buffer_size;struct drm_device *drm; +const void *match;int ret; - match =of_match_device (repaper_of_match, dev); + match =device_get_match_data (dev);if (match) { - model = (enum repaper_model )match->data; + model = (enum repaper_model )match; }else { spi_id =spi_get_device_id (spi); - model = spi_id->driver_data; + model = (enum repaper_model )spi_id->driver_data; }/* The SPI device is used to allocate dma memory */
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/4 drm/tiny/repaper: No need to set ->owner for spi_register_driver()
The spi_register_driver() will set the ->owner member to THIS_MODULE.
--- drivers/gpu/drm/tiny/repaper.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/tiny/repaper.c +0 -1
@@ -1198,7 +1198,6 @@ static void repaper_shutdown(struct spi_device *spi)static struct spi_driver repaper_spi_driver = { .driver = { .name ="repaper" , - .owner =THIS_MODULE , .of_match_table = repaper_of_match, }, .id_table = repaper_id,
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 2/4] drm/tiny/repaper: No need to set ->owner for spi_register_driver()
Quoted 4 lines · Andy Shevchenko
The
spi_register_driver()will set the ->owner member toTHIS_MODULE.Signed-off-by Andy Shevchenko <[email protected]>---
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 2/4] drm/tiny/repaper: No need to set ->owner for spi_register_driver()
In reply to Andy ShevchenkoHi Andy.
Quoted 3 lines · Andy Shevchenko
The
spi_register_driver()will set the ->owner member toTHIS_MODULE.Signed-off-by Andy Shevchenko <[email protected]>
Any chance you will update the remaining 3 drivers in drm/tiny/ that has the same unessesary assignment?
Sam
Quoted 23 lines
--- drivers/gpu/drm/tiny/repaper.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/tiny/repaper.c +0
-1@@ -1198,7 +1198,6 @@ static void repaper_shutdown(struct spi_device *spi)static struct spi_driver repaper_spi_driver = { .driver = { .name ="repaper" , - .owner =THIS_MODULE , .of_match_table = repaper_of_match, }, .id_table = repaper_id,Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 2/4] drm/tiny/repaper: No need to set ->owner for spi_register_driver()
Quoted 8 lines · Sam Ravnborg
Hi Andy.
Quoted 3 lines · Andy Shevchenko
The
spi_register_driver()will set the ->owner member toTHIS_MODULE.Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Sam Ravnborg <[email protected]>
Thanks.
Quoted 2 lines
Any chance you will update the remaining 3 drivers in drm/tiny/ that has the same unessesary assignment?
Maybe.
Signature · 8 lines
With Best Regards, Andy Shevchenko _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/4 drm/tiny/st7735r: Make driver OF-independent
In reply to Andy ShevchenkoThere is one OF call in the driver that limits its area of use. Replace it to generic device_get_match_data() and get rid of OF dependency.
--- drivers/gpu/drm/tiny/st7735r.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/tiny/st7735r.c +1 -2
@@ -12,7 +12,6 @@#include <linux/dma-buf.h> #include <linux/gpio/consumer.h> #include <linux/module.h> -#include <linux/of_device.h> #include <linux/property.h> #include <linux/spi/spi.h> #include <video/mipi_display.h>
@@ -192,7 +191,7 @@ static int st7735r_probe(struct spi_device *spi)u32 rotation =0 ;int ret; - cfg =of_device_get_match_data (&spi->dev); + cfg =device_get_match_data (&spi->dev);if (!cfg) cfg = (void *)spi_get_device_id (spi)->driver_data;
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 3/4] drm/tiny/st7735r: Make driver OF-independent
Quoted 5 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.Signed-off-by Andy Shevchenko <[email protected]>---
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/4 drm/tiny/st7735r: No need to set ->owner for spi_register_driver()
In reply to Andy ShevchenkoThe spi_register_driver() will set the ->owner member to THIS_MODULE.
--- drivers/gpu/drm/tiny/st7735r.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/tiny/st7735r.c +0 -1
@@ -276,7 +276,6 @@ static void st7735r_shutdown(struct spi_device *spi)static struct spi_driver st7735r_spi_driver = { .driver = { .name ="st7735r" , - .owner =THIS_MODULE , .of_match_table = st7735r_of_match, }, .id_table = st7735r_id,
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 4/4] drm/tiny/st7735r: No need to set ->owner for spi_register_driver()
Quoted 4 lines · Andy Shevchenko
The
spi_register_driver()will set the ->owner member toTHIS_MODULE.Signed-off-by Andy Shevchenko <[email protected]>---
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v1 4/4] drm/tiny/st7735r: No need to set ->owner for spi_register_driver()
Quoted 6 lines · David Lechner
Quoted 4 lines · Andy Shevchenko
The
spi_register_driver()will set the ->owner member toTHIS_MODULE.Signed-off-by Andy Shevchenko <[email protected]>---
Reviewed-by David Lechner <[email protected]>
Btw to avoid confusion: Since your committer (and work in this area) everyone else will assume you're going to push this. If not, then you have to be explicit about that (or the patch will simply get lost). But best is you just go ahead and push it.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Andy.
Quoted 24 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.While here, cast SPI driver data to certain enumerator type.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpu/drm/tiny/repaper.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/gpu/drm/tiny/repaper.c +1
-1@@ -17,7 +17,7 @@#include <linux/dma-buf.h> #include <linux/gpio/consumer.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/property.h> #include <linux/sched/clock.h> #include <linux/spi/spi.h> #include <linux/thermal.h>
drivers/gpu/drm/tiny/repaper.c line 46
Quoted 7 lines
drivers/gpu/drm/tiny/repaper.c +1
-0@@ -40,6 +40,7 @@#define REPAPER_RID_G2_COG_ID 0x12enum repaper_model { +EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 ,E2200CS021 ,
The new enum value is not used in the following - is it necessary?
Sam
Quoted 33 lines
drivers/gpu/drm/tiny/repaper.c +4
-4@@ -995,21 +996,21 @@ static int repaper_probe(struct spi_device *spi) {const struct drm_display_mode *mode;const struct spi_device_id *spi_id; -const struct of_device_id *match;struct device *dev = &spi->dev;enum repaper_model model;const char *thermal_zone;struct repaper_epd *epd;size_t line_buffer_size;struct drm_device *drm; +const void *match;int ret; - match =of_match_device (repaper_of_match, dev); + match =device_get_match_data (dev);if (match) { - model = (enum repaper_model )match->data; + model = (enum repaper_model )match; }else { spi_id =spi_get_device_id (spi); - model = spi_id->driver_data; + model = (enum repaper_model )spi_id->driver_data; }/* The SPI device is used to allocate dma memory */ Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Sam Ravnborg
Quoted 3 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.
Quoted 8 lines
drivers/gpu/drm/tiny/repaper.c line 46
Quoted 7 lines
While here, cast SPI driver data to certain enumerator type.
enum
repaper_model{drivers/gpu/drm/tiny/repaper.c +1
-0+EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 , E2200CS021,The new enum value is not used in the following - is it necessary?
Yes. It explicitly prevents to use 0 for real device.
This is due to device_get_match_data() returns content of data pointer and thus we may not distinguish 0 from NULL pointer.
Signature · 8 lines
With Best Regards, Andy Shevchenko _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sam Ravnborg
Reviewed-byHi Andy.
Quoted 14 lines · Andy Shevchenko
Quoted 4 lines · Sam Ravnborg
Quoted 3 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.Quoted 8 lines
drivers/gpu/drm/tiny/repaper.c line 46
Quoted 7 lines
While here, cast SPI driver data to certain enumerator type.
enum
repaper_model{drivers/gpu/drm/tiny/repaper.c +1
-0+EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 , E2200CS021,The new enum value is not used in the following - is it necessary?
Quoted 4 lines
Yes. It explicitly prevents to use 0 for real device.
This is due to
device_get_match_data()returns content of data pointer and thus we may not distinguish 0 from NULL pointer.
A name that told this was not a valid name would be descriptive. As it is now it looks like a wildcard that matches everythign else.
With a more descriptive name:
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Sam Ravnborg
Quoted 14 lines · Andy Shevchenko
Quoted 12 lines · Sam Ravnborg
drivers/gpu/drm/tiny/repaper.c line 46
Quoted 10 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.While here, cast SPI driver data to certain enumerator type.
enum
repaper_model{drivers/gpu/drm/tiny/repaper.c +1
-0+EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 , E2200CS021,The new enum value is not used in the following - is it necessary?
Quoted 6 lines
Quoted 4 lines
Yes. It explicitly prevents to use 0 for real device.
This is due to
device_get_match_data()returns content of data pointer and thus we may not distinguish 0 from NULL pointer.A name that told this was not a valid name would be descriptive. As it is now it looks like a wildcard that matches everythign else.
Can you be more precise what you would like to see? Perhaps simple comment will help?
Quoted 2 lines
With a more descriptive name:
Reviewed-by Sam Ravnborg <[email protected]>
Signature · 8 lines
With Best Regards, Andy Shevchenko _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Andy.
Quoted 18 lines · Andy Shevchenko
Quoted 17 lines · Sam Ravnborg
Quoted 16 lines · Andy Shevchenko
Quoted 4 lines · Sam Ravnborg
Quoted 3 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.Quoted 8 lines
drivers/gpu/drm/tiny/repaper.c line 46
Quoted 7 lines
While here, cast SPI driver data to certain enumerator type.
enum
repaper_model{drivers/gpu/drm/tiny/repaper.c +1
-0+EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 , E2200CS021,The new enum value is not used in the following - is it necessary?
Yes. It explicitly prevents to use 0 for real device.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
This is due to
device_get_match_data()returns content of data pointer and thus we may not distinguish 0 from NULL pointer.A name that told this was not a valid name would be descriptive. As it is now it looks like a wildcard that matches everythign else.
Can you be more precise what you would like to see? Perhaps simple comment will help?
Maybe just add something like:
/* 0 is reserved to avoid clashing with NULL */
And then skip the, at least to my eyes, cryptic EXXXXCSXXX. Up to you.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 24 lines · Sam Ravnborg
Quoted 23 lines · Andy Shevchenko
Quoted 21 lines · Sam Ravnborg
Quoted 14 lines · Andy Shevchenko
Quoted 4 lines · Sam Ravnborg
Quoted 3 lines · Andy Shevchenko
There is one OF call in the driver that limits its area of use. Replace it to generic
device_get_match_data()and get rid of OF dependency.Quoted 8 lines
drivers/gpu/drm/tiny/repaper.c line 46
Quoted 7 lines
While here, cast SPI driver data to certain enumerator type.
enum
repaper_model{drivers/gpu/drm/tiny/repaper.c +1
-0+EXXXXCSXXX =0 ,E1144CS021 =1 ,E1190CS021 , E2200CS021,The new enum value is not used in the following - is it necessary?
Quoted 4 lines
Yes. It explicitly prevents to use 0 for real device.
This is due to
device_get_match_data()returns content of data pointer and thus we may not distinguish 0 from NULL pointer.A name that told this was not a valid name would be descriptive. As it is now it looks like a wildcard that matches everythign else.
Quoted 8 lines
Quoted 2 lines
Can you be more precise what you would like to see? Perhaps simple comment will help?
Maybe just add something like:
/* 0 is reserved to avoid clashing with NULL */And then skip the, at least to my eyes, cryptic EXXXXCSXXX. Up to you.
Fine with me, I'll update accordingly.
Thanks!
Signature · 8 lines
With Best Regards, Andy Shevchenko _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel