Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp272078pxb; Thu, 25 Feb 2021 02:00:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJw44jQq214+g3cxx4MHjTwX6w5rDDn+POkNOd44DujMEFkyv+tH8GpabZkw2zUdSoUwy6Fu X-Received: by 2002:a17:906:ca58:: with SMTP id jx24mr1910401ejb.482.1614247206445; Thu, 25 Feb 2021 02:00:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614247206; cv=none; d=google.com; s=arc-20160816; b=ZBP3S01uCaXTfKWEKH+sdCTvaLcoS10wgXyE5VHEIyfAs6OE2LZ6cZIsdB0hU6vL9b hy30PdGSFOxsXEdQzksEl5rxMO7jOL8jHuTfeeeFdGEWyk7K6ADlK4Uy+CptsxJjy6ZY bo6twGitX5S/bB4m4FAExeJcDfLtibtMml6CcmLVvM3k87OWFY8PRGFxdkf1hC6hZMGm nlZ5a325wmKrDLYwemLSCDdt7F9qnV063Fr7PQsWWyohQ1j7Sqi4AXAlhyCzdBKlQh63 bK6N43QOVOGkoAEH4zMYopRZjDjEMvvj92fny7ihF6RX+K+pyvX+JEi25kdNSKzzrlYy hIOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=WRPMY3HLN/5Zm3ICX+JJnR9sGvR6KOsPLtVh8QN7bz8=; b=ruKeuw5R/hocDHzcbVyV+e8AHwfCcjNKGZDPOqXLhCpE2UdtALvPDsxIC8Z5+aFR8z Foze70LrBsUg62QU1Mpqv5VUaf+Oc/LmZcKYsf4cmJDt7YCcI00VmmHvL8wzw/Gcph9W hzVTQJjb2j7vb8t7qbNad+5V1cSTU5pUoqhNV2sa79KP430Ol4P3nUO9J0n2iGf6odVj LYPrsL3Dbc3GzajNRe420nthRN3EpRdbYjxpyk51U43HbMBGbXBxNg8tkeNggGhn8za0 Nkr3xDASnXStGtkr9OiKeTnvKN3MYC8btZpUxOfuNEMLRBXBq4eKq79Job3io3h2gBmK oLBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si3088344edq.184.2021.02.25.01.59.44; Thu, 25 Feb 2021 02:00:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235816AbhBYJPC (ORCPT + 99 others); Thu, 25 Feb 2021 04:15:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236161AbhBYJML (ORCPT ); Thu, 25 Feb 2021 04:12:11 -0500 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8224C06178C for ; Thu, 25 Feb 2021 01:11:30 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:bd01:18f7:df2b:b765]) by andre.telenet-ops.be with bizsmtp id ZMBS2400Z3wXKmD01MBTUz; Thu, 25 Feb 2021 10:11:27 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lFCgA-001asd-Hp; Thu, 25 Feb 2021 10:11:26 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1lFCgA-002sUX-0P; Thu, 25 Feb 2021 10:11:26 +0100 From: Geert Uytterhoeven To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J . Wysocki" , Mauro Carvalho Chehab Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] docs: driver-model: Remove obsolete device class documentation Date: Thu, 25 Feb 2021 10:11:24 +0100 Message-Id: <20210225091124.686078-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org None of this is valid since v2.5.69. Signed-off-by: Geert Uytterhoeven --- I started updating the document, until I realized that all of the typedefs, structures, functions, defines, and sysfs layout have been renamed, changed, or removed. So I think it's better (for an expert in the field) to start from scratch. --- .../driver-api/driver-model/class.rst | 149 ------------------ .../driver-api/driver-model/index.rst | 1 - 2 files changed, 150 deletions(-) delete mode 100644 Documentation/driver-api/driver-model/class.rst diff --git a/Documentation/driver-api/driver-model/class.rst b/Documentation/driver-api/driver-model/class.rst deleted file mode 100644 index fff55b80e86a54a4..0000000000000000 --- a/Documentation/driver-api/driver-model/class.rst +++ /dev/null @@ -1,149 +0,0 @@ -============== -Device Classes -============== - -Introduction -~~~~~~~~~~~~ -A device class describes a type of device, like an audio or network -device. The following device classes have been identified: - - - - -Each device class defines a set of semantics and a programming interface -that devices of that class adhere to. Device drivers are the -implementation of that programming interface for a particular device on -a particular bus. - -Device classes are agnostic with respect to what bus a device resides -on. - - -Programming Interface -~~~~~~~~~~~~~~~~~~~~~ -The device class structure looks like:: - - - typedef int (*devclass_add)(struct device *); - typedef void (*devclass_remove)(struct device *); - -See the kerneldoc for the struct class. - -A typical device class definition would look like:: - - struct device_class input_devclass = { - .name = "input", - .add_device = input_add_device, - .remove_device = input_remove_device, - }; - -Each device class structure should be exported in a header file so it -can be used by drivers, extensions and interfaces. - -Device classes are registered and unregistered with the core using:: - - int devclass_register(struct device_class * cls); - void devclass_unregister(struct device_class * cls); - - -Devices -~~~~~~~ -As devices are bound to drivers, they are added to the device class -that the driver belongs to. Before the driver model core, this would -typically happen during the driver's probe() callback, once the device -has been initialized. It now happens after the probe() callback -finishes from the core. - -The device is enumerated in the class. Each time a device is added to -the class, the class's devnum field is incremented and assigned to the -device. The field is never decremented, so if the device is removed -from the class and re-added, it will receive a different enumerated -value. - -The class is allowed to create a class-specific structure for the -device and store it in the device's class_data pointer. - -There is no list of devices in the device class. Each driver has a -list of devices that it supports. The device class has a list of -drivers of that particular class. To access all of the devices in the -class, iterate over the device lists of each driver in the class. - - -Device Drivers -~~~~~~~~~~~~~~ -Device drivers are added to device classes when they are registered -with the core. A driver specifies the class it belongs to by setting -the struct device_driver::devclass field. - - -sysfs directory structure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -There is a top-level sysfs directory named 'class'. - -Each class gets a directory in the class directory, along with two -default subdirectories:: - - class/ - `-- input - |-- devices - `-- drivers - - -Drivers registered with the class get a symlink in the drivers/ directory -that points to the driver's directory (under its bus directory):: - - class/ - `-- input - |-- devices - `-- drivers - `-- usb:usb_mouse -> ../../../bus/drivers/usb_mouse/ - - -Each device gets a symlink in the devices/ directory that points to the -device's directory in the physical hierarchy:: - - class/ - `-- input - |-- devices - | `-- 1 -> ../../../root/pci0/00:1f.0/usb_bus/00:1f.2-1:0/ - `-- drivers - - -Exporting Attributes -~~~~~~~~~~~~~~~~~~~~ - -:: - - struct devclass_attribute { - struct attribute attr; - ssize_t (*show)(struct device_class *, char * buf, size_t count, loff_t off); - ssize_t (*store)(struct device_class *, const char * buf, size_t count, loff_t off); - }; - -Class drivers can export attributes using the DEVCLASS_ATTR macro that works -similarly to the DEVICE_ATTR macro for devices. For example, a definition -like this:: - - static DEVCLASS_ATTR(debug,0644,show_debug,store_debug); - -is equivalent to declaring:: - - static devclass_attribute devclass_attr_debug; - -The bus driver can add and remove the attribute from the class's -sysfs directory using:: - - int devclass_create_file(struct device_class *, struct devclass_attribute *); - void devclass_remove_file(struct device_class *, struct devclass_attribute *); - -In the example above, the file will be named 'debug' in placed in the -class's directory in sysfs. - - -Interfaces -~~~~~~~~~~ -There may exist multiple mechanisms for accessing the same device of a -particular class type. Device interfaces describe these mechanisms. - -When a device is added to a device class, the core attempts to add it -to every interface that is registered with the device class. diff --git a/Documentation/driver-api/driver-model/index.rst b/Documentation/driver-api/driver-model/index.rst index 755016422269fb6e..4831bdd92e5cd42a 100644 --- a/Documentation/driver-api/driver-model/index.rst +++ b/Documentation/driver-api/driver-model/index.rst @@ -7,7 +7,6 @@ Driver Model binding bus - class design-patterns device devres -- 2.25.1