linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] RFC: The beginning of a proper driver-api book
@ 2016-08-22 20:57 Jonathan Corbet
  2016-08-22 20:57 ` [PATCH 1/3] Docs: sphinxify device-drivers.tmpl Jonathan Corbet
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Jonathan Corbet @ 2016-08-22 20:57 UTC (permalink / raw)
  To: linux-doc
  Cc: linux-kernel, Jonathan Corbet, Jani Nikula,
	Mauro Carvalho Chehab, Sebastian Reichel

This short series convers device-drivers.tmpl into the RST format, splits
it up, and sets up the result under Documentation/driver-api/.  For added
fun, I've taken one top-level file (hsi.txt) and folded it into the
document as a way of showing the direction I'm thinking I would like things
to go.  There is plenty more of this sort of work that could be done, to
say the least - this is just a beginning!

The formatted results can be seen at:

    http://static.lwn.net/kerneldoc/driver-api/index.html

As part of the long-term task to turn Documentation/ into less of a horror
movie, I'd like to collect documentation of the driver-specific API here.
Arguably gpu/ and the media API stuff should eventually move here, though
we can discuss the color of that particular shed some other day.
Meanwhile, I'd appreciate comments on the general idea.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cc: Sebastian Reichel <sre@kernel.org>

Jonathan Corbet (3):
  Docs: sphinxify device-drivers.tmpl
  docs: split up the driver book
  docs: Pull HSI documentation together

 Documentation/DocBook/Makefile                 |   2 +-
 Documentation/DocBook/device-drivers.tmpl      | 521 -------------------------
 Documentation/driver-api/basics.rst            | 120 ++++++
 Documentation/driver-api/frame-buffer.rst      |  62 +++
 Documentation/driver-api/index.rst             |  24 ++
 Documentation/driver-api/infrastructure.rst    | 169 ++++++++
 Documentation/driver-api/input.rst             |  51 +++
 Documentation/driver-api/message-based.rst     |  30 ++
 Documentation/driver-api/miscellaneous.rst     |  50 +++
 Documentation/driver-api/serial-interfaces.rst | 189 +++++++++
 Documentation/driver-api/sound.rst             |  54 +++
 Documentation/hsi.txt                          |  75 ----
 Documentation/index.rst                        |   1 +
 MAINTAINERS                                    |   2 +-
 14 files changed, 752 insertions(+), 598 deletions(-)
 delete mode 100644 Documentation/DocBook/device-drivers.tmpl
 create mode 100644 Documentation/driver-api/basics.rst
 create mode 100644 Documentation/driver-api/frame-buffer.rst
 create mode 100644 Documentation/driver-api/index.rst
 create mode 100644 Documentation/driver-api/infrastructure.rst
 create mode 100644 Documentation/driver-api/input.rst
 create mode 100644 Documentation/driver-api/message-based.rst
 create mode 100644 Documentation/driver-api/miscellaneous.rst
 create mode 100644 Documentation/driver-api/serial-interfaces.rst
 create mode 100644 Documentation/driver-api/sound.rst
 delete mode 100644 Documentation/hsi.txt

-- 
2.7.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] Docs: sphinxify device-drivers.tmpl
  2016-08-22 20:57 [PATCH 0/3] RFC: The beginning of a proper driver-api book Jonathan Corbet
@ 2016-08-22 20:57 ` Jonathan Corbet
  2016-08-22 20:57 ` [PATCH 2/3] docs: split up the driver book Jonathan Corbet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Jonathan Corbet @ 2016-08-22 20:57 UTC (permalink / raw)
  To: linux-doc
  Cc: linux-kernel, Jonathan Corbet, Jani Nikula, Mauro Carvalho Chehab

Perform a basic sphinx conversion of the device-drivers docbook and move it
to its own directory.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/DocBook/Makefile            |   2 +-
 Documentation/DocBook/device-drivers.tmpl | 521 ------------------------
 Documentation/driver-api/drivers.rst      | 654 ++++++++++++++++++++++++++++++
 Documentation/index.rst                   |   1 +
 4 files changed, 656 insertions(+), 522 deletions(-)

diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index a91c96522379..5fbfb7273f38 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -6,7 +6,7 @@
 # To add a new book the only step required is to add the book to the
 # list of DOCBOOKS.
 
-DOCBOOKS := z8530book.xml device-drivers.xml \
+DOCBOOKS := z8530book.xml  \
 	    kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
 	    writing_usb_driver.xml networking.xml \
 	    kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl
deleted file mode 100644
index 9c10030eb2be..000000000000
--- a/Documentation/DocBook/device-drivers.tmpl
+++ /dev/null
@@ -1,521 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
-
-<book id="LinuxDriversAPI">
- <bookinfo>
-  <title>Linux Device Drivers</title>
-
-  <legalnotice>
-   <para>
-     This documentation is free software; you can redistribute
-     it and/or modify it under the terms of the GNU General Public
-     License as published by the Free Software Foundation; either
-     version 2 of the License, or (at your option) any later
-     version.
-   </para>
-
-   <para>
-     This program is distributed in the hope that it will be
-     useful, but WITHOUT ANY WARRANTY; without even the implied
-     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-     See the GNU General Public License for more details.
-   </para>
-
-   <para>
-     You should have received a copy of the GNU General Public
-     License along with this program; if not, write to the Free
-     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-     MA 02111-1307 USA
-   </para>
-
-   <para>
-     For more details see the file COPYING in the source
-     distribution of Linux.
-   </para>
-  </legalnotice>
- </bookinfo>
-
-<toc></toc>
-
-  <chapter id="Basics">
-     <title>Driver Basics</title>
-     <sect1><title>Driver Entry and Exit points</title>
-!Iinclude/linux/init.h
-     </sect1>
-
-     <sect1><title>Atomic and pointer manipulation</title>
-!Iarch/x86/include/asm/atomic.h
-     </sect1>
-
-     <sect1><title>Delaying, scheduling, and timer routines</title>
-!Iinclude/linux/sched.h
-!Ekernel/sched/core.c
-!Ikernel/sched/cpupri.c
-!Ikernel/sched/fair.c
-!Iinclude/linux/completion.h
-!Ekernel/time/timer.c
-     </sect1>
-     <sect1><title>Wait queues and Wake events</title>
-!Iinclude/linux/wait.h
-!Ekernel/sched/wait.c
-     </sect1>
-     <sect1><title>High-resolution timers</title>
-!Iinclude/linux/ktime.h
-!Iinclude/linux/hrtimer.h
-!Ekernel/time/hrtimer.c
-     </sect1>
-     <sect1><title>Workqueues and Kevents</title>
-!Iinclude/linux/workqueue.h
-!Ekernel/workqueue.c
-     </sect1>
-     <sect1><title>Internal Functions</title>
-!Ikernel/exit.c
-!Ikernel/signal.c
-!Iinclude/linux/kthread.h
-!Ekernel/kthread.c
-     </sect1>
-
-     <sect1><title>Kernel objects manipulation</title>
-<!--
-X!Iinclude/linux/kobject.h
--->
-!Elib/kobject.c
-     </sect1>
-
-     <sect1><title>Kernel utility functions</title>
-!Iinclude/linux/kernel.h
-!Ekernel/printk/printk.c
-!Ekernel/panic.c
-!Ekernel/sys.c
-!Ekernel/rcu/srcu.c
-!Ekernel/rcu/tree.c
-!Ekernel/rcu/tree_plugin.h
-!Ekernel/rcu/update.c
-     </sect1>
-
-     <sect1><title>Device Resource Management</title>
-!Edrivers/base/devres.c
-     </sect1>
-
-  </chapter>
-
-  <chapter id="devdrivers">
-     <title>Device drivers infrastructure</title>
-     <sect1><title>The Basic Device Driver-Model Structures </title>
-!Iinclude/linux/device.h
-     </sect1>
-     <sect1><title>Device Drivers Base</title>
-!Idrivers/base/init.c
-!Edrivers/base/driver.c
-!Edrivers/base/core.c
-!Edrivers/base/syscore.c
-!Edrivers/base/class.c
-!Idrivers/base/node.c
-!Edrivers/base/firmware_class.c
-!Edrivers/base/transport_class.c
-<!-- Cannot be included, because
-     attribute_container_add_class_device_adapter
- and attribute_container_classdev_to_container
-     exceed allowed 44 characters maximum
-X!Edrivers/base/attribute_container.c
--->
-!Edrivers/base/dd.c
-<!--
-X!Edrivers/base/interface.c
--->
-!Iinclude/linux/platform_device.h
-!Edrivers/base/platform.c
-!Edrivers/base/bus.c
-     </sect1>
-     <sect1>
-       <title>Buffer Sharing and Synchronization</title>
-       <para>
-         The dma-buf subsystem provides the framework for sharing buffers
-         for hardware (DMA) access across multiple device drivers and
-         subsystems, and for synchronizing asynchronous hardware access.
-       </para>
-       <para>
-         This is used, for example, by drm "prime" multi-GPU support, but
-         is of course not limited to GPU use cases.
-       </para>
-       <para>
-         The three main components of this are: (1) dma-buf, representing
-         a sg_table and exposed to userspace as a file descriptor to allow
-         passing between devices, (2) fence, which provides a mechanism
-         to signal when one device as finished access, and (3) reservation,
-         which manages the shared or exclusive fence(s) associated with
-         the buffer.
-       </para>
-       <sect2><title>dma-buf</title>
-!Edrivers/dma-buf/dma-buf.c
-!Iinclude/linux/dma-buf.h
-       </sect2>
-       <sect2><title>reservation</title>
-!Pdrivers/dma-buf/reservation.c Reservation Object Overview
-!Edrivers/dma-buf/reservation.c
-!Iinclude/linux/reservation.h
-       </sect2>
-       <sect2><title>fence</title>
-!Edrivers/dma-buf/fence.c
-!Iinclude/linux/fence.h
-!Edrivers/dma-buf/seqno-fence.c
-!Iinclude/linux/seqno-fence.h
-!Edrivers/dma-buf/fence-array.c
-!Iinclude/linux/fence-array.h
-!Edrivers/dma-buf/reservation.c
-!Iinclude/linux/reservation.h
-!Edrivers/dma-buf/sync_file.c
-!Iinclude/linux/sync_file.h
-       </sect2>
-     </sect1>
-     <sect1><title>Device Drivers DMA Management</title>
-!Edrivers/base/dma-coherent.c
-!Edrivers/base/dma-mapping.c
-     </sect1>
-     <sect1><title>Device Drivers Power Management</title>
-!Edrivers/base/power/main.c
-     </sect1>
-     <sect1><title>Device Drivers ACPI Support</title>
-<!-- Internal functions only
-X!Edrivers/acpi/sleep/main.c
-X!Edrivers/acpi/sleep/wakeup.c
-X!Edrivers/acpi/motherboard.c
-X!Edrivers/acpi/bus.c
--->
-!Edrivers/acpi/scan.c
-!Idrivers/acpi/scan.c
-<!-- No correct structured comments
-X!Edrivers/acpi/pci_bind.c
--->
-     </sect1>
-     <sect1><title>Device drivers PnP support</title>
-!Idrivers/pnp/core.c
-<!-- No correct structured comments
-X!Edrivers/pnp/system.c
- -->
-!Edrivers/pnp/card.c
-!Idrivers/pnp/driver.c
-!Edrivers/pnp/manager.c
-!Edrivers/pnp/support.c
-     </sect1>
-     <sect1><title>Userspace IO devices</title>
-!Edrivers/uio/uio.c
-!Iinclude/linux/uio_driver.h
-     </sect1>
-  </chapter>
-
-  <chapter id="parportdev">
-     <title>Parallel Port Devices</title>
-!Iinclude/linux/parport.h
-!Edrivers/parport/ieee1284.c
-!Edrivers/parport/share.c
-!Idrivers/parport/daisy.c
-  </chapter>
-
-  <chapter id="message_devices">
-	<title>Message-based devices</title>
-     <sect1><title>Fusion message devices</title>
-!Edrivers/message/fusion/mptbase.c
-!Idrivers/message/fusion/mptbase.c
-!Edrivers/message/fusion/mptscsih.c
-!Idrivers/message/fusion/mptscsih.c
-!Idrivers/message/fusion/mptctl.c
-!Idrivers/message/fusion/mptspi.c
-!Idrivers/message/fusion/mptfc.c
-!Idrivers/message/fusion/mptlan.c
-     </sect1>
-  </chapter>
-
-  <chapter id="snddev">
-     <title>Sound Devices</title>
-!Iinclude/sound/core.h
-!Esound/sound_core.c
-!Iinclude/sound/pcm.h
-!Esound/core/pcm.c
-!Esound/core/device.c
-!Esound/core/info.c
-!Esound/core/rawmidi.c
-!Esound/core/sound.c
-!Esound/core/memory.c
-!Esound/core/pcm_memory.c
-!Esound/core/init.c
-!Esound/core/isadma.c
-!Esound/core/control.c
-!Esound/core/pcm_lib.c
-!Esound/core/hwdep.c
-!Esound/core/pcm_native.c
-!Esound/core/memalloc.c
-<!-- FIXME: Removed for now since no structured comments in source
-X!Isound/sound_firmware.c
--->
-  </chapter>
-
-
-  <chapter id="uart16x50">
-     <title>16x50 UART Driver</title>
-!Edrivers/tty/serial/serial_core.c
-!Edrivers/tty/serial/8250/8250_core.c
-  </chapter>
-
-  <chapter id="fbdev">
-     <title>Frame Buffer Library</title>
-
-     <para>
-       The frame buffer drivers depend heavily on four data structures.
-       These structures are declared in include/linux/fb.h.  They are
-       fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
-       The last three can be made available to and from userland.
-     </para>
-
-     <para>
-       fb_info defines the current state of a particular video card.
-       Inside fb_info, there exists a fb_ops structure which is a
-       collection of needed functions to make fbdev and fbcon work.
-       fb_info is only visible to the kernel.
-     </para>
-
-     <para>
-       fb_var_screeninfo is used to describe the features of a video card
-       that are user defined.  With fb_var_screeninfo, things such as
-       depth and the resolution may be defined.
-     </para>
-
-     <para>
-       The next structure is fb_fix_screeninfo. This defines the
-       properties of a card that are created when a mode is set and can't
-       be changed otherwise.  A good example of this is the start of the
-       frame buffer memory.  This "locks" the address of the frame buffer
-       memory, so that it cannot be changed or moved.
-     </para>
-
-     <para>
-       The last structure is fb_monospecs. In the old API, there was
-       little importance for fb_monospecs. This allowed for forbidden things
-       such as setting a mode of 800x600 on a fix frequency monitor. With
-       the new API, fb_monospecs prevents such things, and if used
-       correctly, can prevent a monitor from being cooked.  fb_monospecs
-       will not be useful until kernels 2.5.x.
-     </para>
-
-     <sect1><title>Frame Buffer Memory</title>
-!Edrivers/video/fbdev/core/fbmem.c
-     </sect1>
-<!--
-     <sect1><title>Frame Buffer Console</title>
-X!Edrivers/video/console/fbcon.c
-     </sect1>
--->
-     <sect1><title>Frame Buffer Colormap</title>
-!Edrivers/video/fbdev/core/fbcmap.c
-     </sect1>
-<!-- FIXME:
-  drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
-  out until somebody adds docs.  KAO
-     <sect1><title>Frame Buffer Generic Functions</title>
-X!Idrivers/video/fbgen.c
-     </sect1>
-KAO -->
-     <sect1><title>Frame Buffer Video Mode Database</title>
-!Idrivers/video/fbdev/core/modedb.c
-!Edrivers/video/fbdev/core/modedb.c
-     </sect1>
-     <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
-!Edrivers/video/fbdev/macmodes.c
-     </sect1>
-     <sect1><title>Frame Buffer Fonts</title>
-        <para>
-           Refer to the file lib/fonts/fonts.c for more information.
-        </para>
-<!-- FIXME: Removed for now since no structured comments in source
-X!Ilib/fonts/fonts.c
--->
-     </sect1>
-  </chapter>
-
-  <chapter id="input_subsystem">
-     <title>Input Subsystem</title>
-     <sect1><title>Input core</title>
-!Iinclude/linux/input.h
-!Edrivers/input/input.c
-!Edrivers/input/ff-core.c
-!Edrivers/input/ff-memless.c
-     </sect1>
-     <sect1><title>Multitouch Library</title>
-!Iinclude/linux/input/mt.h
-!Edrivers/input/input-mt.c
-     </sect1>
-     <sect1><title>Polled input devices</title>
-!Iinclude/linux/input-polldev.h
-!Edrivers/input/input-polldev.c
-     </sect1>
-     <sect1><title>Matrix keyboards/keypads</title>
-!Iinclude/linux/input/matrix_keypad.h
-     </sect1>
-     <sect1><title>Sparse keymap support</title>
-!Iinclude/linux/input/sparse-keymap.h
-!Edrivers/input/sparse-keymap.c
-     </sect1>
-  </chapter>
-
-  <chapter id="spi">
-      <title>Serial Peripheral Interface (SPI)</title>
-  <para>
-	SPI is the "Serial Peripheral Interface", widely used with
-	embedded systems because it is a simple and efficient
-	interface:  basically a multiplexed shift register.
-	Its three signal wires hold a clock (SCK, often in the range
-	of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
-	a "Master In, Slave Out" (MISO) data line.
-	SPI is a full duplex protocol; for each bit shifted out the
-	MOSI line (one per clock) another is shifted in on the MISO line.
-	Those bits are assembled into words of various sizes on the
-	way to and from system memory.
-	An additional chipselect line is usually active-low (nCS);
-	four signals are normally used for each peripheral, plus
-	sometimes an interrupt.
-  </para>
-  <para>
-	The SPI bus facilities listed here provide a generalized
-	interface to declare SPI busses and devices, manage them
-	according to the standard Linux driver model, and perform
-	input/output operations.
-	At this time, only "master" side interfaces are supported,
-	where Linux talks to SPI peripherals and does not implement
-	such a peripheral itself.
-	(Interfaces to support implementing SPI slaves would
-	necessarily look different.)
-  </para>
-  <para>
-	The programming interface is structured around two kinds of driver,
-	and two kinds of device.
-	A "Controller Driver" abstracts the controller hardware, which may
-	be as simple as a set of GPIO pins or as complex as a pair of FIFOs
-	connected to dual DMA engines on the other side of the SPI shift
-	register (maximizing throughput).  Such drivers bridge between
-	whatever bus they sit on (often the platform bus) and SPI, and
-	expose the SPI side of their device as a
-	<structname>struct spi_master</structname>.
-	SPI devices are children of that master, represented as a
-	<structname>struct spi_device</structname> and manufactured from
-	<structname>struct spi_board_info</structname> descriptors which
-	are usually provided by board-specific initialization code.
-	A <structname>struct spi_driver</structname> is called a
-	"Protocol Driver", and is bound to a spi_device using normal
-	driver model calls.
-  </para>
-  <para>
-	The I/O model is a set of queued messages.  Protocol drivers
-	submit one or more <structname>struct spi_message</structname>
-	objects, which are processed and completed asynchronously.
-	(There are synchronous wrappers, however.)  Messages are
-	built from one or more <structname>struct spi_transfer</structname>
-	objects, each of which wraps a full duplex SPI transfer.
-	A variety of protocol tweaking options are needed, because
-	different chips adopt very different policies for how they
-	use the bits transferred with SPI.
-  </para>
-!Iinclude/linux/spi/spi.h
-!Fdrivers/spi/spi.c spi_register_board_info
-!Edrivers/spi/spi.c
-  </chapter>
-
-  <chapter id="i2c">
-     <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
-
-     <para>
-	I<superscript>2</superscript>C (or without fancy typography, "I2C")
-	is an acronym for the "Inter-IC" bus, a simple bus protocol which is
-	widely used where low data rate communications suffice.
-	Since it's also a licensed trademark, some vendors use another
-	name (such as "Two-Wire Interface", TWI) for the same bus.
-	I2C only needs two signals (SCL for clock, SDA for data), conserving
-	board real estate and minimizing signal quality issues.
-	Most I2C devices use seven bit addresses, and bus speeds of up
-	to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
-	found wide use.
-	I2C is a multi-master bus; open drain signaling is used to
-	arbitrate between masters, as well as to handshake and to
-	synchronize clocks from slower clients.
-     </para>
-
-     <para>
-	The Linux I2C programming interfaces support only the master
-	side of bus interactions, not the slave side.
-	The programming interface is structured around two kinds of driver,
-	and two kinds of device.
-	An I2C "Adapter Driver" abstracts the controller hardware; it binds
-	to a physical device (perhaps a PCI device or platform_device) and
-	exposes a <structname>struct i2c_adapter</structname> representing
-	each I2C bus segment it manages.
-	On each I2C bus segment will be I2C devices represented by a
-	<structname>struct i2c_client</structname>.  Those devices will
-	be bound to a <structname>struct i2c_driver</structname>,
-	which should follow the standard Linux driver model.
-	(At this writing, a legacy model is more widely used.)
-	There are functions to perform various I2C protocol operations; at
-	this writing all such functions are usable only from task context.
-     </para>
-
-     <para>
-	The System Management Bus (SMBus) is a sibling protocol.  Most SMBus
-	systems are also I2C conformant.  The electrical constraints are
-	tighter for SMBus, and it standardizes particular protocol messages
-	and idioms.  Controllers that support I2C can also support most
-	SMBus operations, but SMBus controllers don't support all the protocol
-	options that an I2C controller will.
-	There are functions to perform various SMBus protocol operations,
-	either using I2C primitives or by issuing SMBus commands to
-	i2c_adapter devices which don't support those I2C operations.
-     </para>
-
-!Iinclude/linux/i2c.h
-!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
-!Edrivers/i2c/i2c-core.c
-  </chapter>
-
-  <chapter id="hsi">
-     <title>High Speed Synchronous Serial Interface (HSI)</title>
-
-     <para>
-	High Speed Synchronous Serial Interface (HSI) is a
-	serial interface mainly used for connecting application
-	engines (APE) with cellular modem engines (CMT) in cellular
-	handsets.
-
-	HSI provides multiplexing for up to 16 logical channels,
-	low-latency and full duplex communication.
-     </para>
-
-!Iinclude/linux/hsi/hsi.h
-!Edrivers/hsi/hsi_core.c
-  </chapter>
-
-  <chapter id="pwm">
-    <title>Pulse-Width Modulation (PWM)</title>
-    <para>
-      Pulse-width modulation is a modulation technique primarily used to
-      control power supplied to electrical devices.
-    </para>
-    <para>
-      The PWM framework provides an abstraction for providers and consumers
-      of PWM signals. A controller that provides one or more PWM signals is
-      registered as <structname>struct pwm_chip</structname>. Providers are
-      expected to embed this structure in a driver-specific structure. This
-      structure contains fields that describe a particular chip.
-    </para>
-    <para>
-      A chip exposes one or more PWM signal sources, each of which exposed
-      as a <structname>struct pwm_device</structname>. Operations can be
-      performed on PWM devices to control the period, duty cycle, polarity
-      and active state of the signal.
-    </para>
-    <para>
-      Note that PWM devices are exclusive resources: they can always only be
-      used by one consumer at a time.
-    </para>
-!Iinclude/linux/pwm.h
-!Edrivers/pwm/core.c
-  </chapter>
-
-</book>
diff --git a/Documentation/driver-api/drivers.rst b/Documentation/driver-api/drivers.rst
new file mode 100644
index 000000000000..17f99d441b52
--- /dev/null
+++ b/Documentation/driver-api/drivers.rst
@@ -0,0 +1,654 @@
+====================
+Linux Device Drivers
+====================
+
+Driver Basics
+=============
+
+Driver Entry and Exit points
+----------------------------
+
+.. kernel-doc:: include/linux/init.h
+   :internal:
+
+Atomic and pointer manipulation
+-------------------------------
+
+.. kernel-doc:: arch/x86/include/asm/atomic.h
+   :internal:
+
+Delaying, scheduling, and timer routines
+----------------------------------------
+
+.. kernel-doc:: include/linux/sched.h
+   :internal:
+
+.. kernel-doc:: kernel/sched/core.c
+   :export:
+
+.. kernel-doc:: kernel/sched/cpupri.c
+   :internal:
+
+.. kernel-doc:: kernel/sched/fair.c
+   :internal:
+
+.. kernel-doc:: include/linux/completion.h
+   :internal:
+
+.. kernel-doc:: kernel/time/timer.c
+   :export:
+
+Wait queues and Wake events
+---------------------------
+
+.. kernel-doc:: include/linux/wait.h
+   :internal:
+
+.. kernel-doc:: kernel/sched/wait.c
+   :export:
+
+High-resolution timers
+----------------------
+
+.. kernel-doc:: include/linux/ktime.h
+   :internal:
+
+.. kernel-doc:: include/linux/hrtimer.h
+   :internal:
+
+.. kernel-doc:: kernel/time/hrtimer.c
+   :export:
+
+Workqueues and Kevents
+----------------------
+
+.. kernel-doc:: include/linux/workqueue.h
+   :internal:
+
+.. kernel-doc:: kernel/workqueue.c
+   :export:
+
+Internal Functions
+------------------
+
+.. kernel-doc:: kernel/exit.c
+   :internal:
+
+.. kernel-doc:: kernel/signal.c
+   :internal:
+
+.. kernel-doc:: include/linux/kthread.h
+   :internal:
+
+.. kernel-doc:: kernel/kthread.c
+   :export:
+
+Kernel objects manipulation
+---------------------------
+
+.. kernel-doc:: lib/kobject.c
+   :export:
+
+Kernel utility functions
+------------------------
+
+.. kernel-doc:: include/linux/kernel.h
+   :internal:
+
+.. kernel-doc:: kernel/printk/printk.c
+   :export:
+
+.. kernel-doc:: kernel/panic.c
+   :export:
+
+.. kernel-doc:: kernel/sys.c
+   :export:
+
+.. kernel-doc:: kernel/rcu/srcu.c
+   :export:
+
+.. kernel-doc:: kernel/rcu/tree.c
+   :export:
+
+.. kernel-doc:: kernel/rcu/tree_plugin.h
+   :export:
+
+.. kernel-doc:: kernel/rcu/update.c
+   :export:
+
+Device Resource Management
+--------------------------
+
+.. kernel-doc:: drivers/base/devres.c
+   :export:
+
+Device drivers infrastructure
+=============================
+
+The Basic Device Driver-Model Structures
+----------------------------------------
+
+.. kernel-doc:: include/linux/device.h
+   :internal:
+
+Device Drivers Base
+-------------------
+
+.. kernel-doc:: drivers/base/init.c
+   :internal:
+
+.. kernel-doc:: drivers/base/driver.c
+   :export:
+
+.. kernel-doc:: drivers/base/core.c
+   :export:
+
+.. kernel-doc:: drivers/base/syscore.c
+   :export:
+
+.. kernel-doc:: drivers/base/class.c
+   :export:
+
+.. kernel-doc:: drivers/base/node.c
+   :internal:
+
+.. kernel-doc:: drivers/base/firmware_class.c
+   :export:
+
+.. kernel-doc:: drivers/base/transport_class.c
+   :export:
+
+.. kernel-doc:: drivers/base/dd.c
+   :export:
+
+.. kernel-doc:: include/linux/platform_device.h
+   :internal:
+
+.. kernel-doc:: drivers/base/platform.c
+   :export:
+
+.. kernel-doc:: drivers/base/bus.c
+   :export:
+
+Buffer Sharing and Synchronization
+----------------------------------
+
+The dma-buf subsystem provides the framework for sharing buffers for
+hardware (DMA) access across multiple device drivers and subsystems, and
+for synchronizing asynchronous hardware access.
+
+This is used, for example, by drm "prime" multi-GPU support, but is of
+course not limited to GPU use cases.
+
+The three main components of this are: (1) dma-buf, representing a
+sg_table and exposed to userspace as a file descriptor to allow passing
+between devices, (2) fence, which provides a mechanism to signal when
+one device as finished access, and (3) reservation, which manages the
+shared or exclusive fence(s) associated with the buffer.
+
+dma-buf
+~~~~~~~
+
+.. kernel-doc:: drivers/dma-buf/dma-buf.c
+   :export:
+
+.. kernel-doc:: include/linux/dma-buf.h
+   :internal:
+
+reservation
+~~~~~~~~~~~
+
+.. kernel-doc:: drivers/dma-buf/reservation.c
+   :doc: Reservation Object Overview
+
+.. kernel-doc:: drivers/dma-buf/reservation.c
+   :export:
+
+.. kernel-doc:: include/linux/reservation.h
+   :internal:
+
+fence
+~~~~~
+
+.. kernel-doc:: drivers/dma-buf/fence.c
+   :export:
+
+.. kernel-doc:: include/linux/fence.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/seqno-fence.c
+   :export:
+
+.. kernel-doc:: include/linux/seqno-fence.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/fence-array.c
+   :export:
+
+.. kernel-doc:: include/linux/fence-array.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/reservation.c
+   :export:
+
+.. kernel-doc:: include/linux/reservation.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/sync_file.c
+   :export:
+
+.. kernel-doc:: include/linux/sync_file.h
+   :internal:
+
+Device Drivers DMA Management
+-----------------------------
+
+.. kernel-doc:: drivers/base/dma-coherent.c
+   :export:
+
+.. kernel-doc:: drivers/base/dma-mapping.c
+   :export:
+
+Device Drivers Power Management
+-------------------------------
+
+.. kernel-doc:: drivers/base/power/main.c
+   :export:
+
+Device Drivers ACPI Support
+---------------------------
+
+.. kernel-doc:: drivers/acpi/scan.c
+   :export:
+
+.. kernel-doc:: drivers/acpi/scan.c
+   :internal:
+
+Device drivers PnP support
+--------------------------
+
+.. kernel-doc:: drivers/pnp/core.c
+   :internal:
+
+.. kernel-doc:: drivers/pnp/card.c
+   :export:
+
+.. kernel-doc:: drivers/pnp/driver.c
+   :internal:
+
+.. kernel-doc:: drivers/pnp/manager.c
+   :export:
+
+.. kernel-doc:: drivers/pnp/support.c
+   :export:
+
+Userspace IO devices
+--------------------
+
+.. kernel-doc:: drivers/uio/uio.c
+   :export:
+
+.. kernel-doc:: include/linux/uio_driver.h
+   :internal:
+
+Parallel Port Devices
+=====================
+
+.. kernel-doc:: include/linux/parport.h
+   :internal:
+
+.. kernel-doc:: drivers/parport/ieee1284.c
+   :export:
+
+.. kernel-doc:: drivers/parport/share.c
+   :export:
+
+.. kernel-doc:: drivers/parport/daisy.c
+   :internal:
+
+Message-based devices
+=====================
+
+Fusion message devices
+----------------------
+
+.. kernel-doc:: drivers/message/fusion/mptbase.c
+   :export:
+
+.. kernel-doc:: drivers/message/fusion/mptbase.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptscsih.c
+   :export:
+
+.. kernel-doc:: drivers/message/fusion/mptscsih.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptctl.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptspi.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptfc.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptlan.c
+   :internal:
+
+Sound Devices
+=============
+
+.. kernel-doc:: include/sound/core.h
+   :internal:
+
+.. kernel-doc:: sound/sound_core.c
+   :export:
+
+.. kernel-doc:: include/sound/pcm.h
+   :internal:
+
+.. kernel-doc:: sound/core/pcm.c
+   :export:
+
+.. kernel-doc:: sound/core/device.c
+   :export:
+
+.. kernel-doc:: sound/core/info.c
+   :export:
+
+.. kernel-doc:: sound/core/rawmidi.c
+   :export:
+
+.. kernel-doc:: sound/core/sound.c
+   :export:
+
+.. kernel-doc:: sound/core/memory.c
+   :export:
+
+.. kernel-doc:: sound/core/pcm_memory.c
+   :export:
+
+.. kernel-doc:: sound/core/init.c
+   :export:
+
+.. kernel-doc:: sound/core/isadma.c
+   :export:
+
+.. kernel-doc:: sound/core/control.c
+   :export:
+
+.. kernel-doc:: sound/core/pcm_lib.c
+   :export:
+
+.. kernel-doc:: sound/core/hwdep.c
+   :export:
+
+.. kernel-doc:: sound/core/pcm_native.c
+   :export:
+
+.. kernel-doc:: sound/core/memalloc.c
+   :export:
+
+16x50 UART Driver
+=================
+
+.. kernel-doc:: drivers/tty/serial/serial_core.c
+   :export:
+
+.. kernel-doc:: drivers/tty/serial/8250/8250_core.c
+   :export:
+
+Frame Buffer Library
+====================
+
+The frame buffer drivers depend heavily on four data structures. These
+structures are declared in include/linux/fb.h. They are fb_info,
+fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last
+three can be made available to and from userland.
+
+fb_info defines the current state of a particular video card. Inside
+fb_info, there exists a fb_ops structure which is a collection of
+needed functions to make fbdev and fbcon work. fb_info is only visible
+to the kernel.
+
+fb_var_screeninfo is used to describe the features of a video card
+that are user defined. With fb_var_screeninfo, things such as depth
+and the resolution may be defined.
+
+The next structure is fb_fix_screeninfo. This defines the properties
+of a card that are created when a mode is set and can't be changed
+otherwise. A good example of this is the start of the frame buffer
+memory. This "locks" the address of the frame buffer memory, so that it
+cannot be changed or moved.
+
+The last structure is fb_monospecs. In the old API, there was little
+importance for fb_monospecs. This allowed for forbidden things such as
+setting a mode of 800x600 on a fix frequency monitor. With the new API,
+fb_monospecs prevents such things, and if used correctly, can prevent a
+monitor from being cooked. fb_monospecs will not be useful until
+kernels 2.5.x.
+
+Frame Buffer Memory
+-------------------
+
+.. kernel-doc:: drivers/video/fbdev/core/fbmem.c
+   :export:
+
+Frame Buffer Colormap
+---------------------
+
+.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c
+   :export:
+
+Frame Buffer Video Mode Database
+--------------------------------
+
+.. kernel-doc:: drivers/video/fbdev/core/modedb.c
+   :internal:
+
+.. kernel-doc:: drivers/video/fbdev/core/modedb.c
+   :export:
+
+Frame Buffer Macintosh Video Mode Database
+------------------------------------------
+
+.. kernel-doc:: drivers/video/fbdev/macmodes.c
+   :export:
+
+Frame Buffer Fonts
+------------------
+
+Refer to the file lib/fonts/fonts.c for more information.
+
+Input Subsystem
+===============
+
+Input core
+----------
+
+.. kernel-doc:: include/linux/input.h
+   :internal:
+
+.. kernel-doc:: drivers/input/input.c
+   :export:
+
+.. kernel-doc:: drivers/input/ff-core.c
+   :export:
+
+.. kernel-doc:: drivers/input/ff-memless.c
+   :export:
+
+Multitouch Library
+------------------
+
+.. kernel-doc:: include/linux/input/mt.h
+   :internal:
+
+.. kernel-doc:: drivers/input/input-mt.c
+   :export:
+
+Polled input devices
+--------------------
+
+.. kernel-doc:: include/linux/input-polldev.h
+   :internal:
+
+.. kernel-doc:: drivers/input/input-polldev.c
+   :export:
+
+Matrix keyboards/keypads
+------------------------
+
+.. kernel-doc:: include/linux/input/matrix_keypad.h
+   :internal:
+
+Sparse keymap support
+---------------------
+
+.. kernel-doc:: include/linux/input/sparse-keymap.h
+   :internal:
+
+.. kernel-doc:: drivers/input/sparse-keymap.c
+   :export:
+
+Serial Peripheral Interface (SPI)
+=================================
+
+SPI is the "Serial Peripheral Interface", widely used with embedded
+systems because it is a simple and efficient interface: basically a
+multiplexed shift register. Its three signal wires hold a clock (SCK,
+often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data
+line, and a "Master In, Slave Out" (MISO) data line. SPI is a full
+duplex protocol; for each bit shifted out the MOSI line (one per clock)
+another is shifted in on the MISO line. Those bits are assembled into
+words of various sizes on the way to and from system memory. An
+additional chipselect line is usually active-low (nCS); four signals are
+normally used for each peripheral, plus sometimes an interrupt.
+
+The SPI bus facilities listed here provide a generalized interface to
+declare SPI busses and devices, manage them according to the standard
+Linux driver model, and perform input/output operations. At this time,
+only "master" side interfaces are supported, where Linux talks to SPI
+peripherals and does not implement such a peripheral itself. (Interfaces
+to support implementing SPI slaves would necessarily look different.)
+
+The programming interface is structured around two kinds of driver, and
+two kinds of device. A "Controller Driver" abstracts the controller
+hardware, which may be as simple as a set of GPIO pins or as complex as
+a pair of FIFOs connected to dual DMA engines on the other side of the
+SPI shift register (maximizing throughput). Such drivers bridge between
+whatever bus they sit on (often the platform bus) and SPI, and expose
+the SPI side of their device as a :c:type:`struct spi_master
+<spi_master>`. SPI devices are children of that master,
+represented as a :c:type:`struct spi_device <spi_device>` and
+manufactured from :c:type:`struct spi_board_info
+<spi_board_info>` descriptors which are usually provided by
+board-specific initialization code. A :c:type:`struct spi_driver
+<spi_driver>` is called a "Protocol Driver", and is bound to a
+spi_device using normal driver model calls.
+
+The I/O model is a set of queued messages. Protocol drivers submit one
+or more :c:type:`struct spi_message <spi_message>` objects,
+which are processed and completed asynchronously. (There are synchronous
+wrappers, however.) Messages are built from one or more
+:c:type:`struct spi_transfer <spi_transfer>` objects, each of
+which wraps a full duplex SPI transfer. A variety of protocol tweaking
+options are needed, because different chips adopt very different
+policies for how they use the bits transferred with SPI.
+
+.. kernel-doc:: include/linux/spi/spi.h
+   :internal:
+
+.. kernel-doc:: drivers/spi/spi.c
+   :functions: spi_register_board_info
+
+.. kernel-doc:: drivers/spi/spi.c
+   :export:
+
+I\ :sup:`2`\ C and SMBus Subsystem
+==================================
+
+I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for
+the "Inter-IC" bus, a simple bus protocol which is widely used where low
+data rate communications suffice. Since it's also a licensed trademark,
+some vendors use another name (such as "Two-Wire Interface", TWI) for
+the same bus. I2C only needs two signals (SCL for clock, SDA for data),
+conserving board real estate and minimizing signal quality issues. Most
+I2C devices use seven bit addresses, and bus speeds of up to 400 kHz;
+there's a high speed extension (3.4 MHz) that's not yet found wide use.
+I2C is a multi-master bus; open drain signaling is used to arbitrate
+between masters, as well as to handshake and to synchronize clocks from
+slower clients.
+
+The Linux I2C programming interfaces support only the master side of bus
+interactions, not the slave side. The programming interface is
+structured around two kinds of driver, and two kinds of device. An I2C
+"Adapter Driver" abstracts the controller hardware; it binds to a
+physical device (perhaps a PCI device or platform_device) and exposes a
+:c:type:`struct i2c_adapter <i2c_adapter>` representing each
+I2C bus segment it manages. On each I2C bus segment will be I2C devices
+represented by a :c:type:`struct i2c_client <i2c_client>`.
+Those devices will be bound to a :c:type:`struct i2c_driver
+<i2c_driver>`, which should follow the standard Linux driver
+model. (At this writing, a legacy model is more widely used.) There are
+functions to perform various I2C protocol operations; at this writing
+all such functions are usable only from task context.
+
+The System Management Bus (SMBus) is a sibling protocol. Most SMBus
+systems are also I2C conformant. The electrical constraints are tighter
+for SMBus, and it standardizes particular protocol messages and idioms.
+Controllers that support I2C can also support most SMBus operations, but
+SMBus controllers don't support all the protocol options that an I2C
+controller will. There are functions to perform various SMBus protocol
+operations, either using I2C primitives or by issuing SMBus commands to
+i2c_adapter devices which don't support those I2C operations.
+
+.. kernel-doc:: include/linux/i2c.h
+   :internal:
+
+.. kernel-doc:: drivers/i2c/i2c-boardinfo.c
+   :functions: i2c_register_board_info
+
+.. kernel-doc:: drivers/i2c/i2c-core.c
+   :export:
+
+High Speed Synchronous Serial Interface (HSI)
+=============================================
+
+High Speed Synchronous Serial Interface (HSI) is a serial interface
+mainly used for connecting application engines (APE) with cellular modem
+engines (CMT) in cellular handsets. HSI provides multiplexing for up to
+16 logical channels, low-latency and full duplex communication.
+
+.. kernel-doc:: include/linux/hsi/hsi.h
+   :internal:
+
+.. kernel-doc:: drivers/hsi/hsi_core.c
+   :export:
+
+Pulse-Width Modulation (PWM)
+============================
+
+Pulse-width modulation is a modulation technique primarily used to
+control power supplied to electrical devices.
+
+The PWM framework provides an abstraction for providers and consumers of
+PWM signals. A controller that provides one or more PWM signals is
+registered as :c:type:`struct pwm_chip <pwm_chip>`. Providers
+are expected to embed this structure in a driver-specific structure.
+This structure contains fields that describe a particular chip.
+
+A chip exposes one or more PWM signal sources, each of which exposed as
+a :c:type:`struct pwm_device <pwm_device>`. Operations can be
+performed on PWM devices to control the period, duty cycle, polarity and
+active state of the signal.
+
+Note that PWM devices are exclusive resources: they can always only be
+used by one consumer at a time.
+
+.. kernel-doc:: include/linux/pwm.h
+   :internal:
+
+.. kernel-doc:: drivers/pwm/core.c
+   :export:
diff --git a/Documentation/index.rst b/Documentation/index.rst
index 05eded59820e..0d6992b897c8 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -13,6 +13,7 @@ Contents:
 
    kernel-documentation
    dev-tools/tools
+   driver-api/drivers
    media/index
    gpu/index
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] docs: split up the driver book
  2016-08-22 20:57 [PATCH 0/3] RFC: The beginning of a proper driver-api book Jonathan Corbet
  2016-08-22 20:57 ` [PATCH 1/3] Docs: sphinxify device-drivers.tmpl Jonathan Corbet
@ 2016-08-22 20:57 ` Jonathan Corbet
  2016-08-23 14:30   ` Mauro Carvalho Chehab
  2016-08-22 20:57 ` [PATCH 3/3] docs: Pull HSI documentation together Jonathan Corbet
  2016-08-23 14:43 ` [PATCH 0/3] RFC: The beginning of a proper driver-api book Mauro Carvalho Chehab
  3 siblings, 1 reply; 14+ messages in thread
From: Jonathan Corbet @ 2016-08-22 20:57 UTC (permalink / raw)
  To: linux-doc
  Cc: linux-kernel, Jonathan Corbet, Jani Nikula, Mauro Carvalho Chehab

We don't need to keep it as a single large file anymore; split it up so
that it is easier to manage and the individual sections can be read
directly as plain files.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/driver-api/basics.rst            | 120 +++++
 Documentation/driver-api/drivers.rst           | 654 -------------------------
 Documentation/driver-api/frame-buffer.rst      |  62 +++
 Documentation/driver-api/index.rst             |  24 +
 Documentation/driver-api/infrastructure.rst    | 169 +++++++
 Documentation/driver-api/input.rst             |  51 ++
 Documentation/driver-api/message-based.rst     |  30 ++
 Documentation/driver-api/miscellaneous.rst     |  50 ++
 Documentation/driver-api/serial-interfaces.rst | 115 +++++
 Documentation/driver-api/sound.rst             |  54 ++
 Documentation/index.rst                        |   2 +-
 11 files changed, 676 insertions(+), 655 deletions(-)

diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst
new file mode 100644
index 000000000000..935b9b8d456c
--- /dev/null
+++ b/Documentation/driver-api/basics.rst
@@ -0,0 +1,120 @@
+Driver Basics
+=============
+
+Driver Entry and Exit points
+----------------------------
+
+.. kernel-doc:: include/linux/init.h
+   :internal:
+
+Atomic and pointer manipulation
+-------------------------------
+
+.. kernel-doc:: arch/x86/include/asm/atomic.h
+   :internal:
+
+Delaying, scheduling, and timer routines
+----------------------------------------
+
+.. kernel-doc:: include/linux/sched.h
+   :internal:
+
+.. kernel-doc:: kernel/sched/core.c
+   :export:
+
+.. kernel-doc:: kernel/sched/cpupri.c
+   :internal:
+
+.. kernel-doc:: kernel/sched/fair.c
+   :internal:
+
+.. kernel-doc:: include/linux/completion.h
+   :internal:
+
+.. kernel-doc:: kernel/time/timer.c
+   :export:
+
+Wait queues and Wake events
+---------------------------
+
+.. kernel-doc:: include/linux/wait.h
+   :internal:
+
+.. kernel-doc:: kernel/sched/wait.c
+   :export:
+
+High-resolution timers
+----------------------
+
+.. kernel-doc:: include/linux/ktime.h
+   :internal:
+
+.. kernel-doc:: include/linux/hrtimer.h
+   :internal:
+
+.. kernel-doc:: kernel/time/hrtimer.c
+   :export:
+
+Workqueues and Kevents
+----------------------
+
+.. kernel-doc:: include/linux/workqueue.h
+   :internal:
+
+.. kernel-doc:: kernel/workqueue.c
+   :export:
+
+Internal Functions
+------------------
+
+.. kernel-doc:: kernel/exit.c
+   :internal:
+
+.. kernel-doc:: kernel/signal.c
+   :internal:
+
+.. kernel-doc:: include/linux/kthread.h
+   :internal:
+
+.. kernel-doc:: kernel/kthread.c
+   :export:
+
+Kernel objects manipulation
+---------------------------
+
+.. kernel-doc:: lib/kobject.c
+   :export:
+
+Kernel utility functions
+------------------------
+
+.. kernel-doc:: include/linux/kernel.h
+   :internal:
+
+.. kernel-doc:: kernel/printk/printk.c
+   :export:
+
+.. kernel-doc:: kernel/panic.c
+   :export:
+
+.. kernel-doc:: kernel/sys.c
+   :export:
+
+.. kernel-doc:: kernel/rcu/srcu.c
+   :export:
+
+.. kernel-doc:: kernel/rcu/tree.c
+   :export:
+
+.. kernel-doc:: kernel/rcu/tree_plugin.h
+   :export:
+
+.. kernel-doc:: kernel/rcu/update.c
+   :export:
+
+Device Resource Management
+--------------------------
+
+.. kernel-doc:: drivers/base/devres.c
+   :export:
+
diff --git a/Documentation/driver-api/drivers.rst b/Documentation/driver-api/drivers.rst
deleted file mode 100644
index 17f99d441b52..000000000000
--- a/Documentation/driver-api/drivers.rst
+++ /dev/null
@@ -1,654 +0,0 @@
-====================
-Linux Device Drivers
-====================
-
-Driver Basics
-=============
-
-Driver Entry and Exit points
-----------------------------
-
-.. kernel-doc:: include/linux/init.h
-   :internal:
-
-Atomic and pointer manipulation
--------------------------------
-
-.. kernel-doc:: arch/x86/include/asm/atomic.h
-   :internal:
-
-Delaying, scheduling, and timer routines
-----------------------------------------
-
-.. kernel-doc:: include/linux/sched.h
-   :internal:
-
-.. kernel-doc:: kernel/sched/core.c
-   :export:
-
-.. kernel-doc:: kernel/sched/cpupri.c
-   :internal:
-
-.. kernel-doc:: kernel/sched/fair.c
-   :internal:
-
-.. kernel-doc:: include/linux/completion.h
-   :internal:
-
-.. kernel-doc:: kernel/time/timer.c
-   :export:
-
-Wait queues and Wake events
----------------------------
-
-.. kernel-doc:: include/linux/wait.h
-   :internal:
-
-.. kernel-doc:: kernel/sched/wait.c
-   :export:
-
-High-resolution timers
-----------------------
-
-.. kernel-doc:: include/linux/ktime.h
-   :internal:
-
-.. kernel-doc:: include/linux/hrtimer.h
-   :internal:
-
-.. kernel-doc:: kernel/time/hrtimer.c
-   :export:
-
-Workqueues and Kevents
-----------------------
-
-.. kernel-doc:: include/linux/workqueue.h
-   :internal:
-
-.. kernel-doc:: kernel/workqueue.c
-   :export:
-
-Internal Functions
-------------------
-
-.. kernel-doc:: kernel/exit.c
-   :internal:
-
-.. kernel-doc:: kernel/signal.c
-   :internal:
-
-.. kernel-doc:: include/linux/kthread.h
-   :internal:
-
-.. kernel-doc:: kernel/kthread.c
-   :export:
-
-Kernel objects manipulation
----------------------------
-
-.. kernel-doc:: lib/kobject.c
-   :export:
-
-Kernel utility functions
-------------------------
-
-.. kernel-doc:: include/linux/kernel.h
-   :internal:
-
-.. kernel-doc:: kernel/printk/printk.c
-   :export:
-
-.. kernel-doc:: kernel/panic.c
-   :export:
-
-.. kernel-doc:: kernel/sys.c
-   :export:
-
-.. kernel-doc:: kernel/rcu/srcu.c
-   :export:
-
-.. kernel-doc:: kernel/rcu/tree.c
-   :export:
-
-.. kernel-doc:: kernel/rcu/tree_plugin.h
-   :export:
-
-.. kernel-doc:: kernel/rcu/update.c
-   :export:
-
-Device Resource Management
---------------------------
-
-.. kernel-doc:: drivers/base/devres.c
-   :export:
-
-Device drivers infrastructure
-=============================
-
-The Basic Device Driver-Model Structures
-----------------------------------------
-
-.. kernel-doc:: include/linux/device.h
-   :internal:
-
-Device Drivers Base
--------------------
-
-.. kernel-doc:: drivers/base/init.c
-   :internal:
-
-.. kernel-doc:: drivers/base/driver.c
-   :export:
-
-.. kernel-doc:: drivers/base/core.c
-   :export:
-
-.. kernel-doc:: drivers/base/syscore.c
-   :export:
-
-.. kernel-doc:: drivers/base/class.c
-   :export:
-
-.. kernel-doc:: drivers/base/node.c
-   :internal:
-
-.. kernel-doc:: drivers/base/firmware_class.c
-   :export:
-
-.. kernel-doc:: drivers/base/transport_class.c
-   :export:
-
-.. kernel-doc:: drivers/base/dd.c
-   :export:
-
-.. kernel-doc:: include/linux/platform_device.h
-   :internal:
-
-.. kernel-doc:: drivers/base/platform.c
-   :export:
-
-.. kernel-doc:: drivers/base/bus.c
-   :export:
-
-Buffer Sharing and Synchronization
-----------------------------------
-
-The dma-buf subsystem provides the framework for sharing buffers for
-hardware (DMA) access across multiple device drivers and subsystems, and
-for synchronizing asynchronous hardware access.
-
-This is used, for example, by drm "prime" multi-GPU support, but is of
-course not limited to GPU use cases.
-
-The three main components of this are: (1) dma-buf, representing a
-sg_table and exposed to userspace as a file descriptor to allow passing
-between devices, (2) fence, which provides a mechanism to signal when
-one device as finished access, and (3) reservation, which manages the
-shared or exclusive fence(s) associated with the buffer.
-
-dma-buf
-~~~~~~~
-
-.. kernel-doc:: drivers/dma-buf/dma-buf.c
-   :export:
-
-.. kernel-doc:: include/linux/dma-buf.h
-   :internal:
-
-reservation
-~~~~~~~~~~~
-
-.. kernel-doc:: drivers/dma-buf/reservation.c
-   :doc: Reservation Object Overview
-
-.. kernel-doc:: drivers/dma-buf/reservation.c
-   :export:
-
-.. kernel-doc:: include/linux/reservation.h
-   :internal:
-
-fence
-~~~~~
-
-.. kernel-doc:: drivers/dma-buf/fence.c
-   :export:
-
-.. kernel-doc:: include/linux/fence.h
-   :internal:
-
-.. kernel-doc:: drivers/dma-buf/seqno-fence.c
-   :export:
-
-.. kernel-doc:: include/linux/seqno-fence.h
-   :internal:
-
-.. kernel-doc:: drivers/dma-buf/fence-array.c
-   :export:
-
-.. kernel-doc:: include/linux/fence-array.h
-   :internal:
-
-.. kernel-doc:: drivers/dma-buf/reservation.c
-   :export:
-
-.. kernel-doc:: include/linux/reservation.h
-   :internal:
-
-.. kernel-doc:: drivers/dma-buf/sync_file.c
-   :export:
-
-.. kernel-doc:: include/linux/sync_file.h
-   :internal:
-
-Device Drivers DMA Management
------------------------------
-
-.. kernel-doc:: drivers/base/dma-coherent.c
-   :export:
-
-.. kernel-doc:: drivers/base/dma-mapping.c
-   :export:
-
-Device Drivers Power Management
--------------------------------
-
-.. kernel-doc:: drivers/base/power/main.c
-   :export:
-
-Device Drivers ACPI Support
----------------------------
-
-.. kernel-doc:: drivers/acpi/scan.c
-   :export:
-
-.. kernel-doc:: drivers/acpi/scan.c
-   :internal:
-
-Device drivers PnP support
---------------------------
-
-.. kernel-doc:: drivers/pnp/core.c
-   :internal:
-
-.. kernel-doc:: drivers/pnp/card.c
-   :export:
-
-.. kernel-doc:: drivers/pnp/driver.c
-   :internal:
-
-.. kernel-doc:: drivers/pnp/manager.c
-   :export:
-
-.. kernel-doc:: drivers/pnp/support.c
-   :export:
-
-Userspace IO devices
---------------------
-
-.. kernel-doc:: drivers/uio/uio.c
-   :export:
-
-.. kernel-doc:: include/linux/uio_driver.h
-   :internal:
-
-Parallel Port Devices
-=====================
-
-.. kernel-doc:: include/linux/parport.h
-   :internal:
-
-.. kernel-doc:: drivers/parport/ieee1284.c
-   :export:
-
-.. kernel-doc:: drivers/parport/share.c
-   :export:
-
-.. kernel-doc:: drivers/parport/daisy.c
-   :internal:
-
-Message-based devices
-=====================
-
-Fusion message devices
-----------------------
-
-.. kernel-doc:: drivers/message/fusion/mptbase.c
-   :export:
-
-.. kernel-doc:: drivers/message/fusion/mptbase.c
-   :internal:
-
-.. kernel-doc:: drivers/message/fusion/mptscsih.c
-   :export:
-
-.. kernel-doc:: drivers/message/fusion/mptscsih.c
-   :internal:
-
-.. kernel-doc:: drivers/message/fusion/mptctl.c
-   :internal:
-
-.. kernel-doc:: drivers/message/fusion/mptspi.c
-   :internal:
-
-.. kernel-doc:: drivers/message/fusion/mptfc.c
-   :internal:
-
-.. kernel-doc:: drivers/message/fusion/mptlan.c
-   :internal:
-
-Sound Devices
-=============
-
-.. kernel-doc:: include/sound/core.h
-   :internal:
-
-.. kernel-doc:: sound/sound_core.c
-   :export:
-
-.. kernel-doc:: include/sound/pcm.h
-   :internal:
-
-.. kernel-doc:: sound/core/pcm.c
-   :export:
-
-.. kernel-doc:: sound/core/device.c
-   :export:
-
-.. kernel-doc:: sound/core/info.c
-   :export:
-
-.. kernel-doc:: sound/core/rawmidi.c
-   :export:
-
-.. kernel-doc:: sound/core/sound.c
-   :export:
-
-.. kernel-doc:: sound/core/memory.c
-   :export:
-
-.. kernel-doc:: sound/core/pcm_memory.c
-   :export:
-
-.. kernel-doc:: sound/core/init.c
-   :export:
-
-.. kernel-doc:: sound/core/isadma.c
-   :export:
-
-.. kernel-doc:: sound/core/control.c
-   :export:
-
-.. kernel-doc:: sound/core/pcm_lib.c
-   :export:
-
-.. kernel-doc:: sound/core/hwdep.c
-   :export:
-
-.. kernel-doc:: sound/core/pcm_native.c
-   :export:
-
-.. kernel-doc:: sound/core/memalloc.c
-   :export:
-
-16x50 UART Driver
-=================
-
-.. kernel-doc:: drivers/tty/serial/serial_core.c
-   :export:
-
-.. kernel-doc:: drivers/tty/serial/8250/8250_core.c
-   :export:
-
-Frame Buffer Library
-====================
-
-The frame buffer drivers depend heavily on four data structures. These
-structures are declared in include/linux/fb.h. They are fb_info,
-fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last
-three can be made available to and from userland.
-
-fb_info defines the current state of a particular video card. Inside
-fb_info, there exists a fb_ops structure which is a collection of
-needed functions to make fbdev and fbcon work. fb_info is only visible
-to the kernel.
-
-fb_var_screeninfo is used to describe the features of a video card
-that are user defined. With fb_var_screeninfo, things such as depth
-and the resolution may be defined.
-
-The next structure is fb_fix_screeninfo. This defines the properties
-of a card that are created when a mode is set and can't be changed
-otherwise. A good example of this is the start of the frame buffer
-memory. This "locks" the address of the frame buffer memory, so that it
-cannot be changed or moved.
-
-The last structure is fb_monospecs. In the old API, there was little
-importance for fb_monospecs. This allowed for forbidden things such as
-setting a mode of 800x600 on a fix frequency monitor. With the new API,
-fb_monospecs prevents such things, and if used correctly, can prevent a
-monitor from being cooked. fb_monospecs will not be useful until
-kernels 2.5.x.
-
-Frame Buffer Memory
--------------------
-
-.. kernel-doc:: drivers/video/fbdev/core/fbmem.c
-   :export:
-
-Frame Buffer Colormap
----------------------
-
-.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c
-   :export:
-
-Frame Buffer Video Mode Database
---------------------------------
-
-.. kernel-doc:: drivers/video/fbdev/core/modedb.c
-   :internal:
-
-.. kernel-doc:: drivers/video/fbdev/core/modedb.c
-   :export:
-
-Frame Buffer Macintosh Video Mode Database
-------------------------------------------
-
-.. kernel-doc:: drivers/video/fbdev/macmodes.c
-   :export:
-
-Frame Buffer Fonts
-------------------
-
-Refer to the file lib/fonts/fonts.c for more information.
-
-Input Subsystem
-===============
-
-Input core
-----------
-
-.. kernel-doc:: include/linux/input.h
-   :internal:
-
-.. kernel-doc:: drivers/input/input.c
-   :export:
-
-.. kernel-doc:: drivers/input/ff-core.c
-   :export:
-
-.. kernel-doc:: drivers/input/ff-memless.c
-   :export:
-
-Multitouch Library
-------------------
-
-.. kernel-doc:: include/linux/input/mt.h
-   :internal:
-
-.. kernel-doc:: drivers/input/input-mt.c
-   :export:
-
-Polled input devices
---------------------
-
-.. kernel-doc:: include/linux/input-polldev.h
-   :internal:
-
-.. kernel-doc:: drivers/input/input-polldev.c
-   :export:
-
-Matrix keyboards/keypads
-------------------------
-
-.. kernel-doc:: include/linux/input/matrix_keypad.h
-   :internal:
-
-Sparse keymap support
----------------------
-
-.. kernel-doc:: include/linux/input/sparse-keymap.h
-   :internal:
-
-.. kernel-doc:: drivers/input/sparse-keymap.c
-   :export:
-
-Serial Peripheral Interface (SPI)
-=================================
-
-SPI is the "Serial Peripheral Interface", widely used with embedded
-systems because it is a simple and efficient interface: basically a
-multiplexed shift register. Its three signal wires hold a clock (SCK,
-often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data
-line, and a "Master In, Slave Out" (MISO) data line. SPI is a full
-duplex protocol; for each bit shifted out the MOSI line (one per clock)
-another is shifted in on the MISO line. Those bits are assembled into
-words of various sizes on the way to and from system memory. An
-additional chipselect line is usually active-low (nCS); four signals are
-normally used for each peripheral, plus sometimes an interrupt.
-
-The SPI bus facilities listed here provide a generalized interface to
-declare SPI busses and devices, manage them according to the standard
-Linux driver model, and perform input/output operations. At this time,
-only "master" side interfaces are supported, where Linux talks to SPI
-peripherals and does not implement such a peripheral itself. (Interfaces
-to support implementing SPI slaves would necessarily look different.)
-
-The programming interface is structured around two kinds of driver, and
-two kinds of device. A "Controller Driver" abstracts the controller
-hardware, which may be as simple as a set of GPIO pins or as complex as
-a pair of FIFOs connected to dual DMA engines on the other side of the
-SPI shift register (maximizing throughput). Such drivers bridge between
-whatever bus they sit on (often the platform bus) and SPI, and expose
-the SPI side of their device as a :c:type:`struct spi_master
-<spi_master>`. SPI devices are children of that master,
-represented as a :c:type:`struct spi_device <spi_device>` and
-manufactured from :c:type:`struct spi_board_info
-<spi_board_info>` descriptors which are usually provided by
-board-specific initialization code. A :c:type:`struct spi_driver
-<spi_driver>` is called a "Protocol Driver", and is bound to a
-spi_device using normal driver model calls.
-
-The I/O model is a set of queued messages. Protocol drivers submit one
-or more :c:type:`struct spi_message <spi_message>` objects,
-which are processed and completed asynchronously. (There are synchronous
-wrappers, however.) Messages are built from one or more
-:c:type:`struct spi_transfer <spi_transfer>` objects, each of
-which wraps a full duplex SPI transfer. A variety of protocol tweaking
-options are needed, because different chips adopt very different
-policies for how they use the bits transferred with SPI.
-
-.. kernel-doc:: include/linux/spi/spi.h
-   :internal:
-
-.. kernel-doc:: drivers/spi/spi.c
-   :functions: spi_register_board_info
-
-.. kernel-doc:: drivers/spi/spi.c
-   :export:
-
-I\ :sup:`2`\ C and SMBus Subsystem
-==================================
-
-I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for
-the "Inter-IC" bus, a simple bus protocol which is widely used where low
-data rate communications suffice. Since it's also a licensed trademark,
-some vendors use another name (such as "Two-Wire Interface", TWI) for
-the same bus. I2C only needs two signals (SCL for clock, SDA for data),
-conserving board real estate and minimizing signal quality issues. Most
-I2C devices use seven bit addresses, and bus speeds of up to 400 kHz;
-there's a high speed extension (3.4 MHz) that's not yet found wide use.
-I2C is a multi-master bus; open drain signaling is used to arbitrate
-between masters, as well as to handshake and to synchronize clocks from
-slower clients.
-
-The Linux I2C programming interfaces support only the master side of bus
-interactions, not the slave side. The programming interface is
-structured around two kinds of driver, and two kinds of device. An I2C
-"Adapter Driver" abstracts the controller hardware; it binds to a
-physical device (perhaps a PCI device or platform_device) and exposes a
-:c:type:`struct i2c_adapter <i2c_adapter>` representing each
-I2C bus segment it manages. On each I2C bus segment will be I2C devices
-represented by a :c:type:`struct i2c_client <i2c_client>`.
-Those devices will be bound to a :c:type:`struct i2c_driver
-<i2c_driver>`, which should follow the standard Linux driver
-model. (At this writing, a legacy model is more widely used.) There are
-functions to perform various I2C protocol operations; at this writing
-all such functions are usable only from task context.
-
-The System Management Bus (SMBus) is a sibling protocol. Most SMBus
-systems are also I2C conformant. The electrical constraints are tighter
-for SMBus, and it standardizes particular protocol messages and idioms.
-Controllers that support I2C can also support most SMBus operations, but
-SMBus controllers don't support all the protocol options that an I2C
-controller will. There are functions to perform various SMBus protocol
-operations, either using I2C primitives or by issuing SMBus commands to
-i2c_adapter devices which don't support those I2C operations.
-
-.. kernel-doc:: include/linux/i2c.h
-   :internal:
-
-.. kernel-doc:: drivers/i2c/i2c-boardinfo.c
-   :functions: i2c_register_board_info
-
-.. kernel-doc:: drivers/i2c/i2c-core.c
-   :export:
-
-High Speed Synchronous Serial Interface (HSI)
-=============================================
-
-High Speed Synchronous Serial Interface (HSI) is a serial interface
-mainly used for connecting application engines (APE) with cellular modem
-engines (CMT) in cellular handsets. HSI provides multiplexing for up to
-16 logical channels, low-latency and full duplex communication.
-
-.. kernel-doc:: include/linux/hsi/hsi.h
-   :internal:
-
-.. kernel-doc:: drivers/hsi/hsi_core.c
-   :export:
-
-Pulse-Width Modulation (PWM)
-============================
-
-Pulse-width modulation is a modulation technique primarily used to
-control power supplied to electrical devices.
-
-The PWM framework provides an abstraction for providers and consumers of
-PWM signals. A controller that provides one or more PWM signals is
-registered as :c:type:`struct pwm_chip <pwm_chip>`. Providers
-are expected to embed this structure in a driver-specific structure.
-This structure contains fields that describe a particular chip.
-
-A chip exposes one or more PWM signal sources, each of which exposed as
-a :c:type:`struct pwm_device <pwm_device>`. Operations can be
-performed on PWM devices to control the period, duty cycle, polarity and
-active state of the signal.
-
-Note that PWM devices are exclusive resources: they can always only be
-used by one consumer at a time.
-
-.. kernel-doc:: include/linux/pwm.h
-   :internal:
-
-.. kernel-doc:: drivers/pwm/core.c
-   :export:
diff --git a/Documentation/driver-api/frame-buffer.rst b/Documentation/driver-api/frame-buffer.rst
new file mode 100644
index 000000000000..9dd3060f027d
--- /dev/null
+++ b/Documentation/driver-api/frame-buffer.rst
@@ -0,0 +1,62 @@
+Frame Buffer Library
+====================
+
+The frame buffer drivers depend heavily on four data structures. These
+structures are declared in include/linux/fb.h. They are fb_info,
+fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last
+three can be made available to and from userland.
+
+fb_info defines the current state of a particular video card. Inside
+fb_info, there exists a fb_ops structure which is a collection of
+needed functions to make fbdev and fbcon work. fb_info is only visible
+to the kernel.
+
+fb_var_screeninfo is used to describe the features of a video card
+that are user defined. With fb_var_screeninfo, things such as depth
+and the resolution may be defined.
+
+The next structure is fb_fix_screeninfo. This defines the properties
+of a card that are created when a mode is set and can't be changed
+otherwise. A good example of this is the start of the frame buffer
+memory. This "locks" the address of the frame buffer memory, so that it
+cannot be changed or moved.
+
+The last structure is fb_monospecs. In the old API, there was little
+importance for fb_monospecs. This allowed for forbidden things such as
+setting a mode of 800x600 on a fix frequency monitor. With the new API,
+fb_monospecs prevents such things, and if used correctly, can prevent a
+monitor from being cooked. fb_monospecs will not be useful until
+kernels 2.5.x.
+
+Frame Buffer Memory
+-------------------
+
+.. kernel-doc:: drivers/video/fbdev/core/fbmem.c
+   :export:
+
+Frame Buffer Colormap
+---------------------
+
+.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c
+   :export:
+
+Frame Buffer Video Mode Database
+--------------------------------
+
+.. kernel-doc:: drivers/video/fbdev/core/modedb.c
+   :internal:
+
+.. kernel-doc:: drivers/video/fbdev/core/modedb.c
+   :export:
+
+Frame Buffer Macintosh Video Mode Database
+------------------------------------------
+
+.. kernel-doc:: drivers/video/fbdev/macmodes.c
+   :export:
+
+Frame Buffer Fonts
+------------------
+
+Refer to the file lib/fonts/fonts.c for more information.
+
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
new file mode 100644
index 000000000000..b50c41011e47
--- /dev/null
+++ b/Documentation/driver-api/index.rst
@@ -0,0 +1,24 @@
+========================================
+The Linux driver implementer's API guide
+========================================
+
+The kernel offers a wide variety of interfaces to support the development
+of device drivers.  This document is an only somewhat organized collection
+of some of those interfaces — it will hopefully get better over time!  The
+available subsections can be seen below.
+
+.. class:: toc-title
+
+	   Table of contents
+
+.. toctree::
+   :maxdepth: 2
+
+   basics
+   infrastructure
+   message-based
+   sound
+   frame-buffer
+   input
+   serial-interfaces
+   miscellaneous
diff --git a/Documentation/driver-api/infrastructure.rst b/Documentation/driver-api/infrastructure.rst
new file mode 100644
index 000000000000..5d50d6733db3
--- /dev/null
+++ b/Documentation/driver-api/infrastructure.rst
@@ -0,0 +1,169 @@
+Device drivers infrastructure
+=============================
+
+The Basic Device Driver-Model Structures
+----------------------------------------
+
+.. kernel-doc:: include/linux/device.h
+   :internal:
+
+Device Drivers Base
+-------------------
+
+.. kernel-doc:: drivers/base/init.c
+   :internal:
+
+.. kernel-doc:: drivers/base/driver.c
+   :export:
+
+.. kernel-doc:: drivers/base/core.c
+   :export:
+
+.. kernel-doc:: drivers/base/syscore.c
+   :export:
+
+.. kernel-doc:: drivers/base/class.c
+   :export:
+
+.. kernel-doc:: drivers/base/node.c
+   :internal:
+
+.. kernel-doc:: drivers/base/firmware_class.c
+   :export:
+
+.. kernel-doc:: drivers/base/transport_class.c
+   :export:
+
+.. kernel-doc:: drivers/base/dd.c
+   :export:
+
+.. kernel-doc:: include/linux/platform_device.h
+   :internal:
+
+.. kernel-doc:: drivers/base/platform.c
+   :export:
+
+.. kernel-doc:: drivers/base/bus.c
+   :export:
+
+Buffer Sharing and Synchronization
+----------------------------------
+
+The dma-buf subsystem provides the framework for sharing buffers for
+hardware (DMA) access across multiple device drivers and subsystems, and
+for synchronizing asynchronous hardware access.
+
+This is used, for example, by drm "prime" multi-GPU support, but is of
+course not limited to GPU use cases.
+
+The three main components of this are: (1) dma-buf, representing a
+sg_table and exposed to userspace as a file descriptor to allow passing
+between devices, (2) fence, which provides a mechanism to signal when
+one device as finished access, and (3) reservation, which manages the
+shared or exclusive fence(s) associated with the buffer.
+
+dma-buf
+~~~~~~~
+
+.. kernel-doc:: drivers/dma-buf/dma-buf.c
+   :export:
+
+.. kernel-doc:: include/linux/dma-buf.h
+   :internal:
+
+reservation
+~~~~~~~~~~~
+
+.. kernel-doc:: drivers/dma-buf/reservation.c
+   :doc: Reservation Object Overview
+
+.. kernel-doc:: drivers/dma-buf/reservation.c
+   :export:
+
+.. kernel-doc:: include/linux/reservation.h
+   :internal:
+
+fence
+~~~~~
+
+.. kernel-doc:: drivers/dma-buf/fence.c
+   :export:
+
+.. kernel-doc:: include/linux/fence.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/seqno-fence.c
+   :export:
+
+.. kernel-doc:: include/linux/seqno-fence.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/fence-array.c
+   :export:
+
+.. kernel-doc:: include/linux/fence-array.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/reservation.c
+   :export:
+
+.. kernel-doc:: include/linux/reservation.h
+   :internal:
+
+.. kernel-doc:: drivers/dma-buf/sync_file.c
+   :export:
+
+.. kernel-doc:: include/linux/sync_file.h
+   :internal:
+
+Device Drivers DMA Management
+-----------------------------
+
+.. kernel-doc:: drivers/base/dma-coherent.c
+   :export:
+
+.. kernel-doc:: drivers/base/dma-mapping.c
+   :export:
+
+Device Drivers Power Management
+-------------------------------
+
+.. kernel-doc:: drivers/base/power/main.c
+   :export:
+
+Device Drivers ACPI Support
+---------------------------
+
+.. kernel-doc:: drivers/acpi/scan.c
+   :export:
+
+.. kernel-doc:: drivers/acpi/scan.c
+   :internal:
+
+Device drivers PnP support
+--------------------------
+
+.. kernel-doc:: drivers/pnp/core.c
+   :internal:
+
+.. kernel-doc:: drivers/pnp/card.c
+   :export:
+
+.. kernel-doc:: drivers/pnp/driver.c
+   :internal:
+
+.. kernel-doc:: drivers/pnp/manager.c
+   :export:
+
+.. kernel-doc:: drivers/pnp/support.c
+   :export:
+
+Userspace IO devices
+--------------------
+
+.. kernel-doc:: drivers/uio/uio.c
+   :export:
+
+.. kernel-doc:: include/linux/uio_driver.h
+   :internal:
+
diff --git a/Documentation/driver-api/input.rst b/Documentation/driver-api/input.rst
new file mode 100644
index 000000000000..d05bf58fa83e
--- /dev/null
+++ b/Documentation/driver-api/input.rst
@@ -0,0 +1,51 @@
+Input Subsystem
+===============
+
+Input core
+----------
+
+.. kernel-doc:: include/linux/input.h
+   :internal:
+
+.. kernel-doc:: drivers/input/input.c
+   :export:
+
+.. kernel-doc:: drivers/input/ff-core.c
+   :export:
+
+.. kernel-doc:: drivers/input/ff-memless.c
+   :export:
+
+Multitouch Library
+------------------
+
+.. kernel-doc:: include/linux/input/mt.h
+   :internal:
+
+.. kernel-doc:: drivers/input/input-mt.c
+   :export:
+
+Polled input devices
+--------------------
+
+.. kernel-doc:: include/linux/input-polldev.h
+   :internal:
+
+.. kernel-doc:: drivers/input/input-polldev.c
+   :export:
+
+Matrix keyboards/keypads
+------------------------
+
+.. kernel-doc:: include/linux/input/matrix_keypad.h
+   :internal:
+
+Sparse keymap support
+---------------------
+
+.. kernel-doc:: include/linux/input/sparse-keymap.h
+   :internal:
+
+.. kernel-doc:: drivers/input/sparse-keymap.c
+   :export:
+
diff --git a/Documentation/driver-api/message-based.rst b/Documentation/driver-api/message-based.rst
new file mode 100644
index 000000000000..ef5867a7de20
--- /dev/null
+++ b/Documentation/driver-api/message-based.rst
@@ -0,0 +1,30 @@
+Message-based devices
+=====================
+
+Fusion message devices
+----------------------
+
+.. kernel-doc:: drivers/message/fusion/mptbase.c
+   :export:
+
+.. kernel-doc:: drivers/message/fusion/mptbase.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptscsih.c
+   :export:
+
+.. kernel-doc:: drivers/message/fusion/mptscsih.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptctl.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptspi.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptfc.c
+   :internal:
+
+.. kernel-doc:: drivers/message/fusion/mptlan.c
+   :internal:
+
diff --git a/Documentation/driver-api/miscellaneous.rst b/Documentation/driver-api/miscellaneous.rst
new file mode 100644
index 000000000000..8da7d115bafc
--- /dev/null
+++ b/Documentation/driver-api/miscellaneous.rst
@@ -0,0 +1,50 @@
+Parallel Port Devices
+=====================
+
+.. kernel-doc:: include/linux/parport.h
+   :internal:
+
+.. kernel-doc:: drivers/parport/ieee1284.c
+   :export:
+
+.. kernel-doc:: drivers/parport/share.c
+   :export:
+
+.. kernel-doc:: drivers/parport/daisy.c
+   :internal:
+
+16x50 UART Driver
+=================
+
+.. kernel-doc:: drivers/tty/serial/serial_core.c
+   :export:
+
+.. kernel-doc:: drivers/tty/serial/8250/8250_core.c
+   :export:
+
+Pulse-Width Modulation (PWM)
+============================
+
+Pulse-width modulation is a modulation technique primarily used to
+control power supplied to electrical devices.
+
+The PWM framework provides an abstraction for providers and consumers of
+PWM signals. A controller that provides one or more PWM signals is
+registered as :c:type:`struct pwm_chip <pwm_chip>`. Providers
+are expected to embed this structure in a driver-specific structure.
+This structure contains fields that describe a particular chip.
+
+A chip exposes one or more PWM signal sources, each of which exposed as
+a :c:type:`struct pwm_device <pwm_device>`. Operations can be
+performed on PWM devices to control the period, duty cycle, polarity and
+active state of the signal.
+
+Note that PWM devices are exclusive resources: they can always only be
+used by one consumer at a time.
+
+.. kernel-doc:: include/linux/pwm.h
+   :internal:
+
+.. kernel-doc:: drivers/pwm/core.c
+   :export:
+   
diff --git a/Documentation/driver-api/serial-interfaces.rst b/Documentation/driver-api/serial-interfaces.rst
new file mode 100644
index 000000000000..d0d65e58c14b
--- /dev/null
+++ b/Documentation/driver-api/serial-interfaces.rst
@@ -0,0 +1,115 @@
+Serial Peripheral Interface (SPI)
+=================================
+
+SPI is the "Serial Peripheral Interface", widely used with embedded
+systems because it is a simple and efficient interface: basically a
+multiplexed shift register. Its three signal wires hold a clock (SCK,
+often in the range of 1-20 MHz), a "Master Out, Slave In" (MOSI) data
+line, and a "Master In, Slave Out" (MISO) data line. SPI is a full
+duplex protocol; for each bit shifted out the MOSI line (one per clock)
+another is shifted in on the MISO line. Those bits are assembled into
+words of various sizes on the way to and from system memory. An
+additional chipselect line is usually active-low (nCS); four signals are
+normally used for each peripheral, plus sometimes an interrupt.
+
+The SPI bus facilities listed here provide a generalized interface to
+declare SPI busses and devices, manage them according to the standard
+Linux driver model, and perform input/output operations. At this time,
+only "master" side interfaces are supported, where Linux talks to SPI
+peripherals and does not implement such a peripheral itself. (Interfaces
+to support implementing SPI slaves would necessarily look different.)
+
+The programming interface is structured around two kinds of driver, and
+two kinds of device. A "Controller Driver" abstracts the controller
+hardware, which may be as simple as a set of GPIO pins or as complex as
+a pair of FIFOs connected to dual DMA engines on the other side of the
+SPI shift register (maximizing throughput). Such drivers bridge between
+whatever bus they sit on (often the platform bus) and SPI, and expose
+the SPI side of their device as a :c:type:`struct spi_master
+<spi_master>`. SPI devices are children of that master,
+represented as a :c:type:`struct spi_device <spi_device>` and
+manufactured from :c:type:`struct spi_board_info
+<spi_board_info>` descriptors which are usually provided by
+board-specific initialization code. A :c:type:`struct spi_driver
+<spi_driver>` is called a "Protocol Driver", and is bound to a
+spi_device using normal driver model calls.
+
+The I/O model is a set of queued messages. Protocol drivers submit one
+or more :c:type:`struct spi_message <spi_message>` objects,
+which are processed and completed asynchronously. (There are synchronous
+wrappers, however.) Messages are built from one or more
+:c:type:`struct spi_transfer <spi_transfer>` objects, each of
+which wraps a full duplex SPI transfer. A variety of protocol tweaking
+options are needed, because different chips adopt very different
+policies for how they use the bits transferred with SPI.
+
+.. kernel-doc:: include/linux/spi/spi.h
+   :internal:
+
+.. kernel-doc:: drivers/spi/spi.c
+   :functions: spi_register_board_info
+
+.. kernel-doc:: drivers/spi/spi.c
+   :export:
+
+I\ :sup:`2`\ C and SMBus Subsystem
+==================================
+
+I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for
+the "Inter-IC" bus, a simple bus protocol which is widely used where low
+data rate communications suffice. Since it's also a licensed trademark,
+some vendors use another name (such as "Two-Wire Interface", TWI) for
+the same bus. I2C only needs two signals (SCL for clock, SDA for data),
+conserving board real estate and minimizing signal quality issues. Most
+I2C devices use seven bit addresses, and bus speeds of up to 400 kHz;
+there's a high speed extension (3.4 MHz) that's not yet found wide use.
+I2C is a multi-master bus; open drain signaling is used to arbitrate
+between masters, as well as to handshake and to synchronize clocks from
+slower clients.
+
+The Linux I2C programming interfaces support only the master side of bus
+interactions, not the slave side. The programming interface is
+structured around two kinds of driver, and two kinds of device. An I2C
+"Adapter Driver" abstracts the controller hardware; it binds to a
+physical device (perhaps a PCI device or platform_device) and exposes a
+:c:type:`struct i2c_adapter <i2c_adapter>` representing each
+I2C bus segment it manages. On each I2C bus segment will be I2C devices
+represented by a :c:type:`struct i2c_client <i2c_client>`.
+Those devices will be bound to a :c:type:`struct i2c_driver
+<i2c_driver>`, which should follow the standard Linux driver
+model. (At this writing, a legacy model is more widely used.) There are
+functions to perform various I2C protocol operations; at this writing
+all such functions are usable only from task context.
+
+The System Management Bus (SMBus) is a sibling protocol. Most SMBus
+systems are also I2C conformant. The electrical constraints are tighter
+for SMBus, and it standardizes particular protocol messages and idioms.
+Controllers that support I2C can also support most SMBus operations, but
+SMBus controllers don't support all the protocol options that an I2C
+controller will. There are functions to perform various SMBus protocol
+operations, either using I2C primitives or by issuing SMBus commands to
+i2c_adapter devices which don't support those I2C operations.
+
+.. kernel-doc:: include/linux/i2c.h
+   :internal:
+
+.. kernel-doc:: drivers/i2c/i2c-boardinfo.c
+   :functions: i2c_register_board_info
+
+.. kernel-doc:: drivers/i2c/i2c-core.c
+   :export:
+
+High Speed Synchronous Serial Interface (HSI)
+=============================================
+
+High Speed Synchronous Serial Interface (HSI) is a serial interface
+mainly used for connecting application engines (APE) with cellular modem
+engines (CMT) in cellular handsets. HSI provides multiplexing for up to
+16 logical channels, low-latency and full duplex communication.
+
+.. kernel-doc:: include/linux/hsi/hsi.h
+   :internal:
+
+.. kernel-doc:: drivers/hsi/hsi_core.c
+   :export:
+
diff --git a/Documentation/driver-api/sound.rst b/Documentation/driver-api/sound.rst
new file mode 100644
index 000000000000..afef6eabc073
--- /dev/null
+++ b/Documentation/driver-api/sound.rst
@@ -0,0 +1,54 @@
+Sound Devices
+=============
+
+.. kernel-doc:: include/sound/core.h
+   :internal:
+
+.. kernel-doc:: sound/sound_core.c
+   :export:
+
+.. kernel-doc:: include/sound/pcm.h
+   :internal:
+
+.. kernel-doc:: sound/core/pcm.c
+   :export:
+
+.. kernel-doc:: sound/core/device.c
+   :export:
+
+.. kernel-doc:: sound/core/info.c
+   :export:
+
+.. kernel-doc:: sound/core/rawmidi.c
+   :export:
+
+.. kernel-doc:: sound/core/sound.c
+   :export:
+
+.. kernel-doc:: sound/core/memory.c
+   :export:
+
+.. kernel-doc:: sound/core/pcm_memory.c
+   :export:
+
+.. kernel-doc:: sound/core/init.c
+   :export:
+
+.. kernel-doc:: sound/core/isadma.c
+   :export:
+
+.. kernel-doc:: sound/core/control.c
+   :export:
+
+.. kernel-doc:: sound/core/pcm_lib.c
+   :export:
+
+.. kernel-doc:: sound/core/hwdep.c
+   :export:
+
+.. kernel-doc:: sound/core/pcm_native.c
+   :export:
+
+.. kernel-doc:: sound/core/memalloc.c
+   :export:
+
diff --git a/Documentation/index.rst b/Documentation/index.rst
index 0d6992b897c8..9fe5e0cacdd0 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -13,7 +13,7 @@ Contents:
 
    kernel-documentation
    dev-tools/tools
-   driver-api/drivers
+   driver-api/index
    media/index
    gpu/index
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] docs: Pull HSI documentation together
  2016-08-22 20:57 [PATCH 0/3] RFC: The beginning of a proper driver-api book Jonathan Corbet
  2016-08-22 20:57 ` [PATCH 1/3] Docs: sphinxify device-drivers.tmpl Jonathan Corbet
  2016-08-22 20:57 ` [PATCH 2/3] docs: split up the driver book Jonathan Corbet
@ 2016-08-22 20:57 ` Jonathan Corbet
  2016-08-23  0:20   ` Sebastian Reichel
  2016-08-23 14:43 ` [PATCH 0/3] RFC: The beginning of a proper driver-api book Mauro Carvalho Chehab
  3 siblings, 1 reply; 14+ messages in thread
From: Jonathan Corbet @ 2016-08-22 20:57 UTC (permalink / raw)
  To: linux-doc; +Cc: linux-kernel, Jonathan Corbet, Sebastian Reichel

The HSI subsystem documentation was split across hsi.txt and the
device-drivers docbook.  Now that the latter has been converted to Sphinx,
pull in the HSI document so that it's all in one place.

Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/driver-api/serial-interfaces.rst | 82 ++++++++++++++++++++++++--
 Documentation/hsi.txt                          | 75 -----------------------
 MAINTAINERS                                    |  2 +-
 3 files changed, 79 insertions(+), 80 deletions(-)

diff --git a/Documentation/driver-api/serial-interfaces.rst b/Documentation/driver-api/serial-interfaces.rst
index d0d65e58c14b..07c58971a322 100644
--- a/Documentation/driver-api/serial-interfaces.rst
+++ b/Documentation/driver-api/serial-interfaces.rst
@@ -102,10 +102,84 @@ i2c_adapter devices which don't support those I2C operations.
 High Speed Synchronous Serial Interface (HSI)
 =============================================
 
-High Speed Synchronous Serial Interface (HSI) is a serial interface
-mainly used for connecting application engines (APE) with cellular modem
-engines (CMT) in cellular handsets. HSI provides multiplexing for up to
-16 logical channels, low-latency and full duplex communication.
+1. Introduction
+---------------
+
+High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol,
+that is optimized for die-level interconnect between an Application Processor
+and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and
+implemented by multiple vendors since then.
+
+The HSI interface supports full duplex communication over multiple channels
+(typically 8) and is capable of reaching speeds up to 200 Mbit/s.
+
+The serial protocol uses two signals, DATA and FLAG as combined data and clock
+signals and an additional READY signal for flow control. An additional WAKE
+signal can be used to wakeup the chips from standby modes. The signals are
+commonly prefixed by AC for signals going from the application die to the
+cellular die and CA for signals going the other way around.
+
+::
+
+    +------------+                                 +---------------+
+    |  Cellular  |                                 |  Application  |
+    |    Die     |                                 |      Die      |
+    |            | - - - - - - CAWAKE - - - - - - >|               |
+    |           T|------------ CADATA ------------>|R              |
+    |           X|------------ CAFLAG ------------>|X              |
+    |            |<----------- ACREADY ------------|               |
+    |            |                                 |               |
+    |            |                                 |               |
+    |            |< - - - - -  ACWAKE - - - - - - -|               |
+    |           R|<----------- ACDATA -------------|T              |
+    |           X|<----------- ACFLAG -------------|X              |
+    |            |------------ CAREADY ----------->|               |
+    |            |                                 |               |
+    |            |                                 |               |
+    +------------+                                 +---------------+
+
+2. HSI Subsystem in Linux
+-------------------------
+
+In the Linux kernel the hsi subsystem is supposed to be used for HSI devices.
+The hsi subsystem contains drivers for hsi controllers including support for
+multi-port controllers and provides a generic API for using the HSI ports.
+
+It also contains HSI client drivers, which make use of the generic API to
+implement a protocol used on the HSI interface. These client drivers can
+use an arbitrary number of channels.
+
+3. hsi-char Device
+------------------
+
+Each port automatically registers a generic client driver called hsi_char,
+which provides a charecter device for userspace representing the HSI port.
+It can be used to communicate via HSI from userspace. Userspace may
+configure the hsi_char device using the following ioctl commands:
+
+HSC_RESET
+ flush the HSI port
+
+HSC_SET_PM
+ enable or disable the client.
+
+HSC_SEND_BREAK
+ send break
+
+HSC_SET_RX
+ set RX configuration
+
+HSC_GET_RX
+ get RX configuration
+
+HSC_SET_TX
+ set TX configuration
+
+HSC_GET_TX
+ get TX configuration
+
+The kernel HSI API
+------------------
 
 .. kernel-doc:: include/linux/hsi/hsi.h
    :internal:
diff --git a/Documentation/hsi.txt b/Documentation/hsi.txt
deleted file mode 100644
index 6ac6cd51852a..000000000000
--- a/Documentation/hsi.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-HSI - High-speed Synchronous Serial Interface
-
-1. Introduction
-~~~~~~~~~~~~~~~
-
-High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol,
-that is optimized for die-level interconnect between an Application Processor
-and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and
-implemented by multiple vendors since then.
-
-The HSI interface supports full duplex communication over multiple channels
-(typically 8) and is capable of reaching speeds up to 200 Mbit/s.
-
-The serial protocol uses two signals, DATA and FLAG as combined data and clock
-signals and an additional READY signal for flow control. An additional WAKE
-signal can be used to wakeup the chips from standby modes. The signals are
-commonly prefixed by AC for signals going from the application die to the
-cellular die and CA for signals going the other way around.
-
-+------------+                                 +---------------+
-|  Cellular  |                                 |  Application  |
-|    Die     |                                 |      Die      |
-|            | - - - - - - CAWAKE - - - - - - >|               |
-|           T|------------ CADATA ------------>|R              |
-|           X|------------ CAFLAG ------------>|X              |
-|            |<----------- ACREADY ------------|               |
-|            |                                 |               |
-|            |                                 |               |
-|            |< - - - - -  ACWAKE - - - - - - -|               |
-|           R|<----------- ACDATA -------------|T              |
-|           X|<----------- ACFLAG -------------|X              |
-|            |------------ CAREADY ----------->|               |
-|            |                                 |               |
-|            |                                 |               |
-+------------+                                 +---------------+
-
-2. HSI Subsystem in Linux
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In the Linux kernel the hsi subsystem is supposed to be used for HSI devices.
-The hsi subsystem contains drivers for hsi controllers including support for
-multi-port controllers and provides a generic API for using the HSI ports.
-
-It also contains HSI client drivers, which make use of the generic API to
-implement a protocol used on the HSI interface. These client drivers can
-use an arbitrary number of channels.
-
-3. hsi-char Device
-~~~~~~~~~~~~~~~~~~
-
-Each port automatically registers a generic client driver called hsi_char,
-which provides a charecter device for userspace representing the HSI port.
-It can be used to communicate via HSI from userspace. Userspace may
-configure the hsi_char device using the following ioctl commands:
-
-* HSC_RESET:
- - flush the HSI port
-
-* HSC_SET_PM
- - enable or disable the client.
-
-* HSC_SEND_BREAK
- - send break
-
-* HSC_SET_RX
- - set RX configuration
-
-* HSC_GET_RX
- - get RX configuration
-
-* HSC_SET_TX
- - set TX configuration
-
-* HSC_GET_TX
- - get TX configuration
diff --git a/MAINTAINERS b/MAINTAINERS
index 810723537aa5..769a2fd4af72 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5606,7 +5606,7 @@ M:	Sebastian Reichel <sre@kernel.org>
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git
 S:	Maintained
 F:	Documentation/ABI/testing/sysfs-bus-hsi
-F:	Documentation/hsi.txt
+F:	Documentation/device-drivers/serial-interfaces.rst
 F:	drivers/hsi/
 F:	include/linux/hsi/
 F:	include/uapi/linux/hsi/
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] docs: Pull HSI documentation together
  2016-08-22 20:57 ` [PATCH 3/3] docs: Pull HSI documentation together Jonathan Corbet
@ 2016-08-23  0:20   ` Sebastian Reichel
  2016-09-06 15:12     ` Jonathan Corbet
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2016-08-23  0:20 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 995 bytes --]

Hi Jonathan,

On Mon, Aug 22, 2016 at 02:57:43PM -0600, Jonathan Corbet wrote:
> The HSI subsystem documentation was split across hsi.txt and the
> device-drivers docbook.  Now that the latter has been converted to Sphinx,
> pull in the HSI document so that it's all in one place.

Thanks for doing this. I like the resulting HTML. I'm a bit confused
by the rendering of the struct sections, though. Initially I thought
the blue box with "struct xyz" is an empty table (= there are no
members).

Also I think it would be better to split serial-interfaces.rst into
the different subsystems. It generates different sections anyways.

Note that currently the document's title is "Serial Peripheral Interface
(SPI)", so if we don't split the document it should be changed to
"Serial Interfaces" (document title = html>head>title and in the
breadcrumb trail of the generated html).

Anyways, all of that would be extra patches. This one is

Acked-By: Sebastian Reichel <sre@kernel.org>

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] docs: split up the driver book
  2016-08-22 20:57 ` [PATCH 2/3] docs: split up the driver book Jonathan Corbet
@ 2016-08-23 14:30   ` Mauro Carvalho Chehab
  2016-08-24 22:46     ` Jonathan Corbet
  2016-08-25 20:09     ` Jonathan Corbet
  0 siblings, 2 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2016-08-23 14:30 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: linux-doc, linux-kernel, Jani Nikula

Em Mon, 22 Aug 2016 14:57:42 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> We don't need to keep it as a single large file anymore; split it up so
> that it is easier to manage and the individual sections can be read
> directly as plain files.
> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
>  Documentation/driver-api/basics.rst            | 120 +++++

Hi Jon,

I noticed several issues on the converted document. Just commenting
a few of them, as they all follow a pattern: kernel-doc markups
needs review during the conversion to RST, because, unfortunately,
the conversion is not transparent, as we would want to.

So, I'm pointing a few issues I noticed below.

> Documentation/driver-api/basics.rst            | 120 +++++

At kernel/kthread.c, on the documentation for:

	struct task_struct * kthread_create_on_node(int (*threadfn) (void *data, void * data, int node, const char namefmt[], ...)

The original description is:

	 * If thread is going to be bound on a particular cpu, give its node
	 * in @node, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE.
	 * When woken, the thread will run @threadfn() with @data as its
	 * argument. @threadfn() can either call do_exit() directly if it is a
	 * standalone thread for which no one will call kthread_stop(), or
	 * return when 'kthread_should_stop()' is true (which means
	 * kthread_stop() has been called).  The return value should be zero
	 * or a negative error number; it will be passed to kthread_stop().

On the output text, you'll see two places with "@:c:func:threadfn()".

The problem here is that threadfn() is a function argument. While this
used to work with DocBooks, now with Sphinx this is not handled well.

I got some other similar cases on media. There, I opted to just remove
the () on some places, or to replace it by \(\) to avoid kernel-doc
to do the wrong thing. See changeset 564aaf69208d ("[media] doc-rst: 
add some needed escape codes").

We could, instead, teach kernel-doc to be smarter, but I'm afraid
that there will always be border cases that it won't cover.

The same problem happened with:
	void kmsg_dump_rewind(struct kmsg_dumper * dumper)

Also, you should notice that it added several references to
kthread_create(), with is actually a define:

	include/linux/kthread.h:#define kthread_create(threadfn, data, namefmt, arg...) \

It probably makes sense to add some markup for kernel-doc to parse it.

>  Documentation/driver-api/drivers.rst           | 654 -------------------------

At struct device description:

	bool:1 offline
	    Set after successful invocation of bus type’s .:c:func:offline().

At request_firmware_nowait() description, you'all also see:

	 ->:c:func:probe() 

(won't mention about other occurrences of c: - you got the idea)

>  Documentation/driver-api/message-based.rst     |  30 ++

You should probably change NOTES by:

	.. note::

Like on this changeset:
	f58cad224796 [media] media-entry.h: Fix a note markup


The description for:

	 int KickStart(MPT_ADAPTER * ioc, int force, int sleepFlag)

Looked weird on my eyes. The original kernel-nano tag is:

/**
 *	KickStart - Perform hard reset of MPT adapter.
 *	@ioc: Pointer to MPT_ADAPTER structure
 *	@force: Force hard reset
 *	@sleepFlag: Specifies whether the process can sleep
 *
 *	This routine places MPT adapter in diagnostic mode via the
 *	WriteSequence register, and then performs a hard reset of adapter
 *	via the Diagnostic register.
 *
 *	Inputs:   sleepflag - CAN_SLEEP (non-interrupt thread)
 *			or NO_SLEEP (interrupt thread, use mdelay)
 *		  force - 1 if doorbell active, board fault state
 *				board operational, IOC_RECOVERY or
 *				IOC_BRINGUP and there is an alt_ioc.
 *			  0 else
 *
 *	Returns:
 *		 1 - hard reset, READY
 *		 0 - no reset due to History bit, READY
 *		-1 - no reset due to History bit but not READY
 *		     OR reset but failed to come READY
 *		-2 - no reset, could not enter DIAG mode
 *		-3 - reset but bad FW bit
 */
static int
KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)

The first input like:

 *	Inputs:   sleepflag - CAN_SLEEP (non-interrupt thread)

Is internally converted to a bold output like:
	*Inputs sleepflag - CAN_SLEEP (non-interrupt thread)*

And the remaining arguments will be mangled.

At returns arguments, for example, it should be changed to something
like (untested):

 * Returns:
 *
 * - 1 - hard reset, READY
 *
 * - 0 - no reset due to History bit, READY
 *
 * - 1 - no reset due to History bit but not READY
 *       OR reset but failed to come READY
 *
 * - -2 - no reset, could not enter DIAG mode
 *
 * - -3 - reset but bad FW bit

So, basically, all kernel-doc tags should be reviewed for continuation
lines.

...

> diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
> new file mode 100644
> index 000000000000..b50c41011e47
> --- /dev/null
> +++ b/Documentation/driver-api/index.rst
> @@ -0,0 +1,24 @@
> +========================================
> +The Linux driver implementer's API guide
> +========================================
> +
> +The kernel offers a wide variety of interfaces to support the development
> +of device drivers.  This document is an only somewhat organized collection
> +of some of those interfaces — it will hopefully get better over time!  The
> +available subsections can be seen below.
> +
> +.. class:: toc-title
> +
> +	   Table of contents
> +
> +.. toctree::
> +   :maxdepth: 2

I would add here a
	:numbered:

This way, the entire section will be numbered, and you can remove the
manual numbers from the sections from 
Documentation/driver-api/serial-interfaces.rst (patch 3/3).


> +
> +   basics
> +   infrastructure
> +   message-based
> +   sound
> +   frame-buffer
> +   input
> +   serial-interfaces
> +   miscellaneous


Regards,
Mauro

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] RFC: The beginning of a proper driver-api book
  2016-08-22 20:57 [PATCH 0/3] RFC: The beginning of a proper driver-api book Jonathan Corbet
                   ` (2 preceding siblings ...)
  2016-08-22 20:57 ` [PATCH 3/3] docs: Pull HSI documentation together Jonathan Corbet
@ 2016-08-23 14:43 ` Mauro Carvalho Chehab
  2016-08-26  9:34   ` Markus Heiser
  3 siblings, 1 reply; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2016-08-23 14:43 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: linux-doc, linux-kernel, Jani Nikula, Sebastian Reichel

Em Mon, 22 Aug 2016 14:57:40 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> This short series convers device-drivers.tmpl into the RST format, splits
> it up, and sets up the result under Documentation/driver-api/.  For added
> fun, I've taken one top-level file (hsi.txt) and folded it into the
> document as a way of showing the direction I'm thinking I would like things
> to go.  There is plenty more of this sort of work that could be done, to
> say the least - this is just a beginning!
> 
> The formatted results can be seen at:
> 
>     http://static.lwn.net/kerneldoc/driver-api/index.html

Thanks for doing that! IMHO, the conversion of this book is indeed
one of the first things to be done.

> As part of the long-term task to turn Documentation/ into less of a horror
> movie, I'd like to collect documentation of the driver-specific API here.

> Arguably gpu/ and the media API stuff should eventually move here, though
> we can discuss the color of that particular shed some other day.

Yeah, let's finish converting everything to rst, and then see what would
be the best way to organize it.

I have a split feelings with regards to media kAPI and driver-specific
stuff if it is better to keep it at the device-drivers book, or at a
single media book (with currently has 1031 pages on PDF output),
but let's postpone such discussion.

I'm afraid that we'll end needing to split it more than what would be
desired, in order to fix some issues with the PDF output 
part/chapter/section numbering. Unfortunately, ReST markup is too poor
to describe multi-part books, and doesn't have anything to describe
multi-book projects.

> Meanwhile, I'd appreciate comments on the general idea.

I like the general idea of breaking device-drivers.tmpl into multiple
files. IMHO, that will make easier to maintain it long term.

After looking on all 3 patches, they all look good, as a concept.

Yet, IMHO, there are a few things to be fixed before merging it. See
my comments to patch 2/3.

Regards,
Mauro

> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> Cc: Sebastian Reichel <sre@kernel.org>
> 
> Jonathan Corbet (3):
>   Docs: sphinxify device-drivers.tmpl
>   docs: split up the driver book
>   docs: Pull HSI documentation together
> 
>  Documentation/DocBook/Makefile                 |   2 +-
>  Documentation/DocBook/device-drivers.tmpl      | 521 -------------------------
>  Documentation/driver-api/basics.rst            | 120 ++++++
>  Documentation/driver-api/frame-buffer.rst      |  62 +++
>  Documentation/driver-api/index.rst             |  24 ++
>  Documentation/driver-api/infrastructure.rst    | 169 ++++++++
>  Documentation/driver-api/input.rst             |  51 +++
>  Documentation/driver-api/message-based.rst     |  30 ++
>  Documentation/driver-api/miscellaneous.rst     |  50 +++
>  Documentation/driver-api/serial-interfaces.rst | 189 +++++++++
>  Documentation/driver-api/sound.rst             |  54 +++
>  Documentation/hsi.txt                          |  75 ----
>  Documentation/index.rst                        |   1 +
>  MAINTAINERS                                    |   2 +-
>  14 files changed, 752 insertions(+), 598 deletions(-)
>  delete mode 100644 Documentation/DocBook/device-drivers.tmpl
>  create mode 100644 Documentation/driver-api/basics.rst
>  create mode 100644 Documentation/driver-api/frame-buffer.rst
>  create mode 100644 Documentation/driver-api/index.rst
>  create mode 100644 Documentation/driver-api/infrastructure.rst
>  create mode 100644 Documentation/driver-api/input.rst
>  create mode 100644 Documentation/driver-api/message-based.rst
>  create mode 100644 Documentation/driver-api/miscellaneous.rst
>  create mode 100644 Documentation/driver-api/serial-interfaces.rst
>  create mode 100644 Documentation/driver-api/sound.rst
>  delete mode 100644 Documentation/hsi.txt
> 



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] docs: split up the driver book
  2016-08-23 14:30   ` Mauro Carvalho Chehab
@ 2016-08-24 22:46     ` Jonathan Corbet
  2016-08-25  1:55       ` Mauro Carvalho Chehab
  2016-08-25 20:09     ` Jonathan Corbet
  1 sibling, 1 reply; 14+ messages in thread
From: Jonathan Corbet @ 2016-08-24 22:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-doc, linux-kernel, Jani Nikula

On Tue, 23 Aug 2016 11:30:16 -0300
Mauro Carvalho Chehab <mchehab@s-opensource.com> wrote:

> On the output text, you'll see two places with "@:c:func:threadfn()".
> 
> The problem here is that threadfn() is a function argument. While this
> used to work with DocBooks, now with Sphinx this is not handled well.
> 
> I got some other similar cases on media. There, I opted to just remove
> the () on some places, or to replace it by \(\) to avoid kernel-doc
> to do the wrong thing. 

I have a different idea: why not just add another regexp to the
kernel-doc house of cards? :)  The following seems to make these issues
go away pretty nicely, and didn't cause any change at all to the
media/gpu output...

Stacking up ordering-dependent regexps is not a path to long-term joy; at
some point, we will likely want a smarter parser for kerneldoc comments.
But this seems to improve things for the moment.

jon

>From 5dccd4fb9f3c0b6468f38efab8c1d6232d3e701b Mon Sep 17 00:00:00 2001
From: Jonathan Corbet <corbet@lwn.net>
Date: Wed, 24 Aug 2016 16:31:15 -0600
Subject: [PATCH] docs: Special-case function-pointer parameters in kernel-doc

Add yet another regex to kernel-doc to trap @param() references separately
and not produce corrupt RST markup.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 scripts/kernel-doc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 4f2e9049e8fa..c681e8f0ecc2 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -212,6 +212,7 @@ my $anon_struct_union = 0;
 my $type_constant = '\%([-_\w]+)';
 my $type_func = '(\w+)\(\)';
 my $type_param = '\@(\w+)';
+my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
 my $type_struct = '\&((struct\s*)*[_\w]+)';
 my $type_struct_xml = '\\&amp;((struct\s*)*[_\w]+)';
 my $type_env = '(\$\w+)';
@@ -292,6 +293,7 @@ my @highlights_rst = (
                        # Note: need to escape () to avoid func matching later
                        [$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"],
                        [$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"],
+		       [$type_fp_param, "**\$1\\\\(\\\\)**"],
                        [$type_func, "\\:c\\:func\\:`\$1()`"],
                        [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
                        [$type_enum_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] docs: split up the driver book
  2016-08-24 22:46     ` Jonathan Corbet
@ 2016-08-25  1:55       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2016-08-25  1:55 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: linux-doc, linux-kernel, Jani Nikula

Em Wed, 24 Aug 2016 16:46:22 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> On Tue, 23 Aug 2016 11:30:16 -0300
> Mauro Carvalho Chehab <mchehab@s-opensource.com> wrote:
> 
> > On the output text, you'll see two places with "@:c:func:threadfn()".
> > 
> > The problem here is that threadfn() is a function argument. While this
> > used to work with DocBooks, now with Sphinx this is not handled well.
> > 
> > I got some other similar cases on media. There, I opted to just remove
> > the () on some places, or to replace it by \(\) to avoid kernel-doc
> > to do the wrong thing.   
> 
> I have a different idea: why not just add another regexp to the
> kernel-doc house of cards? :) 

Yeah, we can do that, but still we need to check if the references
are being properly solved (e. g. if the parser is doing the right
thing).

Ideally, the regex should also check for the next symbols, as
things like: @foo->bar should be translated to:
	:c:type:`foo`\ ->bar

As Sphinx doesn't handle well non-space chars[1] before :c: or after the
grave accent ("`").

[1] Actually, it seems to work fine with a few symbols, like commas
and dots.

> The following seems to make these issues
> go away pretty nicely, and didn't cause any change at all to the
> media/gpu output...
> 
> Stacking up ordering-dependent regexps is not a path to long-term joy; at
> some point, we will likely want a smarter parser for kerneldoc comments.
> But this seems to improve things for the moment.

Good!

> 
> jon
> 
> From 5dccd4fb9f3c0b6468f38efab8c1d6232d3e701b Mon Sep 17 00:00:00 2001
> From: Jonathan Corbet <corbet@lwn.net>
> Date: Wed, 24 Aug 2016 16:31:15 -0600
> Subject: [PATCH] docs: Special-case function-pointer parameters in kernel-doc
> 
> Add yet another regex to kernel-doc to trap @param() references separately
> and not produce corrupt RST markup.
> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
>  scripts/kernel-doc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 4f2e9049e8fa..c681e8f0ecc2 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -212,6 +212,7 @@ my $anon_struct_union = 0;
>  my $type_constant = '\%([-_\w]+)';
>  my $type_func = '(\w+)\(\)';
>  my $type_param = '\@(\w+)';
> +my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
>  my $type_struct = '\&((struct\s*)*[_\w]+)';
>  my $type_struct_xml = '\\&amp;((struct\s*)*[_\w]+)';
>  my $type_env = '(\$\w+)';
> @@ -292,6 +293,7 @@ my @highlights_rst = (
>                         # Note: need to escape () to avoid func matching later
>                         [$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"],
>                         [$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"],
> +		       [$type_fp_param, "**\$1\\\\(\\\\)**"],

Hmm... shoudn't it be a reference to the struct (or to the struct member),
instead of bold?

>                         [$type_func, "\\:c\\:func\\:`\$1()`"],
>                         [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
>                         [$type_enum_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] docs: split up the driver book
  2016-08-23 14:30   ` Mauro Carvalho Chehab
  2016-08-24 22:46     ` Jonathan Corbet
@ 2016-08-25 20:09     ` Jonathan Corbet
  1 sibling, 0 replies; 14+ messages in thread
From: Jonathan Corbet @ 2016-08-25 20:09 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-doc, linux-kernel, Jani Nikula

On Tue, 23 Aug 2016 11:30:16 -0300
Mauro Carvalho Chehab <mchehab@s-opensource.com> wrote:

> I noticed several issues on the converted document. Just commenting
> a few of them, as they all follow a pattern: kernel-doc markups
> needs review during the conversion to RST, because, unfortunately,
> the conversion is not transparent, as we would want to.

So getting to a couple of others here...

> Also, you should notice that it added several references to
> kthread_create(), with is actually a define:
> 
> 	include/linux/kthread.h:#define kthread_create(threadfn, data, namefmt, arg...) \
> 
> It probably makes sense to add some markup for kernel-doc to parse it.

I have a patch for that now, will send it shortly.

> The description for:
> 
> 	 int KickStart(MPT_ADAPTER * ioc, int force, int sleepFlag)
> 
> Looked weird on my eyes. The original kernel-nano tag is:

I thought about fixing these up, but, in the end, the bulk of the funky
stuff from the fusion driver is pulled in with :internal:.  That, I think,
makes little sense for a "driver API" book.  So I'm really inclined to just
remove those includes altogether; they can be added in the future if
somebody puts together an internals book for that driver.

Thanks,

jon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] RFC: The beginning of a proper driver-api book
  2016-08-23 14:43 ` [PATCH 0/3] RFC: The beginning of a proper driver-api book Mauro Carvalho Chehab
@ 2016-08-26  9:34   ` Markus Heiser
  2016-08-26  9:59     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 14+ messages in thread
From: Markus Heiser @ 2016-08-26  9:34 UTC (permalink / raw)
  To: Jonathan Corbet, Jani Nikula, Mauro Carvalho Chehab
  Cc: linux-doc, linux-kernel@vger.kernel.org List, Sebastian Reichel


Am 23.08.2016 um 16:43 schrieb Mauro Carvalho Chehab <mchehab@s-opensource.com>:

> Em Mon, 22 Aug 2016 14:57:40 -0600
> Jonathan Corbet <corbet@lwn.net> escreveu:
> 
>> This short series convers device-drivers.tmpl into the RST format, splits
>> it up, and sets up the result under Documentation/driver-api/.  For added
>> fun, I've taken one top-level file (hsi.txt) and folded it into the
>> document as a way of showing the direction I'm thinking I would like things
>> to go.  There is plenty more of this sort of work that could be done, to
>> say the least - this is just a beginning!
>> 
>> The formatted results can be seen at:
>> 
>>   http://static.lwn.net/kerneldoc/driver-api/index.html
> 
> Thanks for doing that! IMHO, the conversion of this book is indeed
> one of the first things to be done.

>> As part of the long-term task to turn Documentation/ into less of a horror
>> movie, I'd like to collect documentation of the driver-specific API here.

Hi, 

here are my 2cent, about the *generic* content from the kernel-doc
directive:

.. kernel-doc:: kernel/sched/core.c
  :export:

IMHO directives like the one above are to *generic*. If I read this directive
I would expect, that all exported symbols are documented. But this is a false
estimation!

In my POC I use a more restrictive kernel-doc parser 
(https://github.com/return42/linuxdoc). For the directive above the parser
logs, that some of the exported symbols are not found / not documented:

$ kernel-doc --quiet --list-exports kernel/sched/core.c
[exported undocumented  ] set_cpus_allowed_ptr 
[exported undocumented  ] kick_process 
[exported function      ] wake_up_process 
[exported undocumented  ] preempt_notifier_inc 
[exported undocumented  ] preempt_notifier_dec 
[exported function      ] preempt_notifier_register 
[exported function      ] preempt_notifier_unregister 
[exported undocumented  ] single_task_running 
[exported undocumented  ] preempt_count_add 
[exported undocumented  ] preempt_count_sub 
[exported undocumented  ] schedule 
[exported undocumented  ] preempt_schedule 
[exported function      ] preempt_schedule_notrace 
[exported undocumented  ] default_wake_function 
[exported undocumented  ] set_user_nice 
[exported function      ] sched_setscheduler 
[exported undocumented  ] sched_setattr 
[exported function      ] sched_setscheduler_nocheck 
[exported undocumented  ] _cond_resched 
[exported undocumented  ] __cond_resched_lock 
[exported undocumented  ] __cond_resched_softirq 
[exported function      ] yield 
[exported function      ] yield_to 
[exported undocumented  ] io_schedule_timeout 
[exported undocumented  ] __might_sleep 
[exported undocumented  ] ___might_sleep 


The driver-api is full of *generic* content and IMHO it is not really clear 
what would be a part of the resulting documentation. To illustrate, you
can take a look on the (old) *automatic* conversion of mine at:

 http://return42.github.io/sphkerneldoc/books/device-drivers/index.html

There you see a list of 'Oops: Document generation inconsistency.' 
This kind of missing documentation grows up with changes to 
the source files while there are no errors reported.

What I mean: in most use cases it is better to be explicit and name the 
functions, structs or whatever which should be a part of the documentation.
e.g.::

 .. kernel-doc:: kernel/sched/core.c
    :functions: wake_up_process yield ...

By being explicit, the kernel-doc parser has a chance to identify requested
but missing documentation and log related error messages.

Summarized:

- *explicit* is better than implicit.
- the *generic* part of kernel-doc parser should more restrictive

These are my thoughts, even if we do nothing to handle it, we 
should aware about this.

-- Markus --
> 
>> Arguably gpu/ and the media API stuff should eventually move here, though
>> we can discuss the color of that particular shed some other day.
> 
> Yeah, let's finish converting everything to rst, and then see what would
> be the best way to organize it.
> 
> I have a split feelings with regards to media kAPI and driver-specific
> stuff if it is better to keep it at the device-drivers book, or at a
> single media book (with currently has 1031 pages on PDF output),
> but let's postpone such discussion.
> 
> I'm afraid that we'll end needing to split it more than what would be
> desired, in order to fix some issues with the PDF output 
> part/chapter/section numbering. Unfortunately, ReST markup is too poor
> to describe multi-part books, and doesn't have anything to describe
> multi-book projects.
> 
>> Meanwhile, I'd appreciate comments on the general idea.
> 
> I like the general idea of breaking device-drivers.tmpl into multiple
> files. IMHO, that will make easier to maintain it long term.
> 
> After looking on all 3 patches, they all look good, as a concept.
> 
> Yet, IMHO, there are a few things to be fixed before merging it. See
> my comments to patch 2/3.
> 
> Regards,
> Mauro
> 
>> 
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
>> Cc: Sebastian Reichel <sre@kernel.org>
>> 
>> Jonathan Corbet (3):
>> Docs: sphinxify device-drivers.tmpl
>> docs: split up the driver book
>> docs: Pull HSI documentation together
>> 
>> Documentation/DocBook/Makefile                 |   2 +-
>> Documentation/DocBook/device-drivers.tmpl      | 521 -------------------------
>> Documentation/driver-api/basics.rst            | 120 ++++++
>> Documentation/driver-api/frame-buffer.rst      |  62 +++
>> Documentation/driver-api/index.rst             |  24 ++
>> Documentation/driver-api/infrastructure.rst    | 169 ++++++++
>> Documentation/driver-api/input.rst             |  51 +++
>> Documentation/driver-api/message-based.rst     |  30 ++
>> Documentation/driver-api/miscellaneous.rst     |  50 +++
>> Documentation/driver-api/serial-interfaces.rst | 189 +++++++++
>> Documentation/driver-api/sound.rst             |  54 +++
>> Documentation/hsi.txt                          |  75 ----
>> Documentation/index.rst                        |   1 +
>> MAINTAINERS                                    |   2 +-
>> 14 files changed, 752 insertions(+), 598 deletions(-)
>> delete mode 100644 Documentation/DocBook/device-drivers.tmpl
>> create mode 100644 Documentation/driver-api/basics.rst
>> create mode 100644 Documentation/driver-api/frame-buffer.rst
>> create mode 100644 Documentation/driver-api/index.rst
>> create mode 100644 Documentation/driver-api/infrastructure.rst
>> create mode 100644 Documentation/driver-api/input.rst
>> create mode 100644 Documentation/driver-api/message-based.rst
>> create mode 100644 Documentation/driver-api/miscellaneous.rst
>> create mode 100644 Documentation/driver-api/serial-interfaces.rst
>> create mode 100644 Documentation/driver-api/sound.rst
>> delete mode 100644 Documentation/hsi.txt
>> 
> 
> 
> 
> Thanks,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-doc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] RFC: The beginning of a proper driver-api book
  2016-08-26  9:34   ` Markus Heiser
@ 2016-08-26  9:59     ` Mauro Carvalho Chehab
  2016-08-26 10:19       ` Jani Nikula
  0 siblings, 1 reply; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2016-08-26  9:59 UTC (permalink / raw)
  To: Markus Heiser, Jani Nikula, linux-kernel@vger.kernel.org List
  Cc: Jonathan Corbet, linux-doc, Sebastian Reichel

Em Fri, 26 Aug 2016 11:34:38 +0200
Markus Heiser <markus.heiser@darmarit.de> escreveu:

> Am 23.08.2016 um 16:43 schrieb Mauro Carvalho Chehab <mchehab@s-opensource.com>:
> 
> > Em Mon, 22 Aug 2016 14:57:40 -0600
> > Jonathan Corbet <corbet@lwn.net> escreveu:
> >   
> >> This short series convers device-drivers.tmpl into the RST format, splits
> >> it up, and sets up the result under Documentation/driver-api/.  For added
> >> fun, I've taken one top-level file (hsi.txt) and folded it into the
> >> document as a way of showing the direction I'm thinking I would like things
> >> to go.  There is plenty more of this sort of work that could be done, to
> >> say the least - this is just a beginning!
> >> 
> >> The formatted results can be seen at:
> >> 
> >>   http://static.lwn.net/kerneldoc/driver-api/index.html  
> > 
> > Thanks for doing that! IMHO, the conversion of this book is indeed
> > one of the first things to be done.  
> 
> >> As part of the long-term task to turn Documentation/ into less of a horror
> >> movie, I'd like to collect documentation of the driver-specific API here.  
> 
> Hi, 
> 
> here are my 2cent, about the *generic* content from the kernel-doc
> directive:
> 
> .. kernel-doc:: kernel/sched/core.c
>   :export:
> 
> IMHO directives like the one above are to *generic*. If I read this directive
> I would expect, that all exported symbols are documented. But this is a false
> estimation!
> 
> In my POC I use a more restrictive kernel-doc parser 
> (https://github.com/return42/linuxdoc). For the directive above the parser
> logs, that some of the exported symbols are not found / not documented:
> 
> $ kernel-doc --quiet --list-exports kernel/sched/core.c
> [exported undocumented  ] set_cpus_allowed_ptr 
> [exported undocumented  ] kick_process 
> [exported function      ] wake_up_process 
> [exported undocumented  ] preempt_notifier_inc 
> [exported undocumented  ] preempt_notifier_dec 
> [exported function      ] preempt_notifier_register 
> [exported function      ] preempt_notifier_unregister 
> [exported undocumented  ] single_task_running 
> [exported undocumented  ] preempt_count_add 
> [exported undocumented  ] preempt_count_sub 
> [exported undocumented  ] schedule 
> [exported undocumented  ] preempt_schedule 
> [exported function      ] preempt_schedule_notrace 
> [exported undocumented  ] default_wake_function 
> [exported undocumented  ] set_user_nice 
> [exported function      ] sched_setscheduler 
> [exported undocumented  ] sched_setattr 
> [exported function      ] sched_setscheduler_nocheck 
> [exported undocumented  ] _cond_resched 
> [exported undocumented  ] __cond_resched_lock 
> [exported undocumented  ] __cond_resched_softirq 
> [exported function      ] yield 
> [exported function      ] yield_to 
> [exported undocumented  ] io_schedule_timeout 
> [exported undocumented  ] __might_sleep 
> [exported undocumented  ] ___might_sleep 
> 
> 
> The driver-api is full of *generic* content and IMHO it is not really clear 
> what would be a part of the resulting documentation. To illustrate, you
> can take a look on the (old) *automatic* conversion of mine at:
> 
>  http://return42.github.io/sphkerneldoc/books/device-drivers/index.html
> 
> There you see a list of 'Oops: Document generation inconsistency.' 
> This kind of missing documentation grows up with changes to 
> the source files while there are no errors reported.
> 
> What I mean: in most use cases it is better to be explicit and name the 
> functions, structs or whatever which should be a part of the documentation.
> e.g.::
> 
>  .. kernel-doc:: kernel/sched/core.c
>     :functions: wake_up_process yield ...
> 
> By being explicit, the kernel-doc parser has a chance to identify requested
> but missing documentation and log related error messages.
> 
> Summarized:
> 
> - *explicit* is better than implicit.
> - the *generic* part of kernel-doc parser should more restrictive
> 
> These are my thoughts, even if we do nothing to handle it, we 
> should aware about this.

I actually prefer the opposite:

- on a *.c file, it should assume that *all* exported symbols should be
  documented (either at the C code itself or at a header file);

- on a *.h file, it should assume that *all* structs, enums, typedefs,
  function prototypes and static inline functions should be documented.
  As I stated before, we should also add a way to document defines.
  Assuming that we add such way, for defines, it should implicitly
  ignore the ones used inside the header to enable/disable part of
  its contents, like:
	#define _FOO_H_
	#ifndef _FOO_H_
		....
	#endif

Then, add an option to allow explicitly ignoring symbols. The lack
of documentation for a symbol that matches the above criteria and
isn't explicitly ignored should be warned, as this is a documentation
gap that should be fixed.

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/3] RFC: The beginning of a proper driver-api book
  2016-08-26  9:59     ` Mauro Carvalho Chehab
@ 2016-08-26 10:19       ` Jani Nikula
  0 siblings, 0 replies; 14+ messages in thread
From: Jani Nikula @ 2016-08-26 10:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Markus Heiser, linux-kernel@vger.kernel.org List
  Cc: Jonathan Corbet, linux-doc, Sebastian Reichel

On Fri, 26 Aug 2016, Mauro Carvalho Chehab <mchehab@s-opensource.com> wrote:
> Em Fri, 26 Aug 2016 11:34:38 +0200
> Markus Heiser <markus.heiser@darmarit.de> escreveu:
>
>> Am 23.08.2016 um 16:43 schrieb Mauro Carvalho Chehab <mchehab@s-opensource.com>:
>> 
>> > Em Mon, 22 Aug 2016 14:57:40 -0600
>> > Jonathan Corbet <corbet@lwn.net> escreveu:
>> >   
>> >> This short series convers device-drivers.tmpl into the RST format, splits
>> >> it up, and sets up the result under Documentation/driver-api/.  For added
>> >> fun, I've taken one top-level file (hsi.txt) and folded it into the
>> >> document as a way of showing the direction I'm thinking I would like things
>> >> to go.  There is plenty more of this sort of work that could be done, to
>> >> say the least - this is just a beginning!
>> >> 
>> >> The formatted results can be seen at:
>> >> 
>> >>   http://static.lwn.net/kerneldoc/driver-api/index.html  
>> > 
>> > Thanks for doing that! IMHO, the conversion of this book is indeed
>> > one of the first things to be done.  
>> 
>> >> As part of the long-term task to turn Documentation/ into less of a horror
>> >> movie, I'd like to collect documentation of the driver-specific API here.  
>> 
>> Hi, 
>> 
>> here are my 2cent, about the *generic* content from the kernel-doc
>> directive:
>> 
>> .. kernel-doc:: kernel/sched/core.c
>>   :export:
>> 
>> IMHO directives like the one above are to *generic*. If I read this directive
>> I would expect, that all exported symbols are documented. But this is a false
>> estimation!
>> 
>> In my POC I use a more restrictive kernel-doc parser 
>> (https://github.com/return42/linuxdoc). For the directive above the parser
>> logs, that some of the exported symbols are not found / not documented:
>> 
>> $ kernel-doc --quiet --list-exports kernel/sched/core.c
>> [exported undocumented  ] set_cpus_allowed_ptr 
>> [exported undocumented  ] kick_process 
>> [exported function      ] wake_up_process 
>> [exported undocumented  ] preempt_notifier_inc 
>> [exported undocumented  ] preempt_notifier_dec 
>> [exported function      ] preempt_notifier_register 
>> [exported function      ] preempt_notifier_unregister 
>> [exported undocumented  ] single_task_running 
>> [exported undocumented  ] preempt_count_add 
>> [exported undocumented  ] preempt_count_sub 
>> [exported undocumented  ] schedule 
>> [exported undocumented  ] preempt_schedule 
>> [exported function      ] preempt_schedule_notrace 
>> [exported undocumented  ] default_wake_function 
>> [exported undocumented  ] set_user_nice 
>> [exported function      ] sched_setscheduler 
>> [exported undocumented  ] sched_setattr 
>> [exported function      ] sched_setscheduler_nocheck 
>> [exported undocumented  ] _cond_resched 
>> [exported undocumented  ] __cond_resched_lock 
>> [exported undocumented  ] __cond_resched_softirq 
>> [exported function      ] yield 
>> [exported function      ] yield_to 
>> [exported undocumented  ] io_schedule_timeout 
>> [exported undocumented  ] __might_sleep 
>> [exported undocumented  ] ___might_sleep 
>> 
>> 
>> The driver-api is full of *generic* content and IMHO it is not really clear 
>> what would be a part of the resulting documentation. To illustrate, you
>> can take a look on the (old) *automatic* conversion of mine at:
>> 
>>  http://return42.github.io/sphkerneldoc/books/device-drivers/index.html
>> 
>> There you see a list of 'Oops: Document generation inconsistency.' 
>> This kind of missing documentation grows up with changes to 
>> the source files while there are no errors reported.
>> 
>> What I mean: in most use cases it is better to be explicit and name the 
>> functions, structs or whatever which should be a part of the documentation.
>> e.g.::
>> 
>>  .. kernel-doc:: kernel/sched/core.c
>>     :functions: wake_up_process yield ...
>> 
>> By being explicit, the kernel-doc parser has a chance to identify requested
>> but missing documentation and log related error messages.
>> 
>> Summarized:
>> 
>> - *explicit* is better than implicit.
>> - the *generic* part of kernel-doc parser should more restrictive
>> 
>> These are my thoughts, even if we do nothing to handle it, we 
>> should aware about this.
>
> I actually prefer the opposite:

Ditto.

Jani.

>
> - on a *.c file, it should assume that *all* exported symbols should be
>   documented (either at the C code itself or at a header file);
>
> - on a *.h file, it should assume that *all* structs, enums, typedefs,
>   function prototypes and static inline functions should be documented.
>   As I stated before, we should also add a way to document defines.
>   Assuming that we add such way, for defines, it should implicitly
>   ignore the ones used inside the header to enable/disable part of
>   its contents, like:
> 	#define _FOO_H_
> 	#ifndef _FOO_H_
> 		....
> 	#endif
>
> Then, add an option to allow explicitly ignoring symbols. The lack
> of documentation for a symbol that matches the above criteria and
> isn't explicitly ignored should be warned, as this is a documentation
> gap that should be fixed.
>
> Thanks,
> Mauro

-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] docs: Pull HSI documentation together
  2016-08-23  0:20   ` Sebastian Reichel
@ 2016-09-06 15:12     ` Jonathan Corbet
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Corbet @ 2016-09-06 15:12 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-doc, linux-kernel

On Tue, 23 Aug 2016 02:20:19 +0200
Sebastian Reichel <sre@kernel.org> wrote:

> Thanks for doing this. I like the resulting HTML. I'm a bit confused
> by the rendering of the struct sections, though. Initially I thought
> the blue box with "struct xyz" is an empty table (= there are no
> members).

[Getting back to this finally]

The theme needs a fair amount of work still; we've not put much effort
into making it look as good as it should.  Maybe that should be my next
project...

> Also I think it would be better to split serial-interfaces.rst into
> the different subsystems. It generates different sections anyways.

You're right, I shouldn't have tried to stick them together like that.
The next attempt, hitting an internet near you shortly, will split them
apart.

Thanks,

jon

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-09-06 15:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22 20:57 [PATCH 0/3] RFC: The beginning of a proper driver-api book Jonathan Corbet
2016-08-22 20:57 ` [PATCH 1/3] Docs: sphinxify device-drivers.tmpl Jonathan Corbet
2016-08-22 20:57 ` [PATCH 2/3] docs: split up the driver book Jonathan Corbet
2016-08-23 14:30   ` Mauro Carvalho Chehab
2016-08-24 22:46     ` Jonathan Corbet
2016-08-25  1:55       ` Mauro Carvalho Chehab
2016-08-25 20:09     ` Jonathan Corbet
2016-08-22 20:57 ` [PATCH 3/3] docs: Pull HSI documentation together Jonathan Corbet
2016-08-23  0:20   ` Sebastian Reichel
2016-09-06 15:12     ` Jonathan Corbet
2016-08-23 14:43 ` [PATCH 0/3] RFC: The beginning of a proper driver-api book Mauro Carvalho Chehab
2016-08-26  9:34   ` Markus Heiser
2016-08-26  9:59     ` Mauro Carvalho Chehab
2016-08-26 10:19       ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).