drivers/scsi/qedi/qedi_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedi/qedi_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedi/qedi_sysfs.c- Extension
.c- Size
- 1295 bytes
- Lines
- 59
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
qedi.hqedi_gbl.hqedi_iscsi.hqedi_dbg.h
Detected Declarations
function Copyrightfunction port_state_showfunction speed_show
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* QLogic iSCSI Offload Driver
* Copyright (c) 2016 Cavium Inc.
*/
#include "qedi.h"
#include "qedi_gbl.h"
#include "qedi_iscsi.h"
#include "qedi_dbg.h"
static inline struct qedi_ctx *qedi_dev_to_hba(struct device *dev)
{
struct Scsi_Host *shost = class_to_shost(dev);
return iscsi_host_priv(shost);
}
static ssize_t port_state_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct qedi_ctx *qedi = qedi_dev_to_hba(dev);
if (atomic_read(&qedi->link_state) == QEDI_LINK_UP)
return sprintf(buf, "Online\n");
else
return sprintf(buf, "Linkdown\n");
}
static ssize_t speed_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct qedi_ctx *qedi = qedi_dev_to_hba(dev);
struct qed_link_output if_link;
qedi_ops->common->get_link(qedi->cdev, &if_link);
return sprintf(buf, "%d Gbit\n", if_link.speed / 1000);
}
static DEVICE_ATTR_RO(port_state);
static DEVICE_ATTR_RO(speed);
static struct attribute *qedi_shost_attrs[] = {
&dev_attr_port_state.attr,
&dev_attr_speed.attr,
NULL
};
static const struct attribute_group qedi_shost_attr_group = {
.attrs = qedi_shost_attrs
};
const struct attribute_group *qedi_shost_groups[] = {
&qedi_shost_attr_group,
NULL
};
Annotation
- Immediate include surface: `qedi.h`, `qedi_gbl.h`, `qedi_iscsi.h`, `qedi_dbg.h`.
- Detected declarations: `function Copyright`, `function port_state_show`, `function speed_show`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.