Skip to content

Commit a39bd92

Browse files
vadimp-nvidiawsakernel
authored andcommitted
i2c: mux: mlxcpld: Add callback to notify mux creation completion
Add notification to inform caller that mux objects array has been created. It allows to user, invoked platform device registration for "i2c-mux-mlxcpld" driver, to be notified that mux infrastructure is available, and thus some devices could be connected to this infrastructure. Signed-off-by: Vadim Pasternak <[email protected]> Acked-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 699c050 commit a39bd92

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/i2c/muxes/i2c-mux-mlxcpld.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
159159
goto virt_reg_failed;
160160
}
161161

162+
/* Notify caller when all channels' adapters are created. */
163+
if (pdata->completion_notify)
164+
pdata->completion_notify(pdata->handle, muxc->parent, muxc->adapter);
165+
162166
return 0;
163167

164168
virt_reg_failed:

include/linux/platform_data/mlxcpld.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
* @num_adaps - number of adapters
1616
* @sel_reg_addr - mux select register offset in CPLD space
1717
* @reg_size: register size in bytes
18+
* @handle: handle to be passed by callback
19+
* @completion_notify: callback to notify when all the adapters are created
1820
*/
1921
struct mlxcpld_mux_plat_data {
2022
int *chan_ids;
2123
int num_adaps;
2224
int sel_reg_addr;
2325
u8 reg_size;
26+
void *handle;
27+
int (*completion_notify)(void *handle, struct i2c_adapter *parent,
28+
struct i2c_adapter *adapters[]);
2429
};
2530

2631
#endif /* _LINUX_I2C_MLXCPLD_H */

0 commit comments

Comments
 (0)