summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/spilib.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 21:00:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 21:00:30 +0000
commite54def4ad8144ab15f826416e2e0f290ef1901b4 (patch)
tree583f8d4bd95cd67c44ff37b878a7eddfca9ab97a /drivers/staging/greybus/spilib.c
parentAdding upstream version 6.8.12. (diff)
downloadlinux-e54def4ad8144ab15f826416e2e0f290ef1901b4.tar.xz
linux-e54def4ad8144ab15f826416e2e0f290ef1901b4.zip
Adding upstream version 6.9.2.upstream/6.9.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/staging/greybus/spilib.c')
-rw-r--r--drivers/staging/greybus/spilib.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c
index efb3bec58..34f106851 100644
--- a/drivers/staging/greybus/spilib.c
+++ b/drivers/staging/greybus/spilib.c
@@ -42,7 +42,7 @@ struct gb_spilib {
#define XFER_TIMEOUT_TOLERANCE 200
-static struct spi_master *get_master_from_spi(struct gb_spilib *spi)
+static struct spi_controller *get_controller_from_spi(struct gb_spilib *spi)
{
return gb_connection_get_data(spi->connection);
}
@@ -324,10 +324,10 @@ static void gb_spi_decode_response(struct gb_spilib *spi,
}
}
-static int gb_spi_transfer_one_message(struct spi_master *master,
+static int gb_spi_transfer_one_message(struct spi_controller *ctlr,
struct spi_message *msg)
{
- struct gb_spilib *spi = spi_master_get_devdata(master);
+ struct gb_spilib *spi = spi_controller_get_devdata(ctlr);
struct gb_connection *connection = spi->connection;
struct gb_spi_transfer_response *response;
struct gb_operation *operation;
@@ -371,21 +371,21 @@ static int gb_spi_transfer_one_message(struct spi_master *master,
out:
msg->status = ret;
clean_xfer_state(spi);
- spi_finalize_current_message(master);
+ spi_finalize_current_message(ctlr);
return ret;
}
-static int gb_spi_prepare_transfer_hardware(struct spi_master *master)
+static int gb_spi_prepare_transfer_hardware(struct spi_controller *ctlr)
{
- struct gb_spilib *spi = spi_master_get_devdata(master);
+ struct gb_spilib *spi = spi_controller_get_devdata(ctlr);
return spi->ops->prepare_transfer_hardware(spi->parent);
}
-static int gb_spi_unprepare_transfer_hardware(struct spi_master *master)
+static int gb_spi_unprepare_transfer_hardware(struct spi_controller *ctlr)
{
- struct gb_spilib *spi = spi_master_get_devdata(master);
+ struct gb_spilib *spi = spi_controller_get_devdata(ctlr);
spi->ops->unprepare_transfer_hardware(spi->parent);
@@ -440,7 +440,7 @@ static int gb_spi_get_master_config(struct gb_spilib *spi)
static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)
{
- struct spi_master *master = get_master_from_spi(spi);
+ struct spi_controller *ctlr = get_controller_from_spi(spi);
struct gb_spi_device_config_request request;
struct gb_spi_device_config_response response;
struct spi_board_info spi_board = { {0} };
@@ -471,11 +471,11 @@ static int gb_spi_setup_device(struct gb_spilib *spi, u8 cs)
return -EINVAL;
spi_board.mode = le16_to_cpu(response.mode);
- spi_board.bus_num = master->bus_num;
+ spi_board.bus_num = ctlr->bus_num;
spi_board.chip_select = cs;
spi_board.max_speed_hz = le32_to_cpu(response.max_speed_hz);
- spidev = spi_new_device(master, &spi_board);
+ spidev = spi_new_device(ctlr, &spi_board);
if (!spidev)
return -EINVAL;
@@ -486,52 +486,52 @@ int gb_spilib_master_init(struct gb_connection *connection, struct device *dev,
struct spilib_ops *ops)
{
struct gb_spilib *spi;
- struct spi_master *master;
+ struct spi_controller *ctlr;
int ret;
u8 i;
/* Allocate master with space for data */
- master = spi_alloc_master(dev, sizeof(*spi));
- if (!master) {
+ ctlr = spi_alloc_master(dev, sizeof(*spi));
+ if (!ctlr) {
dev_err(dev, "cannot alloc SPI master\n");
return -ENOMEM;
}
- spi = spi_master_get_devdata(master);
+ spi = spi_controller_get_devdata(ctlr);
spi->connection = connection;
- gb_connection_set_data(connection, master);
+ gb_connection_set_data(connection, ctlr);
spi->parent = dev;
spi->ops = ops;
- /* get master configuration */
+ /* get controller configuration */
ret = gb_spi_get_master_config(spi);
if (ret)
goto exit_spi_put;
- master->bus_num = -1; /* Allow spi-core to allocate it dynamically */
- master->num_chipselect = spi->num_chipselect;
- master->mode_bits = spi->mode;
- master->flags = spi->flags;
- master->bits_per_word_mask = spi->bits_per_word_mask;
+ ctlr->bus_num = -1; /* Allow spi-core to allocate it dynamically */
+ ctlr->num_chipselect = spi->num_chipselect;
+ ctlr->mode_bits = spi->mode;
+ ctlr->flags = spi->flags;
+ ctlr->bits_per_word_mask = spi->bits_per_word_mask;
/* Attach methods */
- master->cleanup = gb_spi_cleanup;
- master->setup = gb_spi_setup;
- master->transfer_one_message = gb_spi_transfer_one_message;
+ ctlr->cleanup = gb_spi_cleanup;
+ ctlr->setup = gb_spi_setup;
+ ctlr->transfer_one_message = gb_spi_transfer_one_message;
if (ops && ops->prepare_transfer_hardware) {
- master->prepare_transfer_hardware =
+ ctlr->prepare_transfer_hardware =
gb_spi_prepare_transfer_hardware;
}
if (ops && ops->unprepare_transfer_hardware) {
- master->unprepare_transfer_hardware =
+ ctlr->unprepare_transfer_hardware =
gb_spi_unprepare_transfer_hardware;
}
- master->auto_runtime_pm = true;
+ ctlr->auto_runtime_pm = true;
- ret = spi_register_master(master);
+ ret = spi_register_controller(ctlr);
if (ret < 0)
goto exit_spi_put;
@@ -548,12 +548,12 @@ int gb_spilib_master_init(struct gb_connection *connection, struct device *dev,
return 0;
exit_spi_put:
- spi_master_put(master);
+ spi_controller_put(ctlr);
return ret;
exit_spi_unregister:
- spi_unregister_master(master);
+ spi_unregister_controller(ctlr);
return ret;
}
@@ -561,9 +561,9 @@ EXPORT_SYMBOL_GPL(gb_spilib_master_init);
void gb_spilib_master_exit(struct gb_connection *connection)
{
- struct spi_master *master = gb_connection_get_data(connection);
+ struct spi_controller *ctlr = gb_connection_get_data(connection);
- spi_unregister_master(master);
+ spi_unregister_controller(ctlr);
}
EXPORT_SYMBOL_GPL(gb_spilib_master_exit);