lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 10 Oct 2013 03:07:15 +0200
From:	"Rafael J. Wysocki" <rjw@...ysocki.net>
To:	Aaron Lu <aaron.lu@...el.com>
Cc:	linux-acpi@...r.kernel.org, intel-gfx@...ts.freedesktop.org,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	Daniel Vetter <daniel@...ll.ch>,
	Matthew Garrett <matthew.garrett@...ula.com>,
	Seth Forshee <seth.forshee@...onical.com>,
	Lee Chun-Yi <joeyli.kernel@...il.com>,
	Richard Purdie <rpurdie@...ys.net>,
	Igor Gnatenko <i.gnatenko.brain@...il.com>,
	Yves-Alexis Perez <corsac@...ian.org>,
	Felipe Contreras <felipe.contreras@...il.com>,
	Jani Nikula <jani.nikula@...ux.intel.com>,
	Ben Jencks <ben@...ncks.net>,
	Steven Newbury <steve@...wbury.org.uk>,
	James Hogan <james@...anarts.com>,
	Kamal Mostafa <kamal@...onical.com>,
	Joerg Platte <jplatte@...sa.net>,
	Kalle Valo <kvalo@...rom.com>,
	Martin Steigerwald <Martin@...htvoll.de>,
	Jörg Otte <jrg.otte@...il.com>,
	Mike Galbraith <bitbucket@...ine.de>,
	platform-driver-x86@...r.kernel.org,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Henrique de Moraes Holschuh <hmh@....eng.br>
Subject: Re: [PATCH v4 1/4] backlight: introduce backlight_device_registered

On Thursday, October 10, 2013 08:54:29 AM Aaron Lu wrote:
> On 10/10/2013 08:25 AM, Rafael J. Wysocki wrote:
> > On Tuesday, October 08, 2013 02:39:58 PM Aaron Lu wrote:
> >> Introduce a new API for modules to query if a specific type of backlight
> >> device has been registered. This is useful for some backlight device
> >> provider module(e.g. ACPI video) to know if a native control
> >> interface(e.g. the interface created by i915) is available and then do
> >> things accordingly(e.g. avoid register its own on Win8 systems).
> >>
> >> Signed-off-by: Aaron Lu <aaron.lu@...el.com>
> >> Tested-by: Igor Gnatenko <i.gnatenko.brain@...il.com>
> >> Tested-by: Yves-Alexis Perez <corsac@...ian.org>
> >> Tested-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
> >> ---
> >>  drivers/video/backlight/backlight.c | 31 +++++++++++++++++++++++++++++++
> >>  include/linux/backlight.h           |  4 ++++
> >>  2 files changed, 35 insertions(+)
> >>
> >> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> >> index 94a403a..bf2d71d 100644
> >> --- a/drivers/video/backlight/backlight.c
> >> +++ b/drivers/video/backlight/backlight.c
> >> @@ -21,6 +21,9 @@
> >>  #include <asm/backlight.h>
> >>  #endif
> >>  
> >> +static struct list_head bd_list_head;
> >> +static struct mutex bd_list_mutex;
> > 
> > I'd prefer these two things to be called backlight_dev_list and
> > backlight_dev_list_mutex, respectively.
> 
> OK.
> 
> > 
> >> +
> >>  static const char *const backlight_types[] = {
> >>  	[BACKLIGHT_RAW] = "raw",
> >>  	[BACKLIGHT_PLATFORM] = "platform",
> >> @@ -349,10 +352,32 @@ struct backlight_device *backlight_device_register(const char *name,
> >>  	mutex_unlock(&pmac_backlight_mutex);
> >>  #endif
> >>  
> >> +	mutex_lock(&bd_list_mutex);
> >> +	list_add(&new_bd->entry, &bd_list_head);
> >> +	mutex_unlock(&bd_list_mutex);
> >> +
> >>  	return new_bd;
> >>  }
> >>  EXPORT_SYMBOL(backlight_device_register);
> >>  
> >> +bool backlight_device_registered(enum backlight_type type)
> >> +{
> >> +	bool found = false;
> >> +	struct backlight_device *bd;
> >> +
> >> +	mutex_lock(&bd_list_mutex);
> >> +	list_for_each_entry(bd, &bd_list_head, entry) {
> >> +		if (bd->props.type == type) {
> >> +			found = true;
> >> +			break;
> >> +		}
> >> +	}
> > 
> > Isn't it useful to be able to register more than one backlight device of the
> > same type sometimes?
> 
> I think so for some kind of computers. OTOH, the above function should
> be enough for the problem we are solving here, if someday we need to
> differentiate, we can enhance the code then.

OK

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ