All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] char: rtc: remove unused rtc_control() API
@ 2018-02-06 22:12 Alexandre Belloni
  2018-02-06 22:38 ` Greg Kroah-Hartman
  2018-02-06 23:24 ` Arnd Bergmann
  0 siblings, 2 replies; 5+ messages in thread
From: Alexandre Belloni @ 2018-02-06 22:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arnd Bergmann; +Cc: linux-kernel, Alexandre Belloni

Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the
rtc_register/rtc_control/rtc_unregister API is unused. As it is highly
unlikely to be needed again, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---

Hi,

I'd like that one to go through the RTC tree as I have other changes in rtc.h
planned for the next release.

 drivers/char/rtc.c  | 83 -----------------------------------------------------
 include/linux/rtc.h |  4 ---
 2 files changed, 87 deletions(-)

diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index c6a317120a55..3d86115e5624 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -809,89 +809,6 @@ static __poll_t rtc_poll(struct file *file, poll_table *wait)
 }
 #endif
 
-int rtc_register(rtc_task_t *task)
-{
-#ifndef RTC_IRQ
-	return -EIO;
-#else
-	if (task == NULL || task->func == NULL)
-		return -EINVAL;
-	spin_lock_irq(&rtc_lock);
-	if (rtc_status & RTC_IS_OPEN) {
-		spin_unlock_irq(&rtc_lock);
-		return -EBUSY;
-	}
-	spin_lock(&rtc_task_lock);
-	if (rtc_callback) {
-		spin_unlock(&rtc_task_lock);
-		spin_unlock_irq(&rtc_lock);
-		return -EBUSY;
-	}
-	rtc_status |= RTC_IS_OPEN;
-	rtc_callback = task;
-	spin_unlock(&rtc_task_lock);
-	spin_unlock_irq(&rtc_lock);
-	return 0;
-#endif
-}
-EXPORT_SYMBOL(rtc_register);
-
-int rtc_unregister(rtc_task_t *task)
-{
-#ifndef RTC_IRQ
-	return -EIO;
-#else
-	unsigned char tmp;
-
-	spin_lock_irq(&rtc_lock);
-	spin_lock(&rtc_task_lock);
-	if (rtc_callback != task) {
-		spin_unlock(&rtc_task_lock);
-		spin_unlock_irq(&rtc_lock);
-		return -ENXIO;
-	}
-	rtc_callback = NULL;
-
-	/* disable controls */
-	if (!hpet_mask_rtc_irq_bit(RTC_PIE | RTC_AIE | RTC_UIE)) {
-		tmp = CMOS_READ(RTC_CONTROL);
-		tmp &= ~RTC_PIE;
-		tmp &= ~RTC_AIE;
-		tmp &= ~RTC_UIE;
-		CMOS_WRITE(tmp, RTC_CONTROL);
-		CMOS_READ(RTC_INTR_FLAGS);
-	}
-	if (rtc_status & RTC_TIMER_ON) {
-		rtc_status &= ~RTC_TIMER_ON;
-		del_timer(&rtc_irq_timer);
-	}
-	rtc_status &= ~RTC_IS_OPEN;
-	spin_unlock(&rtc_task_lock);
-	spin_unlock_irq(&rtc_lock);
-	return 0;
-#endif
-}
-EXPORT_SYMBOL(rtc_unregister);
-
-int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg)
-{
-#ifndef RTC_IRQ
-	return -EIO;
-#else
-	unsigned long flags;
-	if (cmd != RTC_PIE_ON && cmd != RTC_PIE_OFF && cmd != RTC_IRQP_SET)
-		return -EINVAL;
-	spin_lock_irqsave(&rtc_task_lock, flags);
-	if (rtc_callback != task) {
-		spin_unlock_irqrestore(&rtc_task_lock, flags);
-		return -ENXIO;
-	}
-	spin_unlock_irqrestore(&rtc_task_lock, flags);
-	return rtc_do_ioctl(cmd, arg, 1);
-#endif
-}
-EXPORT_SYMBOL(rtc_control);
-
 /*
  *	The various file operations we support.
  */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index fc6c90b57be0..5024b61119b6 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -212,10 +212,6 @@ void rtc_aie_update_irq(void *private);
 void rtc_uie_update_irq(void *private);
 enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer);
 
-int rtc_register(rtc_task_t *task);
-int rtc_unregister(rtc_task_t *task);
-int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
-
 void rtc_timer_init(struct rtc_timer *timer, void (*f)(void *p), void *data);
 int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer *timer,
 		    ktime_t expires, ktime_t period);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] char: rtc: remove unused rtc_control() API
  2018-02-06 22:12 [PATCH] char: rtc: remove unused rtc_control() API Alexandre Belloni
@ 2018-02-06 22:38 ` Greg Kroah-Hartman
  2018-02-06 23:24 ` Arnd Bergmann
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-02-06 22:38 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Arnd Bergmann, linux-kernel

On Tue, Feb 06, 2018 at 11:12:26PM +0100, Alexandre Belloni wrote:
> Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the
> rtc_register/rtc_control/rtc_unregister API is unused. As it is highly
> unlikely to be needed again, remove it.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> 
> Hi,
> 
> I'd like that one to go through the RTC tree as I have other changes in rtc.h
> planned for the next release.
> 

Fine with me!

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] char: rtc: remove unused rtc_control() API
  2018-02-06 22:12 [PATCH] char: rtc: remove unused rtc_control() API Alexandre Belloni
  2018-02-06 22:38 ` Greg Kroah-Hartman
@ 2018-02-06 23:24 ` Arnd Bergmann
  2018-02-07  1:04   ` Alexandre Belloni
  1 sibling, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2018-02-06 23:24 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Greg Kroah-Hartman, Linux Kernel Mailing List

On Tue, Feb 6, 2018 at 11:12 PM, Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
> Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the
> rtc_register/rtc_control/rtc_unregister API is unused. As it is highly
> unlikely to be needed again, remove it.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---

Nice!

Acked-by: Arnd Bergmann <arnd@arndb.de>

I forgot what's stopping us from removing the rest of that driver ;-)
Since we can only build it on alpha and mips/loongson64 these
days, is there anything that this driver does that the normal
one doesn't? If it's just a question of testing, we could probably
just move it to staging and see if anyone notices a difference.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] char: rtc: remove unused rtc_control() API
  2018-02-06 23:24 ` Arnd Bergmann
@ 2018-02-07  1:04   ` Alexandre Belloni
  2018-02-07 10:24     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Belloni @ 2018-02-07  1:04 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Greg Kroah-Hartman, Linux Kernel Mailing List

On 07/02/2018 at 00:24:11 +0100, Arnd Bergmann wrote:
> On Tue, Feb 6, 2018 at 11:12 PM, Alexandre Belloni
> <alexandre.belloni@bootlin.com> wrote:
> > Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the
> > rtc_register/rtc_control/rtc_unregister API is unused. As it is highly
> > unlikely to be needed again, remove it.
> >
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > ---
> 
> Nice!
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> 
> I forgot what's stopping us from removing the rest of that driver ;-)
> Since we can only build it on alpha and mips/loongson64 these
> days, is there anything that this driver does that the normal
> one doesn't? If it's just a question of testing, we could probably
> just move it to staging and see if anyone notices a difference.

I'd say it is a matter of testing. The loongsoon maintainers seem
responsive so we may get testing for that architecture. I'm not so sure
about alpha. Actually, I'm not even sure it is really used on alpha
because arch/alpha/kernel/rtc.c seems to do the right thing.

I think I'll start by ripping of all the x86 and sparc specific parts
and see what's left.

I would also love to get rid of drivers/char/efirtc.c but that probably
means doing some testing on both an ARM/ARM64 platform with EFI and
IA64.


-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] char: rtc: remove unused rtc_control() API
  2018-02-07  1:04   ` Alexandre Belloni
@ 2018-02-07 10:24     ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2018-02-07 10:24 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Greg Kroah-Hartman, Linux Kernel Mailing List, Richard Henderson,
	Ivan Kokshaysky, Matt Turner, linux-alpha

On Wed, Feb 7, 2018 at 2:04 AM, Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
> On 07/02/2018 at 00:24:11 +0100, Arnd Bergmann wrote:
>> On Tue, Feb 6, 2018 at 11:12 PM, Alexandre Belloni
>> <alexandre.belloni@bootlin.com> wrote:
>> > Since commit 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer"), the
>> > rtc_register/rtc_control/rtc_unregister API is unused. As it is highly
>> > unlikely to be needed again, remove it.
>> >
>> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
>> > ---
>>
>> Nice!
>>
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>>
>> I forgot what's stopping us from removing the rest of that driver ;-)
>> Since we can only build it on alpha and mips/loongson64 these
>> days, is there anything that this driver does that the normal
>> one doesn't? If it's just a question of testing, we could probably
>> just move it to staging and see if anyone notices a difference.
>
> I'd say it is a matter of testing. The loongsoon maintainers seem
> responsive so we may get testing for that architecture. I'm not so sure
> about alpha. Actually, I'm not even sure it is really used on alpha
> because arch/alpha/kernel/rtc.c seems to do the right thing.

The Alpha defconfig still enables it, and doesn't enable RTC_CLASS,
so at least that has to be changed. I've added the Alpha maintainers
to Cc, they can probably find out whether it works or not.

> I think I'll start by ripping of all the x86 and sparc specific parts
> and see what's left.

Just wait till we hear back from the others, removing it completely
would be simpler ;-)

> I would also love to get rid of drivers/char/efirtc.c but that probably
> means doing some testing on both an ARM/ARM64 platform with EFI and
> IA64.

On ARM/ARM64, we can only use the drivers/rtc/rtc-efi.c driver,
not drivers/char/efirtc.c, so it's only IA64, and they were also
the ones that sent the rtc-efi driver before the start of the git
history. However, the EFI_RTC driver is still in their defconfigs.

For the other RTC drivers in drivers/char, JS_RTC has been dead
for a while, since sparc selects RTC_CLASS. For DS1302, we
have both a driver that is used on m32r and a generic rtc class
driver for the same chip, but I wouldn't trust on that to work
on m32r. We can probably find a solution for this one once
the others are gone, e.g. removing arch/m32r, or adding some
glue logic to make it plausible for the rtc class driver to work,
without actually testing it.

     Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-07 10:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 22:12 [PATCH] char: rtc: remove unused rtc_control() API Alexandre Belloni
2018-02-06 22:38 ` Greg Kroah-Hartman
2018-02-06 23:24 ` Arnd Bergmann
2018-02-07  1:04   ` Alexandre Belloni
2018-02-07 10:24     ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.