modification of tp-smapi module for -rt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I use an out of tree module called tp-smapi, which is basically an
advanced battery control module for thinkpads.
This module uses a couple of mutexes which I had to modify for it to
build with the latest .31.12-rt20.

However, I'm clueless about this, so basically what I did was look at
the rt patch for similar sections and change it in the tp-smapi
source.

Can anyone please have a look at what I've done and tell me if its
correct or not? The module appears to work correctly but you never
know.

I replaced a
static DECLARE_MUTEX(thinkpad_ec_mutex);
with a
static DEFINE_SEMAPHORE(thinkpad_ec_mutex);

This is called in
-----------------------------------------------------------------------------
/**
 * thinkpad_ec_lock - get lock on the ThinkPad EC
 *
 * Get exclusive lock for accesing the ThinkPad embedded controller LPC3
 * interface. Returns 0 iff lock acquired.
 */
int thinkpad_ec_lock(void)
{
	int ret;
	ret = down_interruptible(&thinkpad_ec_mutex);
	return ret;
}
EXPORT_SYMBOL_GPL(thinkpad_ec_lock);

/**
 * thinkpad_ec_try_lock - try getting lock on the ThinkPad EC
 *
 * Try getting an exclusive lock for accesing the ThinkPad embedded
 * controller LPC3. Returns immediately if lock is not available; neither
 * blocks nor sleeps. Returns 0 iff lock acquired .
 */
int thinkpad_ec_try_lock(void)
{
	return down_trylock(&thinkpad_ec_mutex);
}
EXPORT_SYMBOL_GPL(thinkpad_ec_try_lock);

/**
 * thinkpad_ec_unlock - release lock on ThinkPad EC
 *
 * Release a previously acquired exclusive lock on the ThinkPad ebmedded
 * controller LPC3 interface.
 */
void thinkpad_ec_unlock(void)
{
	up(&thinkpad_ec_mutex);
}
EXPORT_SYMBOL_GPL(thinkpad_ec_unlock);
------------------------------------------------------------------

Then I replaced a
static DECLARE_MUTEX(smapi_mutex);
with a
static DEFINE_MUTEX(smapi_mutex);

which is called in various other code sections with
down(&smapi_mutex);
and
up(&smapi_mutex);


Please let me know if this is enough, or if you need to look into the code!

Your help is much appreciated.

Regards,
Pedro
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux