From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: righi.andrea@gmail.com
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Dave Jones <davej@redhat.com>,
Johannes Weiner <hannes@saeurebad.de>,
Krzysztof Helt <krzysztof.h1@wp.pl>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fbmem: fix copy_from/to_user() with mutex held
Date: Mon, 19 Jan 2009 08:58:40 +0100 [thread overview]
Message-ID: <497432B0.1080201@s5r6.in-berlin.de> (raw)
In-Reply-To: <49738E4B.1030200@gmail.com>
Andrea Righi wrote:
> +struct fb_info *get_fb_info(struct fb_info *info)
> +__acquires(&info->lock)
> +{
> + mutex_lock(&info->lock);
> + if (!info->fbops) {
> + mutex_unlock(&info->lock);
> + return NULL;
> + }
> + return info;
> +}
> +
> +void put_fb_info(struct fb_info *info)
> +__releases(&info->lock)
> +{
> + mutex_unlock(&info->lock);
> +}
> +
These are IMO bad function names. get_... and put_... sound too much
like functions that either read or write data, or increment and
decrement the reference count of data. These names don't reflect that
the sole purpose of these functions is to lock and unlock a mutex (i.e.
to serialize some critical sections).
*If* you really need to hide mutex_(un)lock(&info->lock) inside
wrappers, then the names of these wrappers should clearly state what
they do, so that everybody knows immediately what is going on at the
call sites.
--
Stefan Richter
-=====-==--= ---= =--==
http://arcgraph.de/sr/
next prev parent reply other threads:[~2009-01-19 7:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-17 23:19 .29rc2 lockdep report. fb_mmap vs sys_mmap2 Dave Jones
2009-01-18 2:00 ` Johannes Weiner
2009-01-18 19:21 ` Andrea Righi
2009-01-18 20:17 ` [PATCH] fbmem: fix copy_from/to_user() with mutex held Andrea Righi
2009-01-19 7:54 ` Johannes Weiner
2009-01-19 7:58 ` Stefan Richter [this message]
2009-01-19 8:05 ` Stefan Richter
2009-01-19 8:10 ` Harvey Harrison
2009-01-19 8:29 ` Andrea Righi
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=497432B0.1080201@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hannes@saeurebad.de \
--cc=krzysztof.h1@wp.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=righi.andrea@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 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®