From: Andrew Morton <akpm@linux-foundation.org>
To: Vignesh R <vigneshr@ti.com>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Evgeniy Polyakov <zbr@ioremap.net>,
Jonathan Corbet <corbet@lwn.net>,
Tony Lindgren <tony@atomide.com>, NeilBrown <neilb@suse.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Fabian Frederick <fabf@skynet.be>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v2] w1: masters: omap_hdq: Add support for 1-wire mode
Date: Thu, 28 May 2015 14:27:29 -0700 [thread overview]
Message-ID: <20150528142729.45a8e3abf3f7a8b59bdfc1ce@linux-foundation.org> (raw)
In-Reply-To: <1431950959-19606-1-git-send-email-vigneshr@ti.com>
On Mon, 18 May 2015 17:39:19 +0530 Vignesh R <vigneshr@ti.com> wrote:
> This patches makes following changes to omap_hdq driver
> - Enable 1-wire mode.
> - Implement w1_triplet callback to facilitate search rom
> procedure and auto detection of 1-wire slaves.
> - Proper enabling and disabling of interrupt.
> - Cleanups (formatting and return value checks).
>
> HDQ mode remains unchanged.
>
> ...
>
> +/*
> + * W1 triplet callback function - used for searching ROM addresses.
> + * Registered only when controller is in 1-wire mode.
> + */
> +static u8 omap_w1_triplet(void *_hdq, u8 bdir)
> +{
> + u8 id_bit, comp_bit;
> + int err;
> + u8 ret = 0x3; /* no slaves responded */
> + struct hdq_data *hdq_data = _hdq;
> + u8 ctrl = OMAP_HDQ_CTRL_STATUS_SINGLE | OMAP_HDQ_CTRL_STATUS_GO |
> + OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK;
> + u8 mask = ctrl | OMAP_HDQ_CTRL_STATUS_DIR;
> +
> + omap_hdq_get(_hdq);
> +
> + err = mutex_lock_interruptible(&hdq_data->hdq_mutex);
> + if (err < 0) {
> + dev_dbg(hdq_data->dev, "Could not acquire mutex\n");
> + goto rtn;
> + }
The use of mutex_lock_interruptible() seems like a bad idea. It means
that if the calling process (modprobe?) has a signal pending,
w1_search() will think that "no device responded". That isn't really
true - a true statement is "user hit ^C". I'm not sure what the
overall runtime effect of this will be, but I bet it hasn't been
tested!
Wouldn't it be saner/safer to use plain old mutex_lock() here?
prev parent reply other threads:[~2015-05-28 21:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 12:09 [PATCH v2] w1: masters: omap_hdq: Add support for 1-wire mode Vignesh R
2015-05-25 5:15 ` Vignesh R
2015-06-11 15:34 ` Evgeniy Polyakov
2015-06-12 5:23 ` Vignesh R
2015-05-28 21:27 ` Andrew Morton [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=20150528142729.45a8e3abf3f7a8b59bdfc1ce@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=fabf@skynet.be \
--cc=galak@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=neilb@suse.de \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=tony@atomide.com \
--cc=vigneshr@ti.com \
--cc=zbr@ioremap.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).