Skip to content

Commit 1cbf347

Browse files
Sakari AilusWolfram Sang
authored andcommitted
i2c: Add nop fwnode operations
Add nop variants of i2c_find_device_by_fwnode(), i2c_find_adapter_by_fwnode() and i2c_get_adapter_by_fwnode() for use without CONFIG_I2C. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
1 parent 6ba59ff commit 1cbf347

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

include/linux/i2c.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,6 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr);
960960
#define builtin_i2c_driver(__i2c_driver) \
961961
builtin_driver(__i2c_driver, i2c_add_driver)
962962

963-
#endif /* I2C */
964-
965963
/* must call put_device() when done with returned i2c_client device */
966964
struct i2c_client *i2c_find_device_by_fwnode(struct fwnode_handle *fwnode);
967965

@@ -971,6 +969,28 @@ struct i2c_adapter *i2c_find_adapter_by_fwnode(struct fwnode_handle *fwnode);
971969
/* must call i2c_put_adapter() when done with returned i2c_adapter device */
972970
struct i2c_adapter *i2c_get_adapter_by_fwnode(struct fwnode_handle *fwnode);
973971

972+
#else /* I2C */
973+
974+
static inline struct i2c_client *
975+
i2c_find_device_by_fwnode(struct fwnode_handle *fwnode)
976+
{
977+
return NULL;
978+
}
979+
980+
static inline struct i2c_adapter *
981+
i2c_find_adapter_by_fwnode(struct fwnode_handle *fwnode)
982+
{
983+
return NULL;
984+
}
985+
986+
static inline struct i2c_adapter *
987+
i2c_get_adapter_by_fwnode(struct fwnode_handle *fwnode)
988+
{
989+
return NULL;
990+
}
991+
992+
#endif /* !I2C */
993+
974994
#if IS_ENABLED(CONFIG_OF)
975995
/* must call put_device() when done with returned i2c_client device */
976996
static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)

0 commit comments

Comments
 (0)