usb: misc: onboard_usb_dev: fix build warning for CONFIG_USB_ONBOARD_DEV_USB5744=n
commit 662a9ece32add94469138ae66999ee16cb37a531 upstream.
When the USB5744 option is disabled, the onboard_usb driver warns about
unused functions:
drivers/usb/misc/onboard_usb_dev.c:358:12: error: 'onboard_dev_5744_i2c_write_byte' defined but not used [-Werror=unused-function]
358 | static int onboard_dev_5744_i2c_write_byte(struct i2c_client *client, u16 addr, u8 data)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/misc/onboard_usb_dev.c:313:12: error: 'onboard_dev_5744_i2c_read_byte' defined but not used [-Werror=unused-function]
313 | static int onboard_dev_5744_i2c_read_byte(struct i2c_client *client, u16 addr, u8 *data)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Extend the #ifdef block a little further to cover all of these functions.
Ideally we'd use use if(IS_ENABLED()) instead, but that doesn't currently
work because the i2c_transfer() and i2c_smbus_write_word_data() function
declarations are hidden when CONFIG_I2C is disabled.
Fixes: 1143d41922c0 ("usb: misc: onboard_usb_dev: Fix usb5744 initialization sequence")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250523120947.2170302-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d4724213c8
commit
b4a86d64e4
@@ -310,6 +310,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work)
|
||||
pr_err("Failed to attach USB driver: %pe\n", ERR_PTR(err));
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
|
||||
static int onboard_dev_5744_i2c_read_byte(struct i2c_client *client, u16 addr, u8 *data)
|
||||
{
|
||||
struct i2c_msg msg[2];
|
||||
@@ -388,7 +389,6 @@ static int onboard_dev_5744_i2c_write_byte(struct i2c_client *client, u16 addr,
|
||||
|
||||
static int onboard_dev_5744_i2c_init(struct i2c_client *client)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
|
||||
struct device *dev = &client->dev;
|
||||
int ret;
|
||||
u8 reg;
|
||||
@@ -417,10 +417,13 @@ static int onboard_dev_5744_i2c_init(struct i2c_client *client)
|
||||
return dev_err_probe(dev, ret, "USB Attach with SMBus command failed\n");
|
||||
|
||||
return ret;
|
||||
#else
|
||||
return -ENODEV;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static int onboard_dev_5744_i2c_init(struct i2c_client *client)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int onboard_dev_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user