drivers/irqchip/irq-ast2700-intc0-test.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-ast2700-intc0-test.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-ast2700-intc0-test.c- Extension
.c- Size
- 11076 bytes
- Lines
- 474
- Domain
- Driver Families
- Bucket
- drivers/irqchip
- 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
kunit/test.hirq-ast2700.h
Detected Declarations
function Copyrightfunction gicv3_fwnode_read_string_arrayfunction aspeed_intc_resolve_route_invalid_c0domainfunction aspeed_intc0_fwnode_read_string_arrayfunction aspeed_intc0_resolve_route_c1i1o1c0i1o1_connectedfunction aspeed_intc0_resolve_route_c1i1o1c0i1o1_disconnectedfunction aspeed_intc0_resolve_route_c1i1o1mc0i1o1function aspeed_intc0_resolve_route_c1i2o2mc0i1o1function aspeed_intc0_resolve_route_c1i1o1mc0i2o1function aspeed_intc0_resolve_route_c1i1o2mc0i1o1_invalidfunction aspeed_intc0_resolve_route_c1i1o1mc0i1o1_bad_range_upstream
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2026 Code Construct
*/
#include <kunit/test.h>
#include "irq-ast2700.h"
static void aspeed_intc0_resolve_route_bad_args(struct kunit *test)
{
static const struct aspeed_intc_interrupt_range c1ranges[] = { 0 };
static const u32 c1outs[] = { 0 };
struct aspeed_intc_interrupt_range resolved;
const struct irq_domain c0domain = { 0 };
int rc;
rc = aspeed_intc0_resolve_route(NULL, 0, c1outs, 0, c1ranges, NULL);
KUNIT_EXPECT_EQ(test, rc, -EINVAL);
rc = aspeed_intc0_resolve_route(&c0domain, 0, c1outs,
ARRAY_SIZE(c1ranges), c1ranges,
&resolved);
KUNIT_EXPECT_EQ(test, rc, -ENOENT);
rc = aspeed_intc0_resolve_route(&c0domain, ARRAY_SIZE(c1outs), c1outs,
0, c1ranges, &resolved);
KUNIT_EXPECT_EQ(test, rc, -ENOENT);
}
static int gicv3_fwnode_read_string_array(const struct fwnode_handle *fwnode,
const char *propname, const char **val, size_t nval)
{
if (!propname)
return -EINVAL;
if (!val)
return 1;
if (WARN_ON(nval != 1))
return -EOVERFLOW;
*val = "arm,gic-v3";
return 1;
}
static const struct fwnode_operations arm_gicv3_fwnode_ops = {
.property_read_string_array = gicv3_fwnode_read_string_array,
};
static void aspeed_intc_resolve_route_invalid_c0domain(struct kunit *test)
{
struct device_node intc0_node = {
.fwnode = { .ops = &arm_gicv3_fwnode_ops },
};
const struct irq_domain c0domain = { .fwnode = &intc0_node.fwnode };
static const struct aspeed_intc_interrupt_range c1ranges[] = { 0 };
static const u32 c1outs[] = { 0 };
struct aspeed_intc_interrupt_range resolved;
int rc;
rc = aspeed_intc0_resolve_route(&c0domain, ARRAY_SIZE(c1outs), c1outs,
ARRAY_SIZE(c1ranges), c1ranges,
&resolved);
KUNIT_EXPECT_NE(test, rc, 0);
}
static int
aspeed_intc0_fwnode_read_string_array(const struct fwnode_handle *fwnode_handle,
const char *propname, const char **val,
size_t nval)
{
if (!propname)
return -EINVAL;
if (!val)
return 1;
if (WARN_ON(nval != 1))
return -EOVERFLOW;
*val = "aspeed,ast2700-intc0";
return nval;
}
static const struct fwnode_operations intc0_fwnode_ops = {
.property_read_string_array = aspeed_intc0_fwnode_read_string_array,
};
static void
aspeed_intc0_resolve_route_c1i1o1c0i1o1_connected(struct kunit *test)
Annotation
- Immediate include surface: `kunit/test.h`, `irq-ast2700.h`.
- Detected declarations: `function Copyright`, `function gicv3_fwnode_read_string_array`, `function aspeed_intc_resolve_route_invalid_c0domain`, `function aspeed_intc0_fwnode_read_string_array`, `function aspeed_intc0_resolve_route_c1i1o1c0i1o1_connected`, `function aspeed_intc0_resolve_route_c1i1o1c0i1o1_disconnected`, `function aspeed_intc0_resolve_route_c1i1o1mc0i1o1`, `function aspeed_intc0_resolve_route_c1i2o2mc0i1o1`, `function aspeed_intc0_resolve_route_c1i1o1mc0i2o1`, `function aspeed_intc0_resolve_route_c1i1o2mc0i1o1_invalid`.
- Atlas domain: Driver Families / drivers/irqchip.
- 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.