diff mbox series

media: i2c: thp7312: select CONFIG_FW_LOADER

Message ID 20240103155811.4092035-1-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series media: i2c: thp7312: select CONFIG_FW_LOADER | expand

Commit Message

Arnd Bergmann Jan. 3, 2024, 3:58 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The recently added driver uses the firmware loader mechanism but causes
a link failure when that is in a loadable module while thp7312 itself
is built-in:

arm-linux-gnueabi-ld: drivers/media/i2c/thp7312.o: in function `thp7312_probe':
thp7312.c:(.text+0x4164): undefined reference to `firmware_upload_register'

Select the required Kconfig symbol. Note that the driver specifically
needs the firmware upload interface that is controlled by CONFIG_FW_UPLOAD,
but there is no link failure when that is disabled because the interfaces
are stubbed out here.

Fixes: 7a52ab415b43 ("media: i2c: Add driver for THine THP7312")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/i2c/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurent Pinchart Jan. 3, 2024, 5:48 p.m. UTC | #1
Hi Arnd,

Thank you for the patch.

On Wed, Jan 03, 2024 at 04:58:05PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The recently added driver uses the firmware loader mechanism but causes
> a link failure when that is in a loadable module while thp7312 itself
> is built-in:
> 
> arm-linux-gnueabi-ld: drivers/media/i2c/thp7312.o: in function `thp7312_probe':
> thp7312.c:(.text+0x4164): undefined reference to `firmware_upload_register'
> 
> Select the required Kconfig symbol. Note that the driver specifically
> needs the firmware upload interface that is controlled by CONFIG_FW_UPLOAD,
> but there is no link failure when that is disabled because the interfaces
> are stubbed out here.
> 
> Fixes: 7a52ab415b43 ("media: i2c: Add driver for THine THP7312")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I've posted a similar fix yesterday, see
https://lore.kernel.org/linux-media/20240102074518.24968-1-laurent.pinchart@ideasonboard.com

What approach do you think is best ?

> ---
>  drivers/media/i2c/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 78a87331686e..4c3435921f19 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -674,6 +674,7 @@ menu "Camera ISPs"
>  config VIDEO_THP7312
>  	tristate "THine THP7312 support"
>  	depends on I2C
> +	select FW_LOADER
>  	select MEDIA_CONTROLLER
>  	select V4L2_CCI_I2C
>  	select V4L2_FWNODE
Randy Dunlap Jan. 3, 2024, 8:06 p.m. UTC | #2
On 1/3/24 09:48, Laurent Pinchart wrote:
> Hi Arnd,
> 
> Thank you for the patch.
> 
> On Wed, Jan 03, 2024 at 04:58:05PM +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> The recently added driver uses the firmware loader mechanism but causes
>> a link failure when that is in a loadable module while thp7312 itself
>> is built-in:
>>
>> arm-linux-gnueabi-ld: drivers/media/i2c/thp7312.o: in function `thp7312_probe':
>> thp7312.c:(.text+0x4164): undefined reference to `firmware_upload_register'
>>
>> Select the required Kconfig symbol. Note that the driver specifically
>> needs the firmware upload interface that is controlled by CONFIG_FW_UPLOAD,
>> but there is no link failure when that is disabled because the interfaces
>> are stubbed out here.
>>
>> Fixes: 7a52ab415b43 ("media: i2c: Add driver for THine THP7312")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> I've posted a similar fix yesterday, see
> https://lore.kernel.org/linux-media/20240102074518.24968-1-laurent.pinchart@ideasonboard.com
> 
> What approach do you think is best ?

By far the dominant use of FW_LOADER is to select it instead of depend on it,
so I prefer Arnd's patch.

> 
>> ---
>>  drivers/media/i2c/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
>> index 78a87331686e..4c3435921f19 100644
>> --- a/drivers/media/i2c/Kconfig
>> +++ b/drivers/media/i2c/Kconfig
>> @@ -674,6 +674,7 @@ menu "Camera ISPs"
>>  config VIDEO_THP7312
>>  	tristate "THine THP7312 support"
>>  	depends on I2C
>> +	select FW_LOADER
>>  	select MEDIA_CONTROLLER
>>  	select V4L2_CCI_I2C
>>  	select V4L2_FWNODE
>
Laurent Pinchart Jan. 3, 2024, 9:07 p.m. UTC | #3
On Wed, Jan 03, 2024 at 12:06:33PM -0800, Randy Dunlap wrote:
> On 1/3/24 09:48, Laurent Pinchart wrote:
> > On Wed, Jan 03, 2024 at 04:58:05PM +0100, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> The recently added driver uses the firmware loader mechanism but causes
> >> a link failure when that is in a loadable module while thp7312 itself
> >> is built-in:
> >>
> >> arm-linux-gnueabi-ld: drivers/media/i2c/thp7312.o: in function `thp7312_probe':
> >> thp7312.c:(.text+0x4164): undefined reference to `firmware_upload_register'
> >>
> >> Select the required Kconfig symbol. Note that the driver specifically
> >> needs the firmware upload interface that is controlled by CONFIG_FW_UPLOAD,
> >> but there is no link failure when that is disabled because the interfaces
> >> are stubbed out here.
> >>
> >> Fixes: 7a52ab415b43 ("media: i2c: Add driver for THine THP7312")
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > I've posted a similar fix yesterday, see
> > https://lore.kernel.org/linux-media/20240102074518.24968-1-laurent.pinchart@ideasonboard.com
> > 
> > What approach do you think is best ?
> 
> By far the dominant use of FW_LOADER is to select it instead of depend on it,
> so I prefer Arnd's patch.

The alternative could save space, but I expect that to be an uncommon
use case, as FW_LOADER will likely be selected for other reasons anyway. 

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> >> ---
> >>  drivers/media/i2c/Kconfig | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> >> index 78a87331686e..4c3435921f19 100644
> >> --- a/drivers/media/i2c/Kconfig
> >> +++ b/drivers/media/i2c/Kconfig
> >> @@ -674,6 +674,7 @@ menu "Camera ISPs"
> >>  config VIDEO_THP7312
> >>  	tristate "THine THP7312 support"
> >>  	depends on I2C
> >> +	select FW_LOADER
> >>  	select MEDIA_CONTROLLER
> >>  	select V4L2_CCI_I2C
> >>  	select V4L2_FWNODE
diff mbox series

Patch

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 78a87331686e..4c3435921f19 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -674,6 +674,7 @@  menu "Camera ISPs"
 config VIDEO_THP7312
 	tristate "THine THP7312 support"
 	depends on I2C
+	select FW_LOADER
 	select MEDIA_CONTROLLER
 	select V4L2_CCI_I2C
 	select V4L2_FWNODE