summaryrefslogtreecommitdiff
path: root/drivers/s390
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-08-17 16:28:45 +0100
committerMark Brown <broonie@kernel.org>2026-08-17 16:28:45 +0100
commit5901387c31ca3fc8bce2d89de2c0cc6f1bad68d5 (patch)
treeb7dd8ca02bc577b1d0413302c6772edfe5cc999c /drivers/s390
parentd2fb98e692920167ab3221a707668ccb84131f85 (diff)
parente6a5d573d24cd375e09d24f136523cb3cc85c9d3 (diff)
downloadlinux-next-5901387c31ca3fc8bce2d89de2c0cc6f1bad68d5.tar.gz
linux-next-5901387c31ca3fc8bce2d89de2c0cc6f1bad68d5.zip
Merge branch 'main' of https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
# Conflicts: # MAINTAINERS # drivers/net/wireless/mediatek/mt76/mt7921/regd.c # include/linux/pci_ids.h
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/Makefile2
-rw-r--r--drivers/s390/net/ctcm_fsms.c20
-rw-r--r--drivers/s390/net/ctcm_mpc.c6
-rw-r--r--drivers/s390/net/fsm.h152
4 files changed, 89 insertions, 91 deletions
diff --git a/drivers/s390/net/Makefile b/drivers/s390/net/Makefile
index 537514cc52fb..038ba3e4005d 100644
--- a/drivers/s390/net/Makefile
+++ b/drivers/s390/net/Makefile
@@ -3,6 +3,8 @@
# S/390 network devices
#
+CONTEXT_ANALYSIS := y
+
ctcm-y += ctcm_main.o ctcm_fsms.o ctcm_mpc.o ctcm_sysfs.o ctcm_dbug.o
obj-$(CONFIG_CTCM) += ctcm.o fsm.o
obj-$(CONFIG_SMSGIUCV) += smsgiucv.o
diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c
index bf917f426453..84fd394d3525 100644
--- a/drivers/s390/net/ctcm_fsms.c
+++ b/drivers/s390/net/ctcm_fsms.c
@@ -545,6 +545,7 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg)
* arg Generic pointer, casted from channel * upon call.
*/
static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
int rc;
@@ -563,8 +564,6 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg)
if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
- /* Such conditional locking is undeterministic in
- * static view. => ignore sparse warnings here. */
rc = ccw_device_start(ch->cdev, &ch->ccw[6], 0, 0xff, 0);
if (event == CTC_EVENT_TIMER) /* see above comments */
@@ -648,6 +647,7 @@ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg)
* arg Generic pointer, casted from channel * upon call.
*/
static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
unsigned long saveflags = 0;
@@ -662,15 +662,12 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg)
if (event == CTC_EVENT_STOP) /* only for STOP not yet locked */
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
- /* Such conditional locking is undeterministic in
- * static view. => ignore sparse warnings here. */
oldstate = fsm_getstate(fi);
fsm_newstate(fi, CTC_STATE_TERM);
rc = ccw_device_halt(ch->cdev, 0);
if (event == CTC_EVENT_STOP)
spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
- /* see remark above about conditional locking */
if (rc != 0 && rc != -EBUSY) {
fsm_deltimer(&ch->timer);
@@ -824,6 +821,7 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg)
* arg Generic pointer, casted from channel * upon call.
*/
static void ctcm_chx_restart(fsm_instance *fi, int event, void *arg)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
struct net_device *dev = ch->netdev;
@@ -842,9 +840,6 @@ static void ctcm_chx_restart(fsm_instance *fi, int event, void *arg)
fsm_newstate(fi, CTC_STATE_STARTWAIT);
if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
- /* Such conditional locking is a known problem for
- * sparse because its undeterministic in static view.
- * Warnings should be ignored here. */
rc = ccw_device_halt(ch->cdev, 0);
if (event == CTC_EVENT_TIMER)
spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
@@ -999,6 +994,7 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg)
* arg Generic pointer, casted from channel * upon call.
*/
static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
struct net_device *dev = ch->netdev;
@@ -1042,9 +1038,6 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg)
fsm_addtimer(&ch->timer, 1000, CTC_EVENT_TIMER, ch);
if (event == CTC_EVENT_TIMER) /* for TIMER not yet locked */
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
- /* Such conditional locking is a known problem for
- * sparse because its undeterministic in static view.
- * Warnings should be ignored here. */
if (do_debug_ccw)
ctcmpc_dumpit((char *)&ch->ccw[3],
sizeof(struct ccw1) * 3);
@@ -1383,6 +1376,7 @@ done:
* arg Generic pointer, casted from channel * upon call.
*/
static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
struct net_device *dev = ch->netdev;
@@ -1462,7 +1456,7 @@ again:
spin_lock_irqsave(
get_ccwdev_lock(ch->cdev), saveflags);
rc = ccw_device_start(ch->cdev, &ch->ccw[0], 0, 0xff, 0);
- if (dolock) /* see remark about conditional locking */
+ if (dolock)
spin_unlock_irqrestore(
get_ccwdev_lock(ch->cdev), saveflags);
if (rc != 0)
@@ -1539,6 +1533,7 @@ done:
* arg Generic pointer, casted from channel * upon call.
*/
void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
struct net_device *dev = ch->netdev;
@@ -1566,7 +1561,6 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg)
ch->ccw[1].count = ch->max_bufsize;
CTCM_CCW_DUMP((char *)&ch->ccw[0], sizeof(struct ccw1) * 3);
if (event == CTC_EVENT_START)
- /* see remark about conditional locking */
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
rc = ccw_device_start(ch->cdev, &ch->ccw[0], 0, 0xff, 0);
if (event == CTC_EVENT_START)
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c
index aeb102537e7f..08e36685e578 100644
--- a/drivers/s390/net/ctcm_mpc.c
+++ b/drivers/s390/net/ctcm_mpc.c
@@ -1647,6 +1647,7 @@ done:
* CTCM_PROTO_MPC only
*/
static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side)
+__context_unsafe(/* Conditional locking */)
{
struct channel *ch = arg;
int rc = 0;
@@ -1774,9 +1775,6 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side)
CTCM_D3_DUMP((char *)ch->xid_id, 4);
if (!in_hardirq()) {
- /* Such conditional locking is a known problem for
- * sparse because its static undeterministic.
- * Warnings should be ignored here. */
spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
gotlock = 1;
}
@@ -1784,7 +1782,7 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side)
fsm_addtimer(&ch->timer, 5000 , CTC_EVENT_TIMER, ch);
rc = ccw_device_start(ch->cdev, &ch->ccw[8], 0, 0xff, 0);
- if (gotlock) /* see remark above about conditional locking */
+ if (gotlock)
spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
if (rc != 0) {
diff --git a/drivers/s390/net/fsm.h b/drivers/s390/net/fsm.h
index 16dc071a2973..6a0b47ca87f0 100644
--- a/drivers/s390/net/fsm.h
+++ b/drivers/s390/net/fsm.h
@@ -11,18 +11,18 @@
#include <linux/string.h>
#include <linux/atomic.h>
-/**
+/*
* Define this to get debugging messages.
*/
#define FSM_DEBUG 0
-/**
+/*
* Define this to get debugging massages for
* timer handling.
*/
#define FSM_TIMER_DEBUG 0
-/**
+/*
* Define these to record a history of
* Events/Statechanges and print it if a
* action_function is not found.
@@ -32,12 +32,12 @@
struct fsm_instance_t;
-/**
+/*
* Definition of an action function, called by a FSM
*/
typedef void (*fsm_function_t)(struct fsm_instance_t *, int, void *);
-/**
+/*
* Internal jump table for a FSM
*/
typedef struct {
@@ -49,7 +49,7 @@ typedef struct {
} fsm;
#if FSM_DEBUG_HISTORY
-/**
+/*
* Element of State/Event history used for debugging.
*/
typedef struct {
@@ -58,7 +58,7 @@ typedef struct {
} fsm_history;
#endif
-/**
+/*
* Representation of a FSM
*/
typedef struct fsm_instance_t {
@@ -75,7 +75,7 @@ typedef struct fsm_instance_t {
#endif
} fsm_instance;
-/**
+/*
* Description of a state-event combination
*/
typedef struct {
@@ -84,7 +84,7 @@ typedef struct {
fsm_function_t function;
} fsm_node;
-/**
+/*
* Description of a FSM Timer.
*/
typedef struct {
@@ -95,50 +95,52 @@ typedef struct {
} fsm_timer;
/**
- * Creates an FSM
+ * init_fsm - Creates a finite state machine
+ * @name: Name of this instance for logging purposes
+ * @state_names: Array of names for all states for logging purposes
+ * @event_names: Array of names for all events for logging purposes
+ * @nr_states: Number of states for this instance
+ * @nr_events: Number of events for this instance
+ * @tmpl: Pointer to fsm_node array describing this FSM
+ * @tmpl_len: Number of entries in the tmpl array
+ * @order: GFP flags for memory allocation (e.g. GFP_KERNEL)
*
- * @param name Name of this instance for logging purposes.
- * @param state_names An array of names for all states for logging purposes.
- * @param event_names An array of names for all events for logging purposes.
- * @param nr_states Number of states for this instance.
- * @param nr_events Number of events for this instance.
- * @param tmpl An array of fsm_nodes, describing this FSM.
- * @param tmpl_len Length of the describing array.
- * @param order Parameter for allocation of the FSM data structs.
+ * Allocates and initializes a finite state machine instance with the
+ * specified states, events, and transition table.
+ *
+ * Return: Pointer to initialized FSM instance, or NULL on failure
*/
-extern fsm_instance *
-init_fsm(char *name, const char **state_names,
- const char **event_names,
- int nr_states, int nr_events, const fsm_node *tmpl,
- int tmpl_len, gfp_t order);
+fsm_instance *init_fsm(char *name, const char **state_names,
+ const char **event_names, int nr_states,
+ int nr_events, const fsm_node *tmpl,
+ int tmpl_len, gfp_t order);
/**
- * Releases an FSM
+ * kfree_fsm - Releases a finite state machine
+ * @fi: Pointer to FSM instance, previously created with init_fsm()
*
- * @param fi Pointer to an FSM, previously created with init_fsm.
+ * Frees all memory associated with the FSM instance.
*/
-extern void kfree_fsm(fsm_instance *fi);
+void kfree_fsm(fsm_instance *fi);
#if FSM_DEBUG_HISTORY
-extern void
-fsm_print_history(fsm_instance *fi);
+void fsm_print_history(fsm_instance *fi);
-extern void
-fsm_record_history(fsm_instance *fi, int state, int event);
+void fsm_record_history(fsm_instance *fi, int state, int event);
#endif
/**
- * Emits an event to a FSM.
- * If an action function is defined for the current state/event combination,
- * this function is called.
+ * fsm_event - Emits an event to a finite state machine
+ * @fi: Pointer to FSM which should receive the event
+ * @event: The event to be delivered
+ * @arg: Generic argument, passed to the action function
*
- * @param fi Pointer to FSM which should receive the event.
- * @param event The event do be delivered.
- * @param arg A generic argument, handed to the action function.
+ * If an action function is defined for the current state/event
+ * combination, that function is called with the provided arguments.
*
- * @return 0 on success,
- * 1 if current state or event is out of range
- * !0 if state and event in range, but no action defined.
+ * Return:
+ * * 0 - Success, action function was called
+ * * 1 - State/event out of range, or no action function defined
*/
static inline int
fsm_event(fsm_instance *fi, int event, void *arg)
@@ -182,11 +184,12 @@ fsm_event(fsm_instance *fi, int event, void *arg)
}
/**
- * Modifies the state of an FSM.
- * This does <em>not</em> trigger an event or calls an action function.
+ * fsm_newstate - Modifies the state of a finite state machine
+ * @fi: Pointer to FSM
+ * @newstate: The new state for this FSM
*
- * @param fi Pointer to FSM
- * @param state The new state for this FSM.
+ * This does not trigger an event or call an action function.
+ * Wakes up any processes waiting on the FSM's wait queue.
*/
static inline void
fsm_newstate(fsm_instance *fi, int newstate)
@@ -203,11 +206,10 @@ fsm_newstate(fsm_instance *fi, int newstate)
}
/**
- * Retrieves the state of an FSM
- *
- * @param fi Pointer to FSM
+ * fsm_getstate - Retrieves the current state of a finite state machine
+ * @fi: Pointer to FSM
*
- * @return The current state of the FSM.
+ * Return: Current state number
*/
static inline int
fsm_getstate(fsm_instance *fi)
@@ -216,51 +218,53 @@ fsm_getstate(fsm_instance *fi)
}
/**
- * Retrieves the name of the state of an FSM
- *
- * @param fi Pointer to FSM
+ * fsm_getstate_str - Retrieves the name of the current FSM state
+ * @fi: Pointer to FSM
*
- * @return The current state of the FSM in a human readable form.
+ * Return: State name string, or "Invalid" if state is out of range
*/
-extern const char *fsm_getstate_str(fsm_instance *fi);
+const char *fsm_getstate_str(fsm_instance *fi);
/**
- * Initializes a timer for an FSM.
- * This prepares an fsm_timer for usage with fsm_addtimer.
+ * fsm_settimer - Initializes a timer for a finite state machine
+ * @fi: Pointer to FSM
+ * @this: The timer to be initialized
*
- * @param fi Pointer to FSM
- * @param timer The timer to be initialized.
+ * Prepares an fsm_timer for usage with fsm_addtimer().
*/
-extern void fsm_settimer(fsm_instance *fi, fsm_timer *);
+void fsm_settimer(fsm_instance *fi, fsm_timer *this);
/**
- * Clears a pending timer of an FSM instance.
+ * fsm_deltimer - Clears a pending timer of an FSM instance
+ * @timer: The timer to clear
*
- * @param timer The timer to clear.
+ * Stops and removes the timer. Safe to call on an inactive timer.
*/
-extern void fsm_deltimer(fsm_timer *timer);
+void fsm_deltimer(fsm_timer *timer);
/**
- * Adds and starts a timer to an FSM instance.
+ * fsm_addtimer - Adds and starts a timer for an FSM instance
+ * @timer: The timer to be added (timer->fi must point to the FSM instance)
+ * @millisec: Duration in milliseconds after which the timer expires
+ * @event: Event to trigger when timer expires
+ * @arg: Generic argument provided to the event handler
*
- * @param timer The timer to be added. The field fi of that timer
- * must have been set to point to the instance.
- * @param millisec Duration, after which the timer should expire.
- * @param event Event, to trigger if timer expires.
- * @param arg Generic argument, provided to expiry function.
+ * Starts a timer that will trigger the specified event after the given
+ * duration. The timer must have been initialized with fsm_settimer().
*
- * @return 0 on success, -1 if timer is already active.
+ * Return: Always returns 0
*/
-extern int fsm_addtimer(fsm_timer *timer, int millisec, int event, void *arg);
+int fsm_addtimer(fsm_timer *timer, int millisec, int event, void *arg);
/**
- * Modifies a timer of an FSM.
+ * fsm_modtimer - Modifies a timer of a finite state machine
+ * @timer: The timer to modify
+ * @millisec: New duration in milliseconds after which the timer expires
+ * @event: Event to trigger when timer expires
+ * @arg: Generic argument provided to the event handler
*
- * @param timer The timer to modify.
- * @param millisec Duration, after which the timer should expire.
- * @param event Event, to trigger if timer expires.
- * @param arg Generic argument, provided to expiry function.
+ * Stops the existing timer and restarts it with new parameters.
*/
-extern void fsm_modtimer(fsm_timer *timer, int millisec, int event, void *arg);
+void fsm_modtimer(fsm_timer *timer, int millisec, int event, void *arg);
#endif /* _FSM_H_ */