@@ -1276,32 +1276,31 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
1276
1276
const struct sh_msiof_chipdata * chipdata ;
1277
1277
struct sh_msiof_spi_info * info ;
1278
1278
struct sh_msiof_spi_priv * p ;
1279
+ struct device * dev = & pdev -> dev ;
1279
1280
unsigned long clksrc ;
1280
1281
int i ;
1281
1282
int ret ;
1282
1283
1283
- chipdata = of_device_get_match_data (& pdev -> dev );
1284
+ chipdata = of_device_get_match_data (dev );
1284
1285
if (chipdata ) {
1285
- info = sh_msiof_spi_parse_dt (& pdev -> dev );
1286
+ info = sh_msiof_spi_parse_dt (dev );
1286
1287
} else {
1287
1288
chipdata = (const void * )pdev -> id_entry -> driver_data ;
1288
- info = dev_get_platdata (& pdev -> dev );
1289
+ info = dev_get_platdata (dev );
1289
1290
}
1290
1291
1291
1292
if (!info ) {
1292
- dev_err (& pdev -> dev , "failed to obtain device info\n" );
1293
+ dev_err (dev , "failed to obtain device info\n" );
1293
1294
return - ENXIO ;
1294
1295
}
1295
1296
1296
1297
if (chipdata -> flags & SH_MSIOF_FLAG_FIXED_DTDL_200 )
1297
1298
info -> dtdl = 200 ;
1298
1299
1299
1300
if (info -> mode == MSIOF_SPI_TARGET )
1300
- ctlr = spi_alloc_target (& pdev -> dev ,
1301
- sizeof (struct sh_msiof_spi_priv ));
1301
+ ctlr = spi_alloc_target (dev , sizeof (struct sh_msiof_spi_priv ));
1302
1302
else
1303
- ctlr = spi_alloc_host (& pdev -> dev ,
1304
- sizeof (struct sh_msiof_spi_priv ));
1303
+ ctlr = spi_alloc_host (dev , sizeof (struct sh_msiof_spi_priv ));
1305
1304
if (ctlr == NULL )
1306
1305
return - ENOMEM ;
1307
1306
@@ -1315,9 +1314,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
1315
1314
init_completion (& p -> done );
1316
1315
init_completion (& p -> done_txdma );
1317
1316
1318
- p -> clk = devm_clk_get (& pdev -> dev , NULL );
1317
+ p -> clk = devm_clk_get (dev , NULL );
1319
1318
if (IS_ERR (p -> clk )) {
1320
- dev_err (& pdev -> dev , "cannot get clock\n" );
1319
+ dev_err (dev , "cannot get clock\n" );
1321
1320
ret = PTR_ERR (p -> clk );
1322
1321
goto err1 ;
1323
1322
}
@@ -1334,15 +1333,14 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
1334
1333
goto err1 ;
1335
1334
}
1336
1335
1337
- ret = devm_request_irq (& pdev -> dev , i , sh_msiof_spi_irq , 0 ,
1338
- dev_name (& pdev -> dev ), p );
1336
+ ret = devm_request_irq (dev , i , sh_msiof_spi_irq , 0 , dev_name (& pdev -> dev ), p );
1339
1337
if (ret ) {
1340
- dev_err (& pdev -> dev , "unable to request irq\n" );
1338
+ dev_err (dev , "unable to request irq\n" );
1341
1339
goto err1 ;
1342
1340
}
1343
1341
1344
1342
p -> pdev = pdev ;
1345
- pm_runtime_enable (& pdev -> dev );
1343
+ pm_runtime_enable (dev );
1346
1344
1347
1345
/* Platform data may override FIFO sizes */
1348
1346
p -> tx_fifo_size = chipdata -> tx_fifo_size ;
@@ -1361,7 +1359,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
1361
1359
ctlr -> flags = chipdata -> ctlr_flags ;
1362
1360
ctlr -> bus_num = pdev -> id ;
1363
1361
ctlr -> num_chipselect = p -> info -> num_chipselect ;
1364
- ctlr -> dev .of_node = pdev -> dev . of_node ;
1362
+ ctlr -> dev .of_node = dev -> of_node ;
1365
1363
ctlr -> setup = sh_msiof_spi_setup ;
1366
1364
ctlr -> prepare_message = sh_msiof_prepare_message ;
1367
1365
ctlr -> target_abort = sh_msiof_target_abort ;
@@ -1373,19 +1371,19 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
1373
1371
1374
1372
ret = sh_msiof_request_dma (p );
1375
1373
if (ret < 0 )
1376
- dev_warn (& pdev -> dev , "DMA not available, using PIO\n" );
1374
+ dev_warn (dev , "DMA not available, using PIO\n" );
1377
1375
1378
- ret = devm_spi_register_controller (& pdev -> dev , ctlr );
1376
+ ret = devm_spi_register_controller (dev , ctlr );
1379
1377
if (ret < 0 ) {
1380
- dev_err (& pdev -> dev , "devm_spi_register_controller error.\n" );
1378
+ dev_err (dev , "devm_spi_register_controller error.\n" );
1381
1379
goto err2 ;
1382
1380
}
1383
1381
1384
1382
return 0 ;
1385
1383
1386
1384
err2 :
1387
1385
sh_msiof_release_dma (p );
1388
- pm_runtime_disable (& pdev -> dev );
1386
+ pm_runtime_disable (dev );
1389
1387
err1 :
1390
1388
spi_controller_put (ctlr );
1391
1389
return ret ;
0 commit comments