Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp2065607imm; Fri, 6 Jul 2018 11:10:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpciV2gDRpzTZUfEM2g/K4sjVs+HiRBwnOCCaN2WrncTpSmta5Q+5R+MA+mD6oikHb1NncaV X-Received: by 2002:a62:21c3:: with SMTP id o64-v6mr11581310pfj.21.1530900632384; Fri, 06 Jul 2018 11:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530900632; cv=none; d=google.com; s=arc-20160816; b=V8Y79Ebo3nyhkGyo9MwS8Z/r4W3vi5G1YNkTzVg0ksmiugZ5oxIAZkuW4+1mIhxdKB JpzZ1sEz9/ej8tSCOwItrG/cxeVuC5yJMFXrrlohIliP4fX3h/46SnpmhPBIkcAPNag8 UiDtA25mTO6qkUxvuW235N1IXo0/536B5AxdJ//GgEhR33avVlswxBc5DnSe8g9SeOsw yEkeEW+UErxc236jsspuwGwp1prJovSIaFoefing2oEAdkcu/ZIDQWDpP77kpgpd/JSy gXAcQXBhOMo7XtpLyW63Sn4dn7rScEwBfUbi12iBC/Q5KvETMbWVIDgGkjKOoWZ8qQpd jUaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=8APCaDQmvgHfVUNMYRrWGZcrrA9ekA9Anra8k1sTqg4=; b=ngXB5+9HqZ0pae2jOhodxVJMDjoVeV8RdxWcvl8JDvIe4RhE0TQG5om9zHfAiQxrHk auIHRFadZ14MSJ8y1t6QjBQnY554b9hzo7n8aoi07An/LQJac7J2npN7F7hDbs+PVo2H PRWEVvwviNCxz4wV3jKj0dnHsVe5EYi0oezZsxyZvn9/1hha7DhjnWb+p1cNwO6fCw33 Yn1QN9CAwRZK94hJ+RSXypZkfOxUZvIK9Yrl3fbGmTAw5ZMN3JNOI+dg3y9CRSZGAv5W bmey6AkWBoO3WZtEnnzSMrI8LH8WFh6rbw7Igt4onJZpBIgIP5SWdsZrV0Ua1/pvV8Ng BZWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PO8dDQpY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1-v6si8411000pgf.515.2018.07.06.11.10.14; Fri, 06 Jul 2018 11:10:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PO8dDQpY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934129AbeGFSJ3 (ORCPT + 99 others); Fri, 6 Jul 2018 14:09:29 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:37796 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934048AbeGFSJ0 (ORCPT ); Fri, 6 Jul 2018 14:09:26 -0400 Received: by mail-pf0-f195.google.com with SMTP id h20-v6so9044138pfn.4 for ; Fri, 06 Jul 2018 11:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8APCaDQmvgHfVUNMYRrWGZcrrA9ekA9Anra8k1sTqg4=; b=PO8dDQpYzK5HMJhyW4ttrIU3qZQ+OxpnN+LFFJkPQbWQC2kCMSZYTTKYRgB7jSOak0 uGnNZZo2qQIRb+8b9zn53hx898ylZk9onrVgKlu+wH5WlkVLMP+JKpMqxPYEDRAcazzz yuA1ojcCQqp818XGslzGQI+Pt5kxFNM/1jb1k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8APCaDQmvgHfVUNMYRrWGZcrrA9ekA9Anra8k1sTqg4=; b=ZsJ5Td1nku/g6EZX9fVlZu/9xYN6BmoDLop3itwUPLnKw4TJtzSFq006DVTx5+sQg1 alIh0R5H8QEG4yeCaWoH3lI9XccQeKPJuiZcewa469RSiAFlbdaJ7THjHnY57JypocYO EdPbIoL5zFM7Bm1vYGjvvz+v/EYh6rIuVlqlEcFeQ9IaVXjLhd8FfoemcSA79pjeXAyc j3Ft9foxm9YervkHPLBxJqKd8810mQ4dI8TDZ3XR+o4f9EmyAR7tNa79WqsSTObseKeI j29NXEs76oCJ81BFy9UwgLuGt/J3wartNxATLWQ1RaV0vQt27pw/KydM7Y91yhtxOnHQ 0d2g== X-Gm-Message-State: APt69E3xKzpwzJUJBF02DUHgaHWQUTibTL4U1g+WchgjFbpnHMcRIvIC txpr4KH6hc1evxmMp7Gw0HL2KA== X-Received: by 2002:a62:2785:: with SMTP id n127-v6mr11639517pfn.129.1530900564956; Fri, 06 Jul 2018 11:09:24 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id k71-v6sm22545422pga.62.2018.07.06.11.09.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jul 2018 11:09:24 -0700 (PDT) Date: Fri, 6 Jul 2018 11:09:23 -0700 From: Matthias Kaehlcke To: Chanwoo Choi Cc: MyungJoo Ham , Kyungmin Park , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Brian Norris , Douglas Anderson , Enric Balletbo i Serra , "Rafael J . Wysocki" , Viresh Kumar , Lee Jones , Benson Leung , Olof Johansson Subject: Re: [PATCH v5 07/12] PM / devfreq: export devfreq_class Message-ID: <20180706180923.GH129942@google.com> References: <20180703234705.227473-1-mka@chromium.org> <20180703234705.227473-8-mka@chromium.org> <5B3C5B78.6020401@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5B3C5B78.6020401@samsung.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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