Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c750c0b authored by Mark A. Greer's avatar Mark A. Greer Committed by Greg Kroah-Hartman
Browse files

[PATCH] i2c: convert m41t00 to use a workqueue



The m41t00 i2c/rtc driver currently uses a tasklet to schedule
interrupt-level writes to the rtc.  This patch causes the driver
to use a workqueue instead.

Signed-off-by: default avatarMark A. Greer <mgreer@mvista.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 524465df
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/rtc.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/bcd.h>
#include <linux/mutex.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>


#include <asm/time.h>
#include <asm/time.h>
#include <asm/rtc.h>
#include <asm/rtc.h>
@@ -111,7 +112,7 @@ m41t00_get_rtc_time(void)
}
}


static void
static void
m41t00_set_tlet(ulong arg)
m41t00_set(void *arg)
{
{
	struct rtc_time	tm;
	struct rtc_time	tm;
	ulong	nowtime = *(ulong *)arg;
	ulong	nowtime = *(ulong *)arg;
@@ -146,8 +147,8 @@ m41t00_set_tlet(ulong arg)
}
}


static ulong new_time;
static ulong new_time;

static struct workqueue_struct *m41t00_wq;
DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time);
static DECLARE_WORK(m41t00_work, m41t00_set, &new_time);


int
int
m41t00_set_rtc_time(ulong nowtime)
m41t00_set_rtc_time(ulong nowtime)
@@ -155,9 +156,9 @@ m41t00_set_rtc_time(ulong nowtime)
	new_time = nowtime;
	new_time = nowtime;


	if (in_interrupt())
	if (in_interrupt())
		tasklet_schedule(&m41t00_tasklet);
		queue_work(m41t00_wq, &m41t00_work);
	else
	else
		m41t00_set_tlet((ulong)&new_time);
		m41t00_set(&new_time);


	return 0;
	return 0;
}
}
@@ -189,6 +190,7 @@ m41t00_probe(struct i2c_adapter *adap, int addr, int kind)
		return rc;
		return rc;
	}
	}


	m41t00_wq = create_singlethread_workqueue("m41t00");
	save_client = client;
	save_client = client;
	return 0;
	return 0;
}
}
@@ -206,7 +208,7 @@ m41t00_detach(struct i2c_client *client)


	if ((rc = i2c_detach_client(client)) == 0) {
	if ((rc = i2c_detach_client(client)) == 0) {
		kfree(client);
		kfree(client);
		tasklet_kill(&m41t00_tasklet);
		destroy_workqueue(m41t00_wq);
	}
	}
	return rc;
	return rc;
}
}