Skip to content

Commit

Permalink
Kernel slides: interrupts: suggest to use pdev->name in platform drivers
Browse files Browse the repository at this point in the history
- Something that's already very common
- Allows to distinguish the entries in /proc/devices for different devices

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
  • Loading branch information
michaelopdenacker authored and tpetazzoni committed Oct 29, 2021
1 parent 484222a commit 0d889f9
Showing 1 changed file with 5 additions and 7 deletions.
Expand Up @@ -4,12 +4,8 @@ \subsection{Interrupt Management}
\frametitle{Registering an interrupt handler 1/2}
The {\em managed} API is recommended:
\begin{minted}[fontsize=\small]{c}
int devm_request_irq(struct device *dev,
unsigned int irq,
irq_handler_t handler,
unsigned long irq_flags,
const char *devname,
void *dev_id);
int devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
unsigned long irq_flags, const char *devname, void *dev_id);
\end{minted}
\begin{itemize}
\item \code{device} for automatic freeing at device or module
Expand All @@ -20,7 +16,9 @@ \subsection{Interrupt Management}
\item \code{handler} is a pointer to the IRQ handler function
\item \code{irq_flags} are option masks (see next slide)
\item \code{devname} is the registered name (for
\code{/proc/interrupts})
\code{/proc/interrupts}). For platform drivers, good idea
to use \code{pdev->name} which allows to distinguish
devices managed by the same driver (example: \code{44e0b000.i2c}).
\item \code{dev_id} is an opaque pointer. It can typically
be used to pass a pointer to a per-device data structure.
It cannot be \code{NULL} as it is used as an identifier for
Expand Down

0 comments on commit 0d889f9

Please sign in to comment.