diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2014-06-10 18:18:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-10 18:34:47 -0400 |
commit | a0347f20aaacc96a203c9609877ecc77093cbe30 (patch) | |
tree | 0e9c09eb44077612c79c761cff16ca87a455297a /drivers/rtc | |
parent | 0c5deb1ea92fefa6ee69e2da8b887723bdecf3d9 (diff) |
rtc: s5m: consolidate two device type switch statements
In probe the configuration of driver for different chipsets was done in
two switch (pdata->device_type) statements. Consolidate them into one
switch statement to increase code readability.
Additionally check the return value of regmap_irq_get_virq and exit
probe on error.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-s5m.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index 76287ebd0e35..8f06250a0389 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c | |||
@@ -666,7 +666,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
666 | struct sec_platform_data *pdata = s5m87xx->pdata; | 666 | struct sec_platform_data *pdata = s5m87xx->pdata; |
667 | struct s5m_rtc_info *info; | 667 | struct s5m_rtc_info *info; |
668 | const struct regmap_config *regmap_cfg; | 668 | const struct regmap_config *regmap_cfg; |
669 | int ret; | 669 | int ret, alarm_irq; |
670 | 670 | ||
671 | if (!pdata) { | 671 | if (!pdata) { |
672 | dev_err(pdev->dev.parent, "Platform data not supplied\n"); | 672 | dev_err(pdev->dev.parent, "Platform data not supplied\n"); |
@@ -681,14 +681,17 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
681 | case S2MPS14X: | 681 | case S2MPS14X: |
682 | regmap_cfg = &s2mps14_rtc_regmap_config; | 682 | regmap_cfg = &s2mps14_rtc_regmap_config; |
683 | info->regs = &s2mps_rtc_regs; | 683 | info->regs = &s2mps_rtc_regs; |
684 | alarm_irq = S2MPS14_IRQ_RTCA0; | ||
684 | break; | 685 | break; |
685 | case S5M8763X: | 686 | case S5M8763X: |
686 | regmap_cfg = &s5m_rtc_regmap_config; | 687 | regmap_cfg = &s5m_rtc_regmap_config; |
687 | info->regs = &s5m_rtc_regs; | 688 | info->regs = &s5m_rtc_regs; |
689 | alarm_irq = S5M8763_IRQ_ALARM0; | ||
688 | break; | 690 | break; |
689 | case S5M8767X: | 691 | case S5M8767X: |
690 | regmap_cfg = &s5m_rtc_regmap_config; | 692 | regmap_cfg = &s5m_rtc_regmap_config; |
691 | info->regs = &s5m_rtc_regs; | 693 | info->regs = &s5m_rtc_regs; |
694 | alarm_irq = S5M8767_IRQ_RTCA1; | ||
692 | break; | 695 | break; |
693 | default: | 696 | default: |
694 | dev_err(&pdev->dev, "Device type is not supported by RTC driver\n"); | 697 | dev_err(&pdev->dev, "Device type is not supported by RTC driver\n"); |
@@ -714,25 +717,11 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
714 | info->device_type = s5m87xx->device_type; | 717 | info->device_type = s5m87xx->device_type; |
715 | info->wtsr_smpl = s5m87xx->wtsr_smpl; | 718 | info->wtsr_smpl = s5m87xx->wtsr_smpl; |
716 | 719 | ||
717 | switch (pdata->device_type) { | 720 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); |
718 | case S2MPS14X: | 721 | if (info->irq <= 0) { |
719 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, | ||
720 | S2MPS14_IRQ_RTCA0); | ||
721 | break; | ||
722 | |||
723 | case S5M8763X: | ||
724 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, | ||
725 | S5M8763_IRQ_ALARM0); | ||
726 | break; | ||
727 | |||
728 | case S5M8767X: | ||
729 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, | ||
730 | S5M8767_IRQ_RTCA1); | ||
731 | break; | ||
732 | |||
733 | default: | ||
734 | ret = -EINVAL; | 722 | ret = -EINVAL; |
735 | dev_err(&pdev->dev, "Unsupported device type: %d\n", ret); | 723 | dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", |
724 | alarm_irq); | ||
736 | goto err; | 725 | goto err; |
737 | } | 726 | } |
738 | 727 | ||