Skip to content

Commit 140a4ec

Browse files
Heikki Krogerusgregkh
authored andcommitted
platform: x86: intel_cht_int33fe: Register all connections at once
We can register all device connection descriptors with a single call to device_connections_add(). Acked-by: Andy Shevchenko <[email protected]> Acked-by: Hans de Goede <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cd7753d commit 140a4ec

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/platform/x86/intel_cht_int33fe.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct cht_int33fe_data {
3434
struct i2c_client *fusb302;
3535
struct i2c_client *pi3usb30532;
3636
/* Contain a list-head must be per device */
37-
struct device_connection connections[3];
37+
struct device_connection connections[4];
3838
};
3939

4040
/*
@@ -184,9 +184,7 @@ static int cht_int33fe_probe(struct i2c_client *client)
184184
data->connections[2].endpoint[1] = "intel_xhci_usb_sw-role-switch";
185185
data->connections[2].id = "usb-role-switch";
186186

187-
device_connection_add(&data->connections[0]);
188-
device_connection_add(&data->connections[1]);
189-
device_connection_add(&data->connections[2]);
187+
device_connections_add(data->connections);
190188

191189
memset(&board_info, 0, sizeof(board_info));
192190
strlcpy(board_info.type, "typec_fusb302", I2C_NAME_SIZE);
@@ -217,9 +215,7 @@ static int cht_int33fe_probe(struct i2c_client *client)
217215
if (data->max17047)
218216
i2c_unregister_device(data->max17047);
219217

220-
device_connection_remove(&data->connections[2]);
221-
device_connection_remove(&data->connections[1]);
222-
device_connection_remove(&data->connections[0]);
218+
device_connections_remove(data->connections);
223219

224220
return -EPROBE_DEFER; /* Wait for the i2c-adapter to load */
225221
}
@@ -233,9 +229,7 @@ static int cht_int33fe_remove(struct i2c_client *i2c)
233229
if (data->max17047)
234230
i2c_unregister_device(data->max17047);
235231

236-
device_connection_remove(&data->connections[2]);
237-
device_connection_remove(&data->connections[1]);
238-
device_connection_remove(&data->connections[0]);
232+
device_connections_remove(data->connections);
239233

240234
return 0;
241235
}

0 commit comments

Comments
 (0)