Skip to content

Commit 65fabd1

Browse files
rmsilvagregkh
authored andcommitted
greybus: spi: fix and cleanup spi devices handling
Cleanup and remove the spi_devices from the greybus spi handling as they are not needed and they were completely misused. With this the gb_spi_init does not make sense to exist anymore, so just remove it and handle the master config directly from connection init. Signed-off-by: Rui Miguel Silva <[email protected]> Reported-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4a0c445 commit 65fabd1

File tree

1 file changed

+3
-21
lines changed
  • drivers/staging/greybus

1 file changed

+3
-21
lines changed

drivers/staging/greybus/spi.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ struct gb_spi {
2323
u8 num_chipselect;
2424
u32 min_speed_hz;
2525
u32 max_speed_hz;
26-
struct spi_device *spi_devices;
2726
};
2827

2928
static struct spi_master *get_master_from_spi(struct gb_spi *spi)
@@ -284,7 +283,7 @@ static int gb_spi_setup_device(struct gb_spi *spi, u8 cs)
284283
struct gb_spi_device_config_request request;
285284
struct gb_spi_device_config_response response;
286285
struct spi_board_info spi_board = { {0} };
287-
struct spi_device *spidev = &spi->spi_devices[cs];
286+
struct spi_device *spidev;
288287
int ret;
289288

290289
request.chip_select = cs;
@@ -308,24 +307,6 @@ static int gb_spi_setup_device(struct gb_spi *spi, u8 cs)
308307
return 0;
309308
}
310309

311-
static int gb_spi_init(struct gb_spi *spi)
312-
{
313-
int ret;
314-
315-
/* get master configuration */
316-
ret = gb_spi_get_master_config(spi);
317-
if (ret)
318-
return ret;
319-
320-
spi->spi_devices = kcalloc(spi->num_chipselect,
321-
sizeof(struct spi_device), GFP_KERNEL);
322-
if (!spi->spi_devices)
323-
return -ENOMEM;
324-
325-
return ret;
326-
}
327-
328-
329310
static int gb_spi_connection_init(struct gb_connection *connection)
330311
{
331312
struct gb_spi *spi;
@@ -344,7 +325,8 @@ static int gb_spi_connection_init(struct gb_connection *connection)
344325
spi->connection = connection;
345326
connection->private = master;
346327

347-
ret = gb_spi_init(spi);
328+
/* get master configuration */
329+
ret = gb_spi_get_master_config(spi);
348330
if (ret)
349331
goto out_put_master;
350332

0 commit comments

Comments
 (0)