The patch titled mfd/mc13783: new function reading irq mask and status register has been added to the -mm tree. Its filename is mfd-mc13783-new-function-reading-irq-mask-and-status-register.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: mfd/mc13783: new function reading irq mask and status register From: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> The driver for the mc13783 rtc needs to know if the TODA irq is pending. Instead of tracking in the rtc driver if the irq is enabled provide that information, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> Cc: Paul Gortmaker <p_gortmaker@xxxxxxxxx> Cc: Valentin Longchamp <valentin.longchamp@xxxxxxx> Cc: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> Cc: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> Cc: Luotao Fu <l.fu@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/mfd/mc13783-core.c | 35 ++++++++++++++++++++++++++++++++++ include/linux/mfd/mc13783.h | 2 + 2 files changed, 37 insertions(+) diff -puN drivers/mfd/mc13783-core.c~mfd-mc13783-new-function-reading-irq-mask-and-status-register drivers/mfd/mc13783-core.c --- a/drivers/mfd/mc13783-core.c~mfd-mc13783-new-function-reading-irq-mask-and-status-register +++ a/drivers/mfd/mc13783-core.c @@ -269,6 +269,41 @@ int mc13783_irq_unmask(struct mc13783 *m } EXPORT_SYMBOL(mc13783_irq_unmask); +int mc13783_irq_status(struct mc13783 *mc13783, int irq, + int *enabled, int *pending) +{ + int ret; + unsigned int offmask = irq < 24 ? MC13783_IRQMASK0 : MC13783_IRQMASK1; + unsigned int offstat = irq < 24 ? MC13783_IRQSTAT0 : MC13783_IRQSTAT1; + u32 irqbit = 1 << (irq < 24 ? irq : irq - 24); + + if (irq < 0 || irq >= MC13783_NUM_IRQ) + return -EINVAL; + + if (enabled) { + u32 mask; + + ret = mc13783_reg_read(mc13783, offmask, &mask); + if (ret) + return ret; + + *enabled = mask & irqbit; + } + + if (pending) { + u32 stat; + + ret = mc13783_reg_read(mc13783, offstat, &stat); + if (ret) + return ret; + + *pending = stat & irqbit; + } + + return 0; +} +EXPORT_SYMBOL(mc13783_irq_status); + int mc13783_irq_ack(struct mc13783 *mc13783, int irq) { unsigned int offstat = irq < 24 ? MC13783_IRQSTAT0 : MC13783_IRQSTAT1; diff -puN include/linux/mfd/mc13783.h~mfd-mc13783-new-function-reading-irq-mask-and-status-register include/linux/mfd/mc13783.h --- a/include/linux/mfd/mc13783.h~mfd-mc13783-new-function-reading-irq-mask-and-status-register +++ a/include/linux/mfd/mc13783.h @@ -29,6 +29,8 @@ int mc13783_irq_free(struct mc13783 *mc1 int mc13783_irq_mask(struct mc13783 *mc13783, int irq); int mc13783_irq_unmask(struct mc13783 *mc13783, int irq); +int mc13783_irq_status(struct mc13783 *mc13783, int irq, + int *enabled, int *pending); int mc13783_irq_ack(struct mc13783 *mc13783, int irq); static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated; _ Patches currently in -mm which might be from u.kleine-koenig@xxxxxxxxxxxxxx are origin.patch linux-next.patch hrtimer-correct-a-few-numbers-in-comments.patch clockevents-ensure-taht-min_delta_ns-is-increased-in-error-path.patch timer-print-function-name-for-timer-callbacks-modifying-preemption-count.patch genirq-warn-about-irqf_sharedirqf_disabled-at-the-right-place.patch rtc-pcf2123-move-pcf2123_remove-to-devexittext.patch rtc-hctosys-only-claim-the-rtc-provided-the-system-time-if-it-did.patch mc13783-rename-mc13783_unmaskack_irq-to-have-a-mc13783_irq-prefix.patch input-mc13783-ts-dont-use-deprecated-mc13783-api-calls.patch rtc-mc13783-dont-use-deprecated-mc13783-api-calls.patch mfd-mc13783-new-function-reading-irq-mask-and-status-register.patch rtc-mc13783-protect-rtc-unregistration-by-mc13783-lock.patch rtc-mc13783-implement-alarm.patch w1-mxc_w1-move-probe-and-remove-to-the-dev-text-area.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html