From: Bart Van Assche <bvanassche@acm.org>
To: Sean Anderson <sean.anderson@linux.dev>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
"open list:DRM DRIVERS FOR XILINX"
<dri-devel@lists.freedesktop.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
"moderated list:ARM/ZYNQ ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>,
David Airlie <airlied@gmail.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Michal Simek <michal.simek@amd.com>,
Maxime Ripard <mripard@kernel.org>,
Simona Vetter <simona@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers
Date: Thu, 6 Feb 2025 12:31:14 -0800 [thread overview]
Message-ID: <373d62da-810f-492c-af2f-53b32cc90b33@acm.org> (raw)
In-Reply-To: <20250206194117.1496245-3-sean.anderson@linux.dev>
On 2/6/25 11:41 AM, Sean Anderson wrote:
> static int zynqmp_dp_enhanced_set(void *data, u64 val)
> {
> struct zynqmp_dp *dp = data;
> - int ret = 0;
>
> - mutex_lock(&dp->lock);
> + guard(mutex)(&dp->lock);
> dp->test.enhanced = val;
> if (dp->test.active)
> - ret = zynqmp_dp_test_setup(dp);
> - mutex_unlock(&dp->lock);
> + return zynqmp_dp_test_setup(dp);
>
> - return ret;
> + return 0;
> }
Has it been considered to combine the two return statements into one
with the ternary operator (?:)?
> static int zynqmp_dp_downspread_set(void *data, u64 val)
> {
> struct zynqmp_dp *dp = data;
> - int ret = 0;
>
> - mutex_lock(&dp->lock);
> + guard(mutex)(&dp->lock);
> dp->test.downspread = val;
> if (dp->test.active)
> - ret = zynqmp_dp_test_setup(dp);
> - mutex_unlock(&dp->lock);
> + return zynqmp_dp_test_setup(dp);
>
> - return ret;
> + return 0;
> }
Same question here.
> @@ -2053,7 +2039,8 @@ static ssize_t zynqmp_dp_custom_read(struct file *file, char __user *user_buf,
> return ret;
>
> mutex_lock(&dp->lock);
> - ret = simple_read_from_buffer(user_buf, count, ppos, &dp->test.custom,
> + ret = simple_read_from_buffer(user_buf, count, ppos,
> + &dp->test.custom,
> sizeof(dp->test.custom));
This change has not been mentioned in the patch description and is not
related to the other changes in this patch?
> - return ret;
> + dp->test.link_cnt = val;
> + if (dp->test.active)
> + return zynqmp_dp_test_setup(dp);
> +
> + return 0;
> }
Has it been considered to use the ternary operator here?
Thanks,
Bart.
next prev parent reply other threads:[~2025-02-06 20:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 19:41 [PATCH 0/2] " Sean Anderson
2025-02-06 19:41 ` [PATCH 1/2] drm: zynqmp_dp: Fix a deadlock in zynqmp_dp_ignore_hpd_set() Sean Anderson
2025-02-06 19:41 ` [PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers Sean Anderson
2025-02-06 20:31 ` Bart Van Assche [this message]
2025-02-06 20:37 ` Sean Anderson
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=373d62da-810f-492c-af2f-53b32cc90b33@acm.org \
--to=bvanassche@acm.org \
--cc=airlied@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michal.simek@amd.com \
--cc=mripard@kernel.org \
--cc=sean.anderson@linux.dev \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®