Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176607
b: refs/heads/master
c: a8462ef
h: refs/heads/master
i:
  176605: ec2d28d
  176603: cb444bf
  176599: d1aaba9
  176591: ec933c0
  176575: e4e361c
v: v3
  • Loading branch information
Herton Ronaldo Krzesinski authored and Linus Torvalds committed Dec 16, 2009
1 parent 4b4bbd2 commit d741ffb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b74d2caa64f8e542e9c6716ae6ed4a60d681ea9f
refs/heads/master: a8462ef63c961639a743f9fcddf408da46641281
75 changes: 35 additions & 40 deletions trunk/drivers/rtc/rtc-cmos.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,49 +420,43 @@ static int cmos_irq_set_state(struct device *dev, int enabled)
return 0;
}

#if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE)

static int
cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
unsigned long flags;

switch (cmd) {
case RTC_AIE_OFF:
case RTC_AIE_ON:
case RTC_UIE_OFF:
case RTC_UIE_ON:
if (!is_valid_irq(cmos->irq))
return -EINVAL;
break;
/* PIE ON/OFF is handled by cmos_irq_set_state() */
default:
return -ENOIOCTLCMD;
}
if (!is_valid_irq(cmos->irq))
return -EINVAL;

spin_lock_irqsave(&rtc_lock, flags);
switch (cmd) {
case RTC_AIE_OFF: /* alarm off */
cmos_irq_disable(cmos, RTC_AIE);
break;
case RTC_AIE_ON: /* alarm on */

if (enabled)
cmos_irq_enable(cmos, RTC_AIE);
break;
case RTC_UIE_OFF: /* update off */
cmos_irq_disable(cmos, RTC_UIE);
break;
case RTC_UIE_ON: /* update on */
cmos_irq_enable(cmos, RTC_UIE);
break;
}
else
cmos_irq_disable(cmos, RTC_AIE);

spin_unlock_irqrestore(&rtc_lock, flags);
return 0;
}

#else
#define cmos_rtc_ioctl NULL
#endif
static int cmos_update_irq_enable(struct device *dev, unsigned int enabled)
{
struct cmos_rtc *cmos = dev_get_drvdata(dev);
unsigned long flags;

if (!is_valid_irq(cmos->irq))
return -EINVAL;

spin_lock_irqsave(&rtc_lock, flags);

if (enabled)
cmos_irq_enable(cmos, RTC_UIE);
else
cmos_irq_disable(cmos, RTC_UIE);

spin_unlock_irqrestore(&rtc_lock, flags);
return 0;
}

#if defined(CONFIG_RTC_INTF_PROC) || defined(CONFIG_RTC_INTF_PROC_MODULE)

Expand Down Expand Up @@ -503,14 +497,15 @@ static int cmos_procfs(struct device *dev, struct seq_file *seq)
#endif

static const struct rtc_class_ops cmos_rtc_ops = {
.ioctl = cmos_rtc_ioctl,
.read_time = cmos_read_time,
.set_time = cmos_set_time,
.read_alarm = cmos_read_alarm,
.set_alarm = cmos_set_alarm,
.proc = cmos_procfs,
.irq_set_freq = cmos_irq_set_freq,
.irq_set_state = cmos_irq_set_state,
.read_time = cmos_read_time,
.set_time = cmos_set_time,
.read_alarm = cmos_read_alarm,
.set_alarm = cmos_set_alarm,
.proc = cmos_procfs,
.irq_set_freq = cmos_irq_set_freq,
.irq_set_state = cmos_irq_set_state,
.alarm_irq_enable = cmos_alarm_irq_enable,
.update_irq_enable = cmos_update_irq_enable,
};

/*----------------------------------------------------------------*/
Expand Down

0 comments on commit d741ffb

Please sign in to comment.