@@ -472,8 +472,8 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base)
472472 * specifies that S0ReadyInt and S1ReadyInt should be '1'.
473473 */
474474 sa1111_writel (0 , irqbase + SA1111_INTPOL0 );
475- sa1111_writel (SA1111_IRQMASK_HI (IRQ_S0_READY_NINT ) |
476- SA1111_IRQMASK_HI (IRQ_S1_READY_NINT ),
475+ sa1111_writel (BIT (IRQ_S0_READY_NINT & 31 ) |
476+ BIT (IRQ_S1_READY_NINT & 31 ),
477477 irqbase + SA1111_INTPOL1 );
478478
479479 /* clear all IRQs */
@@ -754,7 +754,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
754754 if (sachip -> irq != NO_IRQ ) {
755755 ret = sa1111_setup_irq (sachip , pd -> irq_base );
756756 if (ret )
757- goto err_unmap ;
757+ goto err_clk ;
758758 }
759759
760760#ifdef CONFIG_ARCH_SA1100
@@ -799,6 +799,8 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
799799
800800 return 0 ;
801801
802+ err_clk :
803+ clk_disable (sachip -> clk );
802804 err_unmap :
803805 iounmap (sachip -> base );
804806 err_clk_unprep :
@@ -869,9 +871,9 @@ struct sa1111_save_data {
869871
870872#ifdef CONFIG_PM
871873
872- static int sa1111_suspend (struct platform_device * dev , pm_message_t state )
874+ static int sa1111_suspend_noirq (struct device * dev )
873875{
874- struct sa1111 * sachip = platform_get_drvdata (dev );
876+ struct sa1111 * sachip = dev_get_drvdata (dev );
875877 struct sa1111_save_data * save ;
876878 unsigned long flags ;
877879 unsigned int val ;
@@ -934,9 +936,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
934936 * restored by their respective drivers, and must be called
935937 * via LDM after this function.
936938 */
937- static int sa1111_resume (struct platform_device * dev )
939+ static int sa1111_resume_noirq (struct device * dev )
938940{
939- struct sa1111 * sachip = platform_get_drvdata (dev );
941+ struct sa1111 * sachip = dev_get_drvdata (dev );
940942 struct sa1111_save_data * save ;
941943 unsigned long flags , id ;
942944 void __iomem * base ;
@@ -952,7 +954,7 @@ static int sa1111_resume(struct platform_device *dev)
952954 id = sa1111_readl (sachip -> base + SA1111_SKID );
953955 if ((id & SKID_ID_MASK ) != SKID_SA1111_ID ) {
954956 __sa1111_remove (sachip );
955- platform_set_drvdata (dev , NULL );
957+ dev_set_drvdata (dev , NULL );
956958 kfree (save );
957959 return 0 ;
958960 }
@@ -1003,8 +1005,8 @@ static int sa1111_resume(struct platform_device *dev)
10031005}
10041006
10051007#else
1006- #define sa1111_suspend NULL
1007- #define sa1111_resume NULL
1008+ #define sa1111_suspend_noirq NULL
1009+ #define sa1111_resume_noirq NULL
10081010#endif
10091011
10101012static int sa1111_probe (struct platform_device * pdev )
@@ -1017,7 +1019,7 @@ static int sa1111_probe(struct platform_device *pdev)
10171019 return - EINVAL ;
10181020 irq = platform_get_irq (pdev , 0 );
10191021 if (irq < 0 )
1020- return - ENXIO ;
1022+ return irq ;
10211023
10221024 return __sa1111_probe (& pdev -> dev , mem , irq );
10231025}
@@ -1038,6 +1040,11 @@ static int sa1111_remove(struct platform_device *pdev)
10381040 return 0 ;
10391041}
10401042
1043+ static struct dev_pm_ops sa1111_pm_ops = {
1044+ .suspend_noirq = sa1111_suspend_noirq ,
1045+ .resume_noirq = sa1111_resume_noirq ,
1046+ };
1047+
10411048/*
10421049 * Not sure if this should be on the system bus or not yet.
10431050 * We really want some way to register a system device at
@@ -1050,10 +1057,9 @@ static int sa1111_remove(struct platform_device *pdev)
10501057static struct platform_driver sa1111_device_driver = {
10511058 .probe = sa1111_probe ,
10521059 .remove = sa1111_remove ,
1053- .suspend = sa1111_suspend ,
1054- .resume = sa1111_resume ,
10551060 .driver = {
10561061 .name = "sa1111" ,
1062+ .pm = & sa1111_pm_ops ,
10571063 },
10581064};
10591065
0 commit comments