Commit a0347f20 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Linus Torvalds

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: default avatarKrzysztof 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0c5deb1e
...@@ -666,7 +666,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) ...@@ -666,7 +666,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
struct sec_platform_data *pdata = s5m87xx->pdata; struct sec_platform_data *pdata = s5m87xx->pdata;
struct s5m_rtc_info *info; struct s5m_rtc_info *info;
const struct regmap_config *regmap_cfg; const struct regmap_config *regmap_cfg;
int ret; int ret, alarm_irq;
if (!pdata) { if (!pdata) {
dev_err(pdev->dev.parent, "Platform data not supplied\n"); dev_err(pdev->dev.parent, "Platform data not supplied\n");
...@@ -681,14 +681,17 @@ static int s5m_rtc_probe(struct platform_device *pdev) ...@@ -681,14 +681,17 @@ static int s5m_rtc_probe(struct platform_device *pdev)
case S2MPS14X: case S2MPS14X:
regmap_cfg = &s2mps14_rtc_regmap_config; regmap_cfg = &s2mps14_rtc_regmap_config;
info->regs = &s2mps_rtc_regs; info->regs = &s2mps_rtc_regs;
alarm_irq = S2MPS14_IRQ_RTCA0;
break; break;
case S5M8763X: case S5M8763X:
regmap_cfg = &s5m_rtc_regmap_config; regmap_cfg = &s5m_rtc_regmap_config;
info->regs = &s5m_rtc_regs; info->regs = &s5m_rtc_regs;
alarm_irq = S5M8763_IRQ_ALARM0;
break; break;
case S5M8767X: case S5M8767X:
regmap_cfg = &s5m_rtc_regmap_config; regmap_cfg = &s5m_rtc_regmap_config;
info->regs = &s5m_rtc_regs; info->regs = &s5m_rtc_regs;
alarm_irq = S5M8767_IRQ_RTCA1;
break; break;
default: default:
dev_err(&pdev->dev, "Device type is not supported by RTC driver\n"); 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,25 +717,11 @@ static int s5m_rtc_probe(struct platform_device *pdev)
info->device_type = s5m87xx->device_type; info->device_type = s5m87xx->device_type;
info->wtsr_smpl = s5m87xx->wtsr_smpl; info->wtsr_smpl = s5m87xx->wtsr_smpl;
switch (pdata->device_type) { info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
case S2MPS14X: if (info->irq <= 0) {
info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
S2MPS14_IRQ_RTCA0);
break;
case S5M8763X:
info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
S5M8763_IRQ_ALARM0);
break;
case S5M8767X:
info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
S5M8767_IRQ_RTCA1);
break;
default:
ret = -EINVAL; ret = -EINVAL;
dev_err(&pdev->dev, "Unsupported device type: %d\n", ret); dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
alarm_irq);
goto err; goto err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment