aboutsummaryrefslogtreecommitdiff
path: root/doc/driver-model
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-03 16:55:17 -0700
committerSimon Glass <sjg@chromium.org>2020-12-13 08:00:25 -0700
commit41575d8e4c334df148c4cdd7c40cc825dc0fcaa1 (patch)
treec27d9450fb5e72372be8483fc15079467b588169 /doc/driver-model
parent78128d52dfca9fff53770c7aed2e4673070c5978 (diff)
downloadu-boot-41575d8e4c334df148c4cdd7c40cc825dc0fcaa1.zip
u-boot-41575d8e4c334df148c4cdd7c40cc825dc0fcaa1.tar.gz
u-boot-41575d8e4c334df148c4cdd7c40cc825dc0fcaa1.tar.bz2
dm: treewide: Rename auto_alloc_size members to be shorter
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc/driver-model')
-rw-r--r--doc/driver-model/design.rst26
-rw-r--r--doc/driver-model/ethernet.rst8
-rw-r--r--doc/driver-model/of-plat.rst6
-rw-r--r--doc/driver-model/spi-howto.rst6
-rw-r--r--doc/driver-model/usb-info.rst6
5 files changed, 26 insertions, 26 deletions
diff --git a/doc/driver-model/design.rst b/doc/driver-model/design.rst
index 96525b6..92d1304 100644
--- a/doc/driver-model/design.rst
+++ b/doc/driver-model/design.rst
@@ -448,10 +448,10 @@ The easiest way to make this work it to add a few members to the driver:
.. code-block:: c
- .platdata_auto_alloc_size = sizeof(struct dm_test_pdata),
+ .platdata_auto = sizeof(struct dm_test_pdata),
.ofdata_to_platdata = testfdt_ofdata_to_platdata,
-The 'auto_alloc' feature allowed space for the platdata to be allocated
+The 'auto' feature allowed space for the platdata to be allocated
and zeroed before the driver's ofdata_to_platdata() method is called. The
ofdata_to_platdata() method, which the driver write supplies, should parse
the device tree node for this device and place it in dev->platdata. Thus
@@ -464,7 +464,7 @@ probe method it will be called next. See Driver Lifecycle below for more
details.
If you don't want to have the platdata automatically allocated then you
-can leave out platdata_auto_alloc_size. In this case you can use malloc
+can leave out platdata_auto. In this case you can use malloc
in your ofdata_to_platdata (or probe) method to allocate the required memory,
and you should free it in the remove method.
@@ -589,7 +589,7 @@ as the bus speed for each device.
To achieve this, the bus device can use dev->parent_platdata in each of its
three children. This can be auto-allocated if the bus driver (or bus uclass)
-has a non-zero value for per_child_platdata_auto_alloc_size. If not, then
+has a non-zero value for per_child_platdata_auto. If not, then
the bus device or uclass can allocate the space itself before the child
device is probed.
@@ -695,24 +695,24 @@ platdata. A parent's ofdata is always read before a child.
The steps are:
- 1. If priv_auto_alloc_size is non-zero, then the device-private space
+ 1. If priv_auto is non-zero, then the device-private space
is allocated for the device and zeroed. It will be accessible as
dev->priv. The driver can put anything it likes in there, but should use
it for run-time information, not platform data (which should be static
and known before the device is probed).
- 2. If platdata_auto_alloc_size is non-zero, then the platform data space
+ 2. If platdata_auto is non-zero, then the platform data space
is allocated. This is only useful for device tree operation, since
otherwise you would have to specific the platform data in the
U_BOOT_DEVICE() declaration. The space is allocated for the device and
zeroed. It will be accessible as dev->platdata.
- 3. If the device's uclass specifies a non-zero per_device_auto_alloc_size,
+ 3. If the device's uclass specifies a non-zero per_device_auto,
then this space is allocated and zeroed also. It is allocated for and
stored in the device, but it is uclass data. owned by the uclass driver.
It is possible for the device to access it.
- 4. If the device's immediate parent specifies a per_child_auto_alloc_size
+ 4. If the device's immediate parent specifies a per_child_auto
then this space is allocated. This is intended for use by the parent
device to keep track of things related to the child. For example a USB
flash stick attached to a USB host controller would likely use this
@@ -726,7 +726,7 @@ The steps are:
works the same way whether it was bound using a device tree node or
U_BOOT_DEVICE() structure. In either case, the platform data is now stored
in the platdata structure. Typically you will use the
- platdata_auto_alloc_size feature to specify the size of the platform data
+ platdata_auto feature to specify the size of the platform data
structure, and U-Boot will automatically allocate and zero it for you before
entry to ofdata_to_platdata(). But if not, you can allocate it yourself in
ofdata_to_platdata(). Note that it is preferable to do all the device tree
@@ -795,9 +795,9 @@ as above and then following these steps (see device_probe()):
- uclass data in dev->uclass_priv (for things the uclass stores
about this device)
- Note: If you don't use priv_auto_alloc_size then you will need to
+ Note: If you don't use priv_auto then you will need to
allocate the priv space here yourself. The same applies also to
- platdata_auto_alloc_size. Remember to free them in the remove() method.
+ platdata_auto. Remember to free them in the remove() method.
5. The device is marked 'activated'
@@ -843,10 +843,10 @@ remove it. This performs the probe steps in reverse:
be dynamically allocated, and thus needs to be deallocated during the
remove() method, either:
- - if the platdata_auto_alloc_size is non-zero, the deallocation
+ - if the platdata_auto is non-zero, the deallocation
happens automatically within the driver model core; or
- - when platdata_auto_alloc_size is 0, both the allocation (in probe()
+ - when platdata_auto is 0, both the allocation (in probe()
or preferably ofdata_to_platdata()) and the deallocation in remove()
are the responsibility of the driver author.
diff --git a/doc/driver-model/ethernet.rst b/doc/driver-model/ethernet.rst
index 1f5310d..781644d 100644
--- a/doc/driver-model/ethernet.rst
+++ b/doc/driver-model/ethernet.rst
@@ -28,14 +28,14 @@ the UCLASS_ETH .id field in the U-Boot driver struct:
.ofdata_to_platdata = eth_ape_ofdata_to_platdata,
.probe = eth_ape_probe,
.ops = &eth_ape_ops,
- .priv_auto_alloc_size = sizeof(struct eth_ape_priv),
- .platdata_auto_alloc_size = sizeof(struct eth_ape_pdata),
+ .priv_auto = sizeof(struct eth_ape_priv),
+ .platdata_auto = sizeof(struct eth_ape_pdata),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
struct eth_ape_priv contains runtime per-instance data, like buffers, pointers
to current descriptors, current speed settings, pointers to PHY related data
-(like struct mii_dev) and so on. Declaring its size in .priv_auto_alloc_size
+(like struct mii_dev) and so on. Declaring its size in .priv_auto
will let the driver framework allocate it at the right time.
It can be retrieved using a dev_get_priv(dev) call.
@@ -43,7 +43,7 @@ struct eth_ape_pdata contains static platform data, like the MMIO base address,
a hardware variant, the MAC address. ``struct eth_pdata eth_pdata``
as the first member of this struct helps to avoid duplicated code.
If you don't need any more platform data beside the standard member,
-just use sizeof(struct eth_pdata) for the platdata_auto_alloc_size.
+just use sizeof(struct eth_pdata) for the platdata_auto.
PCI devices add a line pointing to supported vendor/device ID pairs:
diff --git a/doc/driver-model/of-plat.rst b/doc/driver-model/of-plat.rst
index 5848166..2df59ed 100644
--- a/doc/driver-model/of-plat.rst
+++ b/doc/driver-model/of-plat.rst
@@ -293,8 +293,8 @@ For example:
.of_match = mmc_ids,
.ofdata_to_platdata = mmc_ofdata_to_platdata,
.probe = mmc_probe,
- .priv_auto_alloc_size = sizeof(struct mmc_priv),
- .platdata_auto_alloc_size = sizeof(struct mmc_platdata),
+ .priv_auto = sizeof(struct mmc_priv),
+ .platdata_auto = sizeof(struct mmc_platdata),
};
U_BOOT_DRIVER_ALIAS(mmc_drv, vendor_mmc) /* matches compatible string */
@@ -305,7 +305,7 @@ keep the use of each of-platdata struct to the smallest possible code area.
There is just one driver C file for each struct, that can convert from the
of-platdata struct to the standard one used by the driver.
-In the case where SPL_OF_PLATDATA is enabled, platdata_auto_alloc_size is
+In the case where SPL_OF_PLATDATA is enabled, platdata_auto is
still used to allocate space for the platform data. This is different from
the normal behaviour and is triggered by the use of of-platdata (strictly
speaking it is a non-zero platdata_size which triggers this).
diff --git a/doc/driver-model/spi-howto.rst b/doc/driver-model/spi-howto.rst
index 9631a50..a12d692 100644
--- a/doc/driver-model/spi-howto.rst
+++ b/doc/driver-model/spi-howto.rst
@@ -231,7 +231,7 @@ tree, but we need to tell it the size:
U_BOOT_DRIVER(spi_exynos) = {
...
- .platdata_auto_alloc_size = sizeof(struct exynos_spi_platdata),
+ .platdata_auto = sizeof(struct exynos_spi_platdata),
Here is a sample function. It gets a pointer to the platform data and
@@ -335,7 +335,7 @@ DM can auto-allocate this also:
U_BOOT_DRIVER(spi_exynos) = {
...
- .priv_auto_alloc_size = sizeof(struct exynos_spi_priv),
+ .priv_auto = sizeof(struct exynos_spi_priv),
Note that this is created before the probe method is called, and destroyed
@@ -621,7 +621,7 @@ needs, but this is the minimum.
U_BOOT_DRIVER(exynos_spi) = {
...
- .per_child_auto_alloc_size = sizeof(struct spi_slave),
+ .per_child_auto = sizeof(struct spi_slave),
}
diff --git a/doc/driver-model/usb-info.rst b/doc/driver-model/usb-info.rst
index 1817df4..5f7cbfc 100644
--- a/doc/driver-model/usb-info.rst
+++ b/doc/driver-model/usb-info.rst
@@ -43,8 +43,8 @@ as drivers in the USB uclass. For example:
.probe = tegra_ehci_usb_probe,
.remove = tegra_ehci_usb_remove,
.ops = &ehci_usb_ops,
- .platdata_auto_alloc_size = sizeof(struct usb_platdata),
- .priv_auto_alloc_size = sizeof(struct fdt_usb),
+ .platdata_auto = sizeof(struct usb_platdata),
+ .priv_auto = sizeof(struct fdt_usb),
.flags = DM_FLAG_ALLOC_PRIV_DMA,
};
@@ -58,7 +58,7 @@ The ops here are ehci_usb_ops. All EHCI drivers will use these same ops in
most cases, since they are all EHCI-compatible. For EHCI there are also some
special operations that can be overridden when calling ehci_register().
-The driver can use priv_auto_alloc_size to set the size of its private data.
+The driver can use priv_auto to set the size of its private data.
This can hold run-time information needed by the driver for operation. It
exists when the device is probed (not when it is bound) and is removed when
the driver is removed.