Skip to content

Commit 662a9ec

Browse files
arndbgregkh
authored andcommitted
usb: misc: onboard_usb_dev: fix build warning for CONFIG_USB_ONBOARD_DEV_USB5744=n
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: 1143d41 ("usb: misc: onboard_usb_dev: Fix usb5744 initialization sequence") Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e60acc4 commit 662a9ec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/usb/misc/onboard_usb_dev.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work)
310310
pr_err("Failed to attach USB driver: %pe\n", ERR_PTR(err));
311311
}
312312

313+
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
313314
static int onboard_dev_5744_i2c_read_byte(struct i2c_client *client, u16 addr, u8 *data)
314315
{
315316
struct i2c_msg msg[2];
@@ -388,7 +389,6 @@ static int onboard_dev_5744_i2c_write_byte(struct i2c_client *client, u16 addr,
388389

389390
static int onboard_dev_5744_i2c_init(struct i2c_client *client)
390391
{
391-
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
392392
struct device *dev = &client->dev;
393393
int ret;
394394
u8 reg;
@@ -417,10 +417,13 @@ static int onboard_dev_5744_i2c_init(struct i2c_client *client)
417417
return dev_err_probe(dev, ret, "USB Attach with SMBus command failed\n");
418418

419419
return ret;
420+
}
420421
#else
422+
static int onboard_dev_5744_i2c_init(struct i2c_client *client)
423+
{
421424
return -ENODEV;
422-
#endif
423425
}
426+
#endif
424427

425428
static int onboard_dev_probe(struct platform_device *pdev)
426429
{

0 commit comments

Comments
 (0)