Skip to contentSkip to conversation

RTC/pxa: remove unnecessary private ops->ioctl()

PATCH New Wan ZongShun 3 participants 4 messages Jun 5, 2010 – Jun 7, 2010 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RTC/pxa: remove unnecessary private ops->ioctl()

Please, do not implement private ops->ioctl() unless absolutely necessary. pxa series RTC driver's ioctl() is unnecessary, since RTC subsystem has implement the ioctl() very well,so we can only use the API of '.alarm_irq_enable' and '.update_irq_enable' to do enable irq action.

---
 drivers/rtc/rtc-pxa.c |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)
drivers/rtc/rtc-pxa.c +22 -19
index e9c6fa0..8ba4af8 100644
@@ -236,32 +236,34 @@ static int pxa_periodic_irq_set_state(struct device *dev, int enabled)
 	return 0;
 }
 
-static int pxa_rtc_ioctl(struct device *dev, unsigned int cmd,
-		unsigned long arg)
+static int pxa_alarm_irq_enable(struct device *dev, unsigned int enabled)
 {
 	struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev);
-	int ret = 0;
 
 	spin_lock_irq(&pxa_rtc->lock);
-	switch (cmd) {
-	case RTC_AIE_OFF:
-		rtsr_clear_bits(pxa_rtc, RTSR_RDALE1);
-		break;
-	case RTC_AIE_ON:
+
+	if (enabled)
 		rtsr_set_bits(pxa_rtc, RTSR_RDALE1);
-		break;
-	case RTC_UIE_OFF:
-		rtsr_clear_bits(pxa_rtc, RTSR_HZE);
-		break;
-	case RTC_UIE_ON:
+	else
+		rtsr_clear_bits(pxa_rtc, RTSR_RDALE1);
+
+	spin_unlock_irq(&pxa_rtc->lock);
+	return 0;
+}
+
+static int pxa_update_irq_enable(struct device *dev, unsigned int enabled)
+{
+	struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev);
+
+	spin_lock_irq(&pxa_rtc->lock);
+
+	if (enabled)
 		rtsr_set_bits(pxa_rtc, RTSR_HZE);
-		break;
-	default:
-		ret = -ENOIOCTLCMD;
-	}
+	else
+		rtsr_clear_bits(pxa_rtc, RTSR_HZE);
 
 	spin_unlock_irq(&pxa_rtc->lock);
-	return ret;
+	return 0;
 }
 
 static int pxa_rtc_read_time(struct device *dev, struct rtc_time *tm)
@@ -340,11 +342,12 @@ static int pxa_rtc_proc(struct device *dev, struct seq_file *seq)
 static const struct rtc_class_ops pxa_rtc_ops = {
 	.open = pxa_rtc_open,
 	.release = pxa_rtc_release,
-	.ioctl = pxa_rtc_ioctl,
 	.read_time = pxa_rtc_read_time,
 	.set_time = pxa_rtc_set_time,
 	.read_alarm = pxa_rtc_read_alarm,
 	.set_alarm = pxa_rtc_set_alarm,
+	.alarm_irq_enable = pxa_alarm_irq_enable,
+	.update_irq_enable = pxa_update_irq_enable,
 	.proc = pxa_rtc_proc,
 	.irq_set_state = pxa_periodic_irq_set_state,
 	.irq_set_freq = pxa_periodic_irq_set_freq,
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 RTC/pxa: remove unnecessary private ops->ioctl()

Quoted 6 lines · Wan ZongShun

Please, do not implement private ops->ioctl() unless absolutely necessary. pxa series RTC driver's ioctl() is unnecessary, since RTC subsystem has implement the ioctl() very well,so we can only use the API of '.alarm_irq_enable' and '.update_irq_enable' to do enable irq action.

This is not an urgent fix, but a cleanup. Whoever gets it in (Alessandro through rtc tree, Eric through arm/pxa tree, or Andrew) is to be defined.

I would go for Alessandro, as he handles the RTC tree.

Cheers.

--
Robert

PS: Removed alsa-devel list, as this is not alsa material

#2 lore raw

PATCH 1/1 RTC/pxa: remove unnecessary private ops->ioctl()

2010/6/7 Robert Jarzmik <[email protected]>:

Quoted 6 lines
Quoted 5 lines · Wan ZongShun

Please, do not implement private ops->ioctl() unless absolutely necessary. pxa series RTC driver's ioctl() is unnecessary, since RTC subsystem has implement the ioctl() very well,so we can only use the API of '.alarm_irq_enable' and '.update_irq_enable' to do enable irq action.

Quoted 6 lines
Quoted 1 line

This is not an urgent fix, but a cleanup. Whoever gets it in (Alessandro through rtc tree, Eric through arm/pxa tree, or Andrew) is to be defined.

I will ping Andrew to apply it as soon as I get the owner's ACK.

Quoted 8 lines

I would go for Alessandro, as he handles the RTC tree.

Cheers.

--
Robert

PS: Removed alsa-devel list, as this is not alsa material

Yes, I think I am careless for this. sorry.

Quoted 1 line
Signature · 10 lines
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel at lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900 at googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com at gmail.com
#3 lore raw

PATCH 1/1 RTC/pxa: remove unnecessary private ops->ioctl()

In reply to Robert Jarzmik
Quoted 6 lines · Robert Jarzmik
Quoted 5 lines · Wan ZongShun

Please, do not implement private ops->ioctl() unless absolutely necessary. pxa series RTC driver's ioctl() is unnecessary, since RTC subsystem has implement the ioctl() very well,so we can only use the API of '.alarm_irq_enable' and '.update_irq_enable' to do enable irq action.

Quoted 8 lines
Quoted 1 line

This is not an urgent fix, but a cleanup. Whoever gets it in (Alessandro through rtc tree, Eric through arm/pxa tree, or Andrew) is to be defined.

I would go for Alessandro, as he handles the RTC tree.

Yeah, Acked-by: Eric Miao <[email protected]>