drivers/dpll/zl3073x/devlink.c
Source file repositories/reference/linux-study-clean/drivers/dpll/zl3073x/devlink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dpll/zl3073x/devlink.c- Extension
.c- Size
- 9525 bytes
- Lines
- 391
- Domain
- Driver Families
- Bucket
- drivers/dpll
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device/devres.hlinux/netlink.hlinux/sprintf.hlinux/types.hnet/devlink.hcore.hdevlink.hdpll.hflash.hfw.hregs.h
Detected Declarations
function zl3073x_devlink_info_getfunction zl3073x_devlink_reload_downfunction zl3073x_devlink_reload_upfunction zl3073x_devlink_flash_notifyfunction zl3073x_devlink_flash_preparefunction zl3073x_devlink_flash_finishfunction zl3073x_devlink_flash_updatefunction zl3073x_devlink_freefunction zl3073x_devlink_param_clock_id_validatefunction zl3073x_devlink_unregisterfunction zl3073x_devlink_register
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/device/devres.h>
#include <linux/netlink.h>
#include <linux/sprintf.h>
#include <linux/types.h>
#include <net/devlink.h>
#include "core.h"
#include "devlink.h"
#include "dpll.h"
#include "flash.h"
#include "fw.h"
#include "regs.h"
/**
* zl3073x_devlink_info_get - Devlink device info callback
* @devlink: devlink structure pointer
* @req: devlink request pointer to store information
* @extack: netlink extack pointer to report errors
*
* Return: 0 on success, <0 on error
*/
static int
zl3073x_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
struct netlink_ext_ack *extack)
{
struct zl3073x_dev *zldev = devlink_priv(devlink);
u16 id, revision, fw_ver;
char buf[16];
u32 cfg_ver;
int rc;
rc = zl3073x_read_u16(zldev, ZL_REG_ID, &id);
if (rc)
return rc;
snprintf(buf, sizeof(buf), "%X", id);
rc = devlink_info_version_fixed_put(req,
DEVLINK_INFO_VERSION_GENERIC_ASIC_ID,
buf);
if (rc)
return rc;
rc = zl3073x_read_u16(zldev, ZL_REG_REVISION, &revision);
if (rc)
return rc;
snprintf(buf, sizeof(buf), "%X", revision);
rc = devlink_info_version_fixed_put(req,
DEVLINK_INFO_VERSION_GENERIC_ASIC_REV,
buf);
if (rc)
return rc;
rc = zl3073x_read_u16(zldev, ZL_REG_FW_VER, &fw_ver);
if (rc)
return rc;
snprintf(buf, sizeof(buf), "%u", fw_ver);
rc = devlink_info_version_running_put(req,
DEVLINK_INFO_VERSION_GENERIC_FW,
buf);
if (rc)
return rc;
rc = zl3073x_read_u32(zldev, ZL_REG_CUSTOM_CONFIG_VER, &cfg_ver);
if (rc)
return rc;
/* No custom config version */
if (cfg_ver == U32_MAX)
return 0;
snprintf(buf, sizeof(buf), "%lu.%lu.%lu.%lu",
FIELD_GET(GENMASK(31, 24), cfg_ver),
FIELD_GET(GENMASK(23, 16), cfg_ver),
FIELD_GET(GENMASK(15, 8), cfg_ver),
FIELD_GET(GENMASK(7, 0), cfg_ver));
return devlink_info_version_running_put(req, "custom_cfg", buf);
}
static int
zl3073x_devlink_reload_down(struct devlink *devlink, bool netns_change,
enum devlink_reload_action action,
enum devlink_reload_limit limit,
struct netlink_ext_ack *extack)
{
struct zl3073x_dev *zldev = devlink_priv(devlink);
Annotation
- Immediate include surface: `linux/device/devres.h`, `linux/netlink.h`, `linux/sprintf.h`, `linux/types.h`, `net/devlink.h`, `core.h`, `devlink.h`, `dpll.h`.
- Detected declarations: `function zl3073x_devlink_info_get`, `function zl3073x_devlink_reload_down`, `function zl3073x_devlink_reload_up`, `function zl3073x_devlink_flash_notify`, `function zl3073x_devlink_flash_prepare`, `function zl3073x_devlink_flash_finish`, `function zl3073x_devlink_flash_update`, `function zl3073x_devlink_free`, `function zl3073x_devlink_param_clock_id_validate`, `function zl3073x_devlink_unregister`.
- Atlas domain: Driver Families / drivers/dpll.
- Implementation status: integration 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.