drivers/scsi/elx/libefc/efc_sm.c
Source file repositories/reference/linux-study-clean/drivers/scsi/elx/libefc/efc_sm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/elx/libefc/efc_sm.c- Extension
.c- Size
- 1124 bytes
- Lines
- 55
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
efc.hefc_sm.h
Detected Declarations
function Copyrightfunction efc_sm_transition
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2021 Broadcom. All Rights Reserved. The term
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
*/
/*
* Generic state machine framework.
*/
#include "efc.h"
#include "efc_sm.h"
/**
* efc_sm_post_event() - Post an event to a context.
*
* @ctx: State machine context
* @evt: Event to post
* @data: Event-specific data (if any)
*/
int
efc_sm_post_event(struct efc_sm_ctx *ctx,
enum efc_sm_event evt, void *data)
{
if (!ctx->current_state)
return -EIO;
ctx->current_state(ctx, evt, data);
return 0;
}
void
efc_sm_transition(struct efc_sm_ctx *ctx,
void (*state)(struct efc_sm_ctx *,
enum efc_sm_event, void *), void *data)
{
if (ctx->current_state == state) {
efc_sm_post_event(ctx, EFC_EVT_REENTER, data);
} else {
efc_sm_post_event(ctx, EFC_EVT_EXIT, data);
ctx->current_state = state;
efc_sm_post_event(ctx, EFC_EVT_ENTER, data);
}
}
static char *event_name[] = EFC_SM_EVENT_NAME;
const char *efc_sm_event_name(enum efc_sm_event evt)
{
if (evt > EFC_EVT_LAST)
return "unknown";
return event_name[evt];
}
Annotation
- Immediate include surface: `efc.h`, `efc_sm.h`.
- Detected declarations: `function Copyright`, `function efc_sm_transition`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.