From: Evgeniy Polyakov <zbr@ioremap.net>
To: Renata Sayakhova <rsayakhova@gmail.com>
Cc: linux-kernel@vger.kernel.org, greg@kroah.com
Subject: Re: [PATCH] DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers
Date: Thu, 1 Mar 2012 02:24:57 +0300 [thread overview]
Message-ID: <20120229232457.GA12803@ioremap.net> (raw)
In-Reply-To: <CAO0_4pY_MXgx1gFRK9ino0P9RAO3e3E00PFCJvjpq2A-6Oz=1Q@mail.gmail.com>
On Thu, Mar 01, 2012 at 12:17:30AM +0100, Renata Sayakhova (rsayakhova@gmail.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@ioremap.net>
--
Evgeniy Polyakov
prev parent reply other threads:[~2012-02-29 23:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 13:58 [PATCH 0001] DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers Renata Sayakhova
2012-02-29 13:58 ` [PATCH] " Renata Sayakhova
2012-02-29 18:52 ` Evgeniy Polyakov
[not found] ` <CAO0_4pY_MXgx1gFRK9ino0P9RAO3e3E00PFCJvjpq2A-6Oz=1Q@mail.gmail.com>
2012-02-29 23:24 ` Evgeniy Polyakov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120229232457.GA12803@ioremap.net \
--to=zbr@ioremap.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rsayakhova@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.