Skip to content
Snippets Groups Projects
Commit 65b7be59 authored by Federico Vaga's avatar Federico Vaga
Browse files

zio: remove cset operation init() and exit()


At the moment, no known driver use these operations so we can "safely"
remove them from the framework.
We decide to remove init() and exit() because, in the current
implementation, they introduce more problems than they solve.

If you used these functions, we suggest you to move your init()
functions in the probe() function and your exit() functions before
deregister the device.

Signed-off-by: default avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: default avatarAlessandro Rubini <rubini@gnudd.com>
parent 1e8ee129
Branches
Tags
No related merge requests found
...@@ -163,6 +163,7 @@ static int zio_drv_probe(struct device *dev) ...@@ -163,6 +163,7 @@ static int zio_drv_probe(struct device *dev)
if (zdrv->probe) if (zdrv->probe)
return zdrv->probe(zdev); return zdrv->probe(zdev);
pr_debug("%s:%d\n", __func__, __LINE__); pr_debug("%s:%d\n", __func__, __LINE__);
return 0; return 0;
} }
......
...@@ -128,7 +128,7 @@ The ZIO code base is designed around three main items: ...@@ -128,7 +128,7 @@ The ZIO code base is designed around three main items:
See @ref{The Trigger}. See @ref{The Trigger}.
@cindex buffer @cindex buffer
@item Buffer @item Buffer
A buffer stores blocks, either input blocks A buffer stores blocks, either input blocks
generated by a trigger or output blocks generated by some generated by a trigger or output blocks generated by some
injecting code. One end of the buffer is always connected to a injecting code. One end of the buffer is always connected to a
...@@ -306,7 +306,7 @@ ZIO framework at some time in the future. Some of them are already ...@@ -306,7 +306,7 @@ ZIO framework at some time in the future. Some of them are already
in @i{beta} stage, available from @i{git} branches in our @t{ohwr} repository. in @i{beta} stage, available from @i{git} branches in our @t{ohwr} repository.
@itemize @bullet @itemize @bullet
@cindex input subsystem and ZIO @cindex input subsystem and ZIO
@item Supporting an @code{input_device} buffer type @item Supporting an @code{input_device} buffer type
...@@ -766,7 +766,7 @@ storage of blocks. This is the actual definition: ...@@ -766,7 +766,7 @@ storage of blocks. This is the actual definition:
void *data; void *data;
size_t datalen; size_t datalen;
size_t uoff; size_t uoff;
}; };
@end example @end example
The meaning of the fields is as follows: The meaning of the fields is as follows:
...@@ -775,7 +775,7 @@ The meaning of the fields is as follows: ...@@ -775,7 +775,7 @@ The meaning of the fields is as follows:
@item ctrl_flags @item ctrl_flags
The field includes a pointer to the control structure and one flag The field includes a pointer to the control structure and one flag
bit, described below. bit, described below.
@item data @item data
...@@ -865,7 +865,7 @@ the Linux kernel. ...@@ -865,7 +865,7 @@ the Linux kernel.
@cindex meta-information @cindex meta-information
The control is designed to offer the full meta-information needed to The control is designed to offer the full meta-information needed to
describe a block. In includes the unique global identification describe a block. In includes the unique global identification
of the channel, as well as the name and parameters for the of the channel, as well as the name and parameters for the
current trigger. Applications can thus pass around a current trigger. Applications can thus pass around a
block without knowing what it is; knowledge about device and block without knowing what it is; knowledge about device and
trigger details can be concentrated in a single place, without the trigger details can be concentrated in a single place, without the
...@@ -959,7 +959,7 @@ the fields are not yet being filled by the core. ...@@ -959,7 +959,7 @@ the fields are not yet being filled by the core.
pipeline, and are persistent until cleared by means of a pipeline, and are persistent until cleared by means of a
@i{sysfs} attribute. ZIO alarms are defined @i{sysfs} attribute. ZIO alarms are defined
by the core, and we currently support ``lost block'' and ``lost by the core, and we currently support ``lost block'' and ``lost
trigger''. trigger''.
@cindex sequence numbers in control structures @cindex sequence numbers in control structures
@item seq_num @item seq_num
...@@ -1171,7 +1171,7 @@ The fields have the following meaning: ...@@ -1171,7 +1171,7 @@ The fields have the following meaning:
The @code{dev_id} field is used differently by different drivers: The @code{dev_id} field is used differently by different drivers:
software-only drivers like @t{zio-zero} and @t{zio-mini} just count software-only drivers like @t{zio-zero} and @t{zio-mini} just count
starting from zero, while PCI cards use the @i{bus} and @i{defvn} starting from zero, while PCI cards use the @i{bus} and @i{defvn}
identifiers as geographical numbering. identifiers as geographical numbering.
For input, all fields are set by ZIO; for output they are ignored For input, all fields are set by ZIO; for output they are ignored
if data reaches ZIO through char devices. The network interface if data reaches ZIO through char devices. The network interface
...@@ -1359,7 +1359,7 @@ extensions using the suggested ZIO protocol. Such protocol already ...@@ -1359,7 +1359,7 @@ extensions using the suggested ZIO protocol. Such protocol already
works with the unextended control. works with the unextended control.
@c and actually it is already used @c and actually it is already used
@c by the example programs in the @i{tools} subdirectory. @c by the example programs in the @i{tools} subdirectory.
Clearly, Clearly,
generic code that ignores metadata and only manages data, is not affected. generic code that ignores metadata and only manages data, is not affected.
For the input direction, generic code that reads a ZIO control device For the input direction, generic code that reads a ZIO control device
...@@ -1502,7 +1502,7 @@ food items. The envelope describes the specific content (including the ...@@ -1502,7 +1502,7 @@ food items. The envelope describes the specific content (including the
timestamp, name, item size and item count of each package), and you can choose timestamp, name, item size and item count of each package), and you can choose
to read the envelope or not; similarly, you can choose to eat the food to read the envelope or not; similarly, you can choose to eat the food
or not, and sometimes you make the choice only after reading the or not, and sometimes you make the choice only after reading the
envelope. envelope.
@tindex mem_offset @tindex mem_offset
@cindex mmap for data access @cindex mmap for data access
...@@ -1519,7 +1519,7 @@ This is represented in @ref{fig:mmap}. ...@@ -1519,7 +1519,7 @@ This is represented in @ref{fig:mmap}.
@sp 1 @sp 1
@cindex vmalloc buffer type @cindex vmalloc buffer type
An attribute of the @i{vmalloc} buffer, called @t{merge-data} An attribute of the @i{vmalloc} buffer, called @t{merge-data}
can turn it into a can turn it into a
real circular buffer: a buffer instance, if so configured, can merge real circular buffer: a buffer instance, if so configured, can merge
(stick together) (stick together)
...@@ -1702,34 +1702,34 @@ preferred name for pointers to that data structure, used in the code. ...@@ -1702,34 +1702,34 @@ preferred name for pointers to that data structure, used in the code.
@headitem Struct name or C type @tab Name @tab Var name @tab Description @headitem Struct name or C type @tab Name @tab Var name @tab Description
@item zio_device @item zio_device
@tab full device @tab full device
@tab zdev @tab zdev
@tab The overall I/O device, either a board or a chip. @tab The overall I/O device, either a board or a chip.
@item zio_cset @item zio_cset
@tab cset @tab cset
@tab cset @tab cset
@tab Part of a device; a group of channels with the same physical features. @tab Part of a device; a group of channels with the same physical features.
@item zio_channel @item zio_channel
@tab channel @tab channel
@tab chan @tab chan
@tab Part of a cset; it is the single data stream endpoint, input or output. @tab Part of a cset; it is the single data stream endpoint, input or output.
@item zio_device_operations @item zio_device_operations
@tab device operations @tab device operations
@tab d_op @tab d_op
@tab Device-specific methods that act on attributes and data blocks. @tab Device-specific methods that act on attributes and data blocks.
@item zio_buffer_type @item zio_buffer_type
@tab buffer type @tab buffer type
@tab zbuf @tab zbuf
@tab Description of a buffer. @tab Description of a buffer.
@item zio_bi @item zio_bi
@tab buffer instance @tab buffer instance
@tab bi @tab bi
@tab Instance of a buffer type associated to a specific channel. @tab Instance of a buffer type associated to a specific channel.
@item zio_buffer_operations @item zio_buffer_operations
@tab buffer operations @tab buffer operations
...@@ -1965,17 +1965,6 @@ or used by the developer are: ...@@ -1965,17 +1965,6 @@ or used by the developer are:
A private pointer for the device, in case it needs it. A private pointer for the device, in case it needs it.
@cindex cset, init and exit functions
@cindex init function for the cset
@cindex exit function for the cset
@item int (*init)(struct zio_cset *cset)
@itemx void (*exit)(struct zio_cset *cset)
The function pointers, if not NULL, are called by ZIO at
cset registration and removal time, after allocating and before
removing, resp., the channel array. They may useful to channel
sets that need to setup and release the @code{priv_d} field.
@end table @end table
@c -------------------------------------------------------------------------- @c --------------------------------------------------------------------------
...@@ -1999,9 +1988,7 @@ are: ...@@ -1999,9 +1988,7 @@ are:
@cindex private pointers in the channel @cindex private pointers in the channel
@item void *priv_d @item void *priv_d
A private pointer for the device (may be allocated by the A private pointer for the device.
@code{init} function of the cset and released by the corresponding
@code{exit} function).
@item void *priv_t @item void *priv_t
...@@ -2032,7 +2019,7 @@ struct zio_driver { ...@@ -2032,7 +2019,7 @@ struct zio_driver {
The client module, thus, must specify a table of device types it is The client module, thus, must specify a table of device types it is
able to drive. When a match is found, the ZIO core calls the method able to drive. When a match is found, the ZIO core calls the method
@i{probe}, which can return success (zero) or failure (a negative error @i{probe}, which can return success (zero) or failure (a negative error
code). Similarly, the core calls @i{remove} when the device disappears code). Similarly, the core calls @i{remove} when the device disappears
or the driver is unloaded. Both methods are optional (if missing, or the driver is unloaded. Both methods are optional (if missing,
success is assumed). success is assumed).
...@@ -2325,7 +2312,7 @@ The detailed meaning of the operations is as follows: ...@@ -2325,7 +2312,7 @@ The detailed meaning of the operations is as follows:
Abort, if defined, is called when an already-armed trigger event Abort, if defined, is called when an already-armed trigger event
must be aborted. This happens, for example, because event must be aborted. This happens, for example, because event
parameters changed (e.g., the block size). The method must parameters changed (e.g., the block size). The method must
call @t{cset->stop_io} if not NULL and call @t{cset->stop_io} if not NULL and
dispose the @i{active_block} for each channel, setting the dispose the @i{active_block} for each channel, setting the
pointer to NULL. Please check how it is used in @t{helpers.c}. pointer to NULL. Please check how it is used in @t{helpers.c}.
The method The method
...@@ -2532,7 +2519,7 @@ This release of ZIO includes the following trigger types: ...@@ -2532,7 +2519,7 @@ This release of ZIO includes the following trigger types:
slack to be used in programming the kernel resource. slack to be used in programming the kernel resource.
@cindex irq trigger @cindex irq trigger
@cindex gpio as a trigger source @cindex gpio as a trigger source
@item irq @item irq
External-interrupt. The module receives a @t{irq=} parameter, External-interrupt. The module receives a @t{irq=} parameter,
...@@ -2543,7 +2530,7 @@ This release of ZIO includes the following trigger types: ...@@ -2543,7 +2530,7 @@ This release of ZIO includes the following trigger types:
for demonstration purposes. for demonstration purposes.
@end table @end table
@c ========================================================================== @c ==========================================================================
@node Available Buffers @node Available Buffers
......
...@@ -188,9 +188,6 @@ struct zio_cset { ...@@ -188,9 +188,6 @@ struct zio_cset {
struct zio_channel *chan; struct zio_channel *chan;
unsigned int n_chan; unsigned int n_chan;
int (*init)(struct zio_cset *cset);
void (*exit)(struct zio_cset *cset);
void *priv_d; /* private for the device */ void *priv_d; /* private for the device */
struct list_head list_cset; /* for cset global list */ struct list_head list_cset; /* for cset global list */
......
...@@ -768,12 +768,7 @@ static int cset_register(struct zio_cset *cset, struct zio_cset *cset_t) ...@@ -768,12 +768,7 @@ static int cset_register(struct zio_cset *cset, struct zio_cset *cset_t)
if (err) if (err)
goto out_reg; goto out_reg;
} }
/* Private initialization function */
if (cset->init) {
err = cset->init(cset);
if (err)
goto out_reg;
}
spin_lock(&zstat->lock); spin_lock(&zstat->lock);
list_add(&cset->list_cset, &zstat->list_cset); list_add(&cset->list_cset, &zstat->list_cset);
spin_unlock(&zstat->lock); spin_unlock(&zstat->lock);
...@@ -825,9 +820,6 @@ static void cset_unregister(struct zio_cset *cset) ...@@ -825,9 +820,6 @@ static void cset_unregister(struct zio_cset *cset)
spin_unlock(&zstat->lock); spin_unlock(&zstat->lock);
/* Make it idle */ /* Make it idle */
zio_trigger_abort_disable(cset, 1); zio_trigger_abort_disable(cset, 1);
/* Private exit function */
if (cset->exit)
cset->exit(cset);
/* Unregister all child channels */ /* Unregister all child channels */
for (i = 0; i < cset->n_chan; i++) for (i = 0; i < cset->n_chan; i++)
chan_unregister(&cset->chan[i]); chan_unregister(&cset->chan[i]);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment