[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20120229232457.GA12803@ioremap.net>
Date: Thu, 1 Mar 2012 02:24:57 +0300
From: Evgeniy Polyakov <zbr@...emap.net>
To: Renata Sayakhova <rsayakhova@...il.com>
Cc: linux-kernel@...r.kernel.org, greg@...ah.com
Subject: Re: [PATCH] DS2781 Maxim Stand-Alone Fuel Gauge battery and w1
slave drivers
On Thu, Mar 01, 2012 at 12:17:30AM +0100, Renata Sayakhova (rsayakhova@...il.com) wrote:
> w1_process (w1.c line 982) holds mutex. If during w1_search_process (w1.c
> line 983) slave is found and battery initcall is already done at this
> moment than battery probe() is called. This call leads to
> power_supply_register() and device_add() which does among other things call
> battery properties. battery_get_property() should normally results in
> w1_ds2781_read() and w1_ds2781_io(), but w1_ds2781_io() calls itself
> mutex_lock.
>
> So this weird function is a workaround to avoid a second mutex_lock during
> battery probe(). mutex_holder is set before power_supply_register() and
> unset when probe is done.
>
> This is very brief, if it's not clear I'll try to explain in more details.
> I found this workaround in implementation of ds2780 battery and w1 slave
> drivers.
So basically IO routins caled from ->probe() are already locked so we
protect against deadlock. Ok, I see.
I have no objections, patch looks good
Greg, please pull it into your tree
Thank you
Acked-by: Evgeniy Polyakov <zbr@...emap.net>
--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists