x86: GEODE: MFGPT: drop module owner usage from MFGPT API
We had planned to use the 'owner' field for allowing re-allocation of MFGPTs; however, doing it by module owner name isn't flexible enough. So, drop this for now. If it turns out that we need timers in modules, we'll need to come up with a scheme that matches the write-once fields of the MFGPTx_SETUP register, and drops ponies from the sky. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
36445cf306
commit
fa28e067c3
|
@ -30,14 +30,12 @@
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/module.h>
|
|
||||||
#include <asm/geode.h>
|
#include <asm/geode.h>
|
||||||
|
|
||||||
#define F_AVAIL 0x01
|
#define F_AVAIL 0x01
|
||||||
|
|
||||||
static struct mfgpt_timer_t {
|
static struct mfgpt_timer_t {
|
||||||
int flags;
|
int flags;
|
||||||
struct module *owner;
|
|
||||||
} mfgpt_timers[MFGPT_MAX_TIMERS];
|
} mfgpt_timers[MFGPT_MAX_TIMERS];
|
||||||
|
|
||||||
/* Selected from the table above */
|
/* Selected from the table above */
|
||||||
|
@ -182,15 +180,14 @@ int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mfgpt_get(int timer, struct module *owner)
|
static int mfgpt_get(int timer)
|
||||||
{
|
{
|
||||||
mfgpt_timers[timer].flags &= ~F_AVAIL;
|
mfgpt_timers[timer].flags &= ~F_AVAIL;
|
||||||
mfgpt_timers[timer].owner = owner;
|
|
||||||
printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer);
|
printk(KERN_INFO "geode-mfgpt: Registered timer %d\n", timer);
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner)
|
int geode_mfgpt_alloc_timer(int timer, int domain)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -203,7 +200,7 @@ int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner)
|
||||||
/* Try to find an available timer */
|
/* Try to find an available timer */
|
||||||
for (i = 0; i < MFGPT_MAX_TIMERS; i++) {
|
for (i = 0; i < MFGPT_MAX_TIMERS; i++) {
|
||||||
if (mfgpt_timers[i].flags & F_AVAIL)
|
if (mfgpt_timers[i].flags & F_AVAIL)
|
||||||
return mfgpt_get(i, owner);
|
return mfgpt_get(i);
|
||||||
|
|
||||||
if (i == 5 && domain == MFGPT_DOMAIN_WORKING)
|
if (i == 5 && domain == MFGPT_DOMAIN_WORKING)
|
||||||
break;
|
break;
|
||||||
|
@ -211,7 +208,7 @@ int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner)
|
||||||
} else {
|
} else {
|
||||||
/* If they requested a specific timer, try to honor that */
|
/* If they requested a specific timer, try to honor that */
|
||||||
if (mfgpt_timers[timer].flags & F_AVAIL)
|
if (mfgpt_timers[timer].flags & F_AVAIL)
|
||||||
return mfgpt_get(timer, owner);
|
return mfgpt_get(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No timers available - too bad */
|
/* No timers available - too bad */
|
||||||
|
@ -324,8 +321,7 @@ static int __init mfgpt_timer_setup(void)
|
||||||
int timer, ret;
|
int timer, ret;
|
||||||
u16 val;
|
u16 val;
|
||||||
|
|
||||||
timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING,
|
timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
|
||||||
THIS_MODULE);
|
|
||||||
if (timer < 0) {
|
if (timer < 0) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"mfgpt-timer: Could not allocate a MFPGT timer\n");
|
"mfgpt-timer: Could not allocate a MFPGT timer\n");
|
||||||
|
|
|
@ -209,7 +209,7 @@ static inline u16 geode_mfgpt_read(int timer, u16 reg)
|
||||||
extern int __init geode_mfgpt_detect(void);
|
extern int __init geode_mfgpt_detect(void);
|
||||||
extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable);
|
extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable);
|
||||||
extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable);
|
extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable);
|
||||||
extern int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner);
|
extern int geode_mfgpt_alloc_timer(int timer, int domain);
|
||||||
|
|
||||||
#define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1)
|
#define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1)
|
||||||
#define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0)
|
#define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0)
|
||||||
|
|
Loading…
Reference in New Issue