aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-sc18is602.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-sc18is602.c')
-rw-r--r--drivers/spi/spi-sc18is602.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index 9eda21d739c6..121c2e1dea36 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -183,18 +183,11 @@ static int sc18is602_setup_transfer(struct sc18is602 *hw, u32 hz, u8 mode)
183static int sc18is602_check_transfer(struct spi_device *spi, 183static int sc18is602_check_transfer(struct spi_device *spi,
184 struct spi_transfer *t, int tlen) 184 struct spi_transfer *t, int tlen)
185{ 185{
186 int bpw;
187 uint32_t hz; 186 uint32_t hz;
188 187
189 if (t && t->len + tlen > SC18IS602_BUFSIZ) 188 if (t && t->len + tlen > SC18IS602_BUFSIZ)
190 return -EINVAL; 189 return -EINVAL;
191 190
192 bpw = spi->bits_per_word;
193 if (t && t->bits_per_word)
194 bpw = t->bits_per_word;
195 if (bpw != 8)
196 return -EINVAL;
197
198 hz = spi->max_speed_hz; 191 hz = spi->max_speed_hz;
199 if (t && t->speed_hz) 192 if (t && t->speed_hz)
200 hz = t->speed_hz; 193 hz = t->speed_hz;
@@ -254,9 +247,6 @@ error:
254 247
255static int sc18is602_setup(struct spi_device *spi) 248static int sc18is602_setup(struct spi_device *spi)
256{ 249{
257 if (!spi->bits_per_word)
258 spi->bits_per_word = 8;
259
260 if (spi->mode & ~(SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST)) 250 if (spi->mode & ~(SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST))
261 return -EINVAL; 251 return -EINVAL;
262 252
@@ -315,11 +305,12 @@ static int sc18is602_probe(struct i2c_client *client,
315 } 305 }
316 master->bus_num = client->adapter->nr; 306 master->bus_num = client->adapter->nr;
317 master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST; 307 master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST;
308 master->bits_per_word_mask = SPI_BPW_MASK(8);
318 master->setup = sc18is602_setup; 309 master->setup = sc18is602_setup;
319 master->transfer_one_message = sc18is602_transfer_one; 310 master->transfer_one_message = sc18is602_transfer_one;
320 master->dev.of_node = np; 311 master->dev.of_node = np;
321 312
322 error = spi_register_master(master); 313 error = devm_spi_register_master(dev, master);
323 if (error) 314 if (error)
324 goto error_reg; 315 goto error_reg;
325 316
@@ -330,16 +321,6 @@ error_reg:
330 return error; 321 return error;
331} 322}
332 323
333static int sc18is602_remove(struct i2c_client *client)
334{
335 struct sc18is602 *hw = i2c_get_clientdata(client);
336 struct spi_master *master = hw->master;
337
338 spi_unregister_master(master);
339
340 return 0;
341}
342
343static const struct i2c_device_id sc18is602_id[] = { 324static const struct i2c_device_id sc18is602_id[] = {
344 { "sc18is602", sc18is602 }, 325 { "sc18is602", sc18is602 },
345 { "sc18is602b", sc18is602b }, 326 { "sc18is602b", sc18is602b },
@@ -353,7 +334,6 @@ static struct i2c_driver sc18is602_driver = {
353 .name = "sc18is602", 334 .name = "sc18is602",
354 }, 335 },
355 .probe = sc18is602_probe, 336 .probe = sc18is602_probe,
356 .remove = sc18is602_remove,
357 .id_table = sc18is602_id, 337 .id_table = sc18is602_id,
358}; 338};
359 339