@@ -742,22 +742,20 @@ static int rockchip_spi_setup(struct spi_device *spi)
742
742
743
743
static int rockchip_spi_probe (struct platform_device * pdev )
744
744
{
745
- int ret ;
746
- struct rockchip_spi * rs ;
745
+ struct device_node * np = pdev -> dev .of_node ;
747
746
struct spi_controller * ctlr ;
747
+ struct rockchip_spi * rs ;
748
748
struct resource * mem ;
749
- struct device_node * np = pdev -> dev .of_node ;
750
749
u32 rsd_nsecs , num_cs ;
751
750
bool target_mode ;
751
+ int ret ;
752
752
753
753
target_mode = of_property_read_bool (np , "spi-slave" );
754
754
755
755
if (target_mode )
756
- ctlr = spi_alloc_target (& pdev -> dev ,
757
- sizeof (struct rockchip_spi ));
756
+ ctlr = spi_alloc_target (& pdev -> dev , sizeof (struct rockchip_spi ));
758
757
else
759
- ctlr = spi_alloc_host (& pdev -> dev ,
760
- sizeof (struct rockchip_spi ));
758
+ ctlr = spi_alloc_host (& pdev -> dev , sizeof (struct rockchip_spi ));
761
759
762
760
if (!ctlr )
763
761
return - ENOMEM ;
@@ -769,7 +767,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
769
767
/* Get basic io resource and map it */
770
768
rs -> regs = devm_platform_get_and_ioremap_resource (pdev , 0 , & mem );
771
769
if (IS_ERR (rs -> regs )) {
772
- ret = PTR_ERR (rs -> regs );
770
+ ret = PTR_ERR (rs -> regs );
773
771
goto err_put_ctlr ;
774
772
}
775
773
@@ -794,7 +792,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
794
792
goto err_put_ctlr ;
795
793
796
794
ret = devm_request_threaded_irq (& pdev -> dev , ret , rockchip_spi_isr , NULL ,
797
- IRQF_ONESHOT , dev_name (& pdev -> dev ), ctlr );
795
+ IRQF_ONESHOT , dev_name (& pdev -> dev ), ctlr );
798
796
if (ret )
799
797
goto err_put_ctlr ;
800
798
@@ -804,16 +802,15 @@ static int rockchip_spi_probe(struct platform_device *pdev)
804
802
if (!of_property_read_u32 (pdev -> dev .of_node , "rx-sample-delay-ns" ,
805
803
& rsd_nsecs )) {
806
804
/* rx sample delay is expressed in parent clock cycles (max 3) */
807
- u32 rsd = DIV_ROUND_CLOSEST (rsd_nsecs * (rs -> freq >> 8 ),
808
- 1000000000 >> 8 );
805
+ u32 rsd = DIV_ROUND_CLOSEST (rsd_nsecs * (rs -> freq >> 8 ), 1000000000 >> 8 );
809
806
if (!rsd ) {
810
807
dev_warn (rs -> dev , "%u Hz are too slow to express %u ns delay\n" ,
811
- rs -> freq , rsd_nsecs );
808
+ rs -> freq , rsd_nsecs );
812
809
} else if (rsd > CR0_RSD_MAX ) {
813
810
rsd = CR0_RSD_MAX ;
814
- dev_warn (rs -> dev , "%u Hz are too fast to express %u ns delay, clamping at %u ns\n" ,
815
- rs -> freq , rsd_nsecs ,
816
- CR0_RSD_MAX * 1000000000U / rs -> freq );
811
+ dev_warn (rs -> dev ,
812
+ "%u Hz are too fast to express %u ns delay, clamping at %u ns\n" ,
813
+ rs -> freq , rsd_nsecs , CR0_RSD_MAX * 1000000000U / rs -> freq );
817
814
}
818
815
rs -> rsd = rsd ;
819
816
}
0 commit comments