Skip to content

Commit 699c050

Browse files
vadimp-nvidiawsakernel
authored andcommitted
i2c: mux: mlxcpld: Extend supported mux number
Allow to extend mux number supported by driver. Currently it is limited by eight, which is not enough for new coming Mellanox modular system with line cards, which require up to 64 mux support. Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Michael Shych <[email protected]> Acked-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent c52a1c5 commit 699c050

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include <linux/platform_device.h>
1616
#include <linux/slab.h>
1717

18-
#define CPLD_MUX_MAX_NCHANS 8
19-
2018
/* mlxcpld_mux - mux control structure:
2119
* @last_val - last selected register value or -1 if mux deselected
2220
* @client - I2C device client
@@ -142,7 +140,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
142140
if (!i2c_check_functionality(client->adapter, func))
143141
return -ENODEV;
144142

145-
muxc = i2c_mux_alloc(client->adapter, &pdev->dev, CPLD_MUX_MAX_NCHANS,
143+
muxc = i2c_mux_alloc(client->adapter, &pdev->dev, pdata->num_adaps,
146144
sizeof(*data), 0, mlxcpld_mux_select_chan,
147145
mlxcpld_mux_deselect);
148146
if (!muxc)
@@ -155,11 +153,7 @@ static int mlxcpld_mux_probe(struct platform_device *pdev)
155153
data->last_val = -1; /* force the first selection */
156154

157155
/* Create an adapter for each channel. */
158-
for (num = 0; num < CPLD_MUX_MAX_NCHANS; num++) {
159-
if (num >= pdata->num_adaps)
160-
/* discard unconfigured channels */
161-
break;
162-
156+
for (num = 0; num < pdata->num_adaps; num++) {
163157
err = i2c_mux_add_adapter(muxc, 0, pdata->chan_ids[num], 0);
164158
if (err)
165159
goto virt_reg_failed;

0 commit comments

Comments
 (0)