[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180706180923.GH129942@google.com>
Date: Fri, 6 Jul 2018 11:09:23 -0700
From: Matthias Kaehlcke <mka@...omium.org>
To: Chanwoo Choi <cw00.choi@...sung.com>
Cc: MyungJoo Ham <myungjoo.ham@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Brian Norris <briannorris@...omium.org>,
Douglas Anderson <dianders@...omium.org>,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
"Rafael J . Wysocki" <rjw@...ysocki.net>,
Viresh Kumar <viresh.kumar@...aro.org>,
Lee Jones <lee.jones@...aro.org>,
Benson Leung <bleung@...omium.org>,
Olof Johansson <olof@...om.net>
Subject: Re: [PATCH v5 07/12] PM / devfreq: export devfreq_class
Hi,
On Wed, Jul 04, 2018 at 02:30:32PM +0900, Chanwoo Choi wrote:
> I didn't see any framework which exporting the class instance.
> It is very dangerous. Unknown device drivers is able to reset
> the 'devfreq_class' instance. I can't agree this approach.
While I agree that it is potential dangerous it is actually a common
practice to export the class:
grep "extern struct class " include/linux/ -R
include/linux/rio.h:extern struct class rio_mport_class;
include/linux/tty.h:extern struct class *tty_class;
include/linux/fb.h:extern struct class *fb_class;
include/linux/ide.h:extern struct class *ide_port_class;
include/linux/device.h:extern struct class * __must_check __class_create(struct module *owner,
include/linux/devfreq.h:extern struct class *devfreq_class;
include/linux/switchtec.h:extern struct class *switchtec_class;
include/linux/input.h:extern struct class input_class;
include/linux/genhd.h:extern struct class block_class;
include/linux/power_supply.h:extern struct class *power_supply_class;
include/linux/rtc.h:extern struct class *rtc_class;
struct class_interface and class_interface_register() would be
pointless without exported classes.
My understanding is that the kernel is often lax on encapsulation and
exposes private/delicate data pragmatically within the kernel when
needed because "the kernel trusts itself".
Thanks
Matthias
Powered by blists - more mailing lists