backlight: hx8357: Add SPI device ID table
Subsystems (2)
PATCH 1/1 backlight: hx8357: Add SPI device ID table
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding a SPI device ID table.
--- drivers/video/backlight/hx8357.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/video/backlight/hx8357.c +14 -0
@@ -565,6 +565,19 @@ static struct lcd_ops hx8357_ops = { .get_power = hx8357_get_power, }; +static const struct spi_device_id hx8357_spi_ids[] = { + { + .name ="hx8357" , + .driver_data = (kernel_ulong_t )hx8357_lcd_init, + }, + { + .name ="hx8369" , + .driver_data = (kernel_ulong_t )hx8369_lcd_init, + }, + {}, +}; +MODULE_DEVICE_TABLE (spi, hx8357_spi_ids); +static const struct of_device_id hx8357_dt_ids[] = { { .compatible ="himax,hx8357" ,
@@ -672,6 +685,7 @@ static struct spi_driver hx8357_driver = { .name = "hx8357", .of_match_table = hx8357_dt_ids, }, + .id_table = hx8357_spi_ids, };module_spi_driver (hx8357_driver);
Signature · 1 line
2.20.1
Quoted 16 lines · Mark Brown
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding a SPI device ID table.
Fixes 96c8395e2166 ("spi: Revert modalias changes")Signed-off-by Mark Brown <[email protected]>--- drivers/video/backlight/hx8357.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/video/backlight/hx8357.c +0
-0
drivers/video/backlight/hx8357.c static struct lcd_ops hx8357_ops = { · line 571
Quoted 7 lines
drivers/video/backlight/hx8357.c +4
-0@@ -565,6 +565,19 @@ static struct lcd_ops hx8357_ops = { .get_power = hx8357_get_power, }; +static const struct spi_device_id hx8357_spi_ids[] = { + { + .name ="hx8357" , + .driver_data = (kernel_ulong_t )hx8357_lcd_init,
Based on this I had expected to find spi_get_device_id() and a ->driver_data somewhere in this patch.
Where will this .driver_data be consumed?
Daniel.
Quoted 23 lines
drivers/video/backlight/hx8357.c +10
-0+ }, + { + .name = "hx8369", + .driver_data = (kernel_ulong_t)hx8369_lcd_init, + }, + {}, +}; +MODULE_DEVICE_TABLE (spi, hx8357_spi_ids); +static const struct of_device_id hx8357_dt_ids[] = { { .compatible ="himax,hx8357" ,@@ -672,6 +685,7 @@ static struct spi_driver hx8357_driver = { .name = "hx8357", .of_match_table = hx8357_dt_ids, }, + .id_table = hx8357_spi_ids, };module_spi_driver (hx8357_driver);Signature · 1 line
2.20.1
Quoted 4 lines · Daniel Thompson
Based on this I had expected to find
spi_get_device_id()and a ->driver_data somewhere in this patch.Where will this .driver_data be consumed?
It will never be consumed unless someone writes a board file - the runtime match will still happen based on the DT compatible, this is only there for the modalias.
Quoted 10 lines · Mark Brown
Quoted 4 lines · Daniel Thompson
Based on this I had expected to find
spi_get_device_id()and a ->driver_data somewhere in this patch.Where will this .driver_data be consumed?
It will never be consumed unless someone writes a board file - the runtime match will still happen based on the DT compatible, this is only there for the modalias.
Ok... so I'm not going mad.
In that case what is the point of including unconsumed driver data? Most DT centric drivers that included this for modalias reasons leave it NULL.
I reviewed quite a few drivers this morning and I haven't seen a single one that includes unreachable driver data in this manner. Unless there's a good reason I'd prefer backlight to follow the prior art!
Daniel.
Quoted 3 lines · Daniel Thompson
In that case what is the point of including unconsumed driver data? Most DT centric drivers that included this for modalias reasons leave it NULL.
It's mainly there because it's generated fairly mechanically from the OF ID table - there's no great reason for it to be there while all instantiation is done via DT.
Quoted 9 lines · Mark Brown
Quoted 3 lines · Daniel Thompson
In that case what is the point of including unconsumed driver data? Most DT centric drivers that included this for modalias reasons leave it NULL.
It's mainly there because it's generated fairly mechanically from the OF ID table - there's no great reason for it to be there while all instantiation is done via DT.
Ok. If there's no plan to change the driver to pick it up from the table then let's remove the redundant values. They just make it look like somebody forgot something in the probe method (instead of it being a deliberate choice).
Daniel.