drivers/ssb/main.c
Source file repositories/reference/linux-study-clean/drivers/ssb/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/ssb/main.c- Extension
.c- Size
- 31041 bytes
- Lines
- 1342
- Domain
- Driver Families
- Bucket
- drivers/ssb
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ssb_private.hlinux/delay.hlinux/io.hlinux/module.hlinux/platform_device.hlinux/ssb/ssb.hlinux/ssb/ssb_regs.hlinux/ssb/ssb_driver_gige.hlinux/dma-mapping.hlinux/pci.hlinux/mmc/sdio_func.hlinux/slab.hpcmcia/cistpl.hpcmcia/ds.h
Detected Declarations
function ssb_for_each_bus_callfunction ssb_device_putfunction ssb_device_resumefunction ssb_device_suspendfunction ssb_bus_resumefunction ssb_bus_suspendfunction ssb_devices_freezefunction ssb_devices_thawfunction ssb_device_shutdownfunction ssb_device_removefunction ssb_device_probefunction ssb_match_devidfunction ssb_bus_matchfunction ssb_device_ueventfunction name_showfunction ssb_buses_lockfunction ssb_buses_unlockfunction ssb_devices_unregisterfunction ssb_bus_unregisterfunction ssb_release_devfunction ssb_devices_registerfunction ssb_attach_queued_busesfunction list_for_each_entry_safefunction ssb_fetch_invariantsfunction ssb_bus_registerfunction ssb_bus_pcibus_registerfunction ssb_bus_pcmciabus_registerfunction ssb_bus_sdiobus_registerfunction ssb_bus_host_soc_registerfunction __ssb_driver_registerfunction ssb_driver_unregisterfunction ssb_set_devtypedatafunction clkfactor_f6_resolvefunction ssb_calc_clock_ratefunction ssb_clockspeedfunction ssb_tmslow_reject_bitmaskfunction ssb_device_is_enabledfunction ssb_flush_tmslowfunction ssb_device_enablefunction ssb_wait_bitsfunction ssb_device_disablefunction ssb_dma_translation_special_bitfunction ssb_dma_translationfunction ssb_bus_may_powerdownfunction ssb_bus_powerupfunction ssb_broadcast_valuefunction ssb_commit_settingsfunction ssb_admatch_base
Annotated Snippet
static int ssb_bus_match(struct device *dev, const struct device_driver *drv)
{
struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
const struct ssb_driver *ssb_drv = drv_to_ssb_drv(drv);
const struct ssb_device_id *id;
for (id = ssb_drv->id_table;
id->vendor || id->coreid || id->revision;
id++) {
if (ssb_match_devid(id, &ssb_dev->id))
return 1; /* found */
}
return 0;
}
static int ssb_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct ssb_device *ssb_dev;
if (!dev)
return -ENODEV;
ssb_dev = dev_to_ssb_dev(dev);
return add_uevent_var(env,
"MODALIAS=ssb:v%04Xid%04Xrev%02X",
ssb_dev->id.vendor, ssb_dev->id.coreid,
ssb_dev->id.revision);
}
#define ssb_config_attr(attrib, field, format_string) \
static ssize_t \
attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
{ \
return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
} \
static DEVICE_ATTR_RO(attrib);
ssb_config_attr(core_num, core_index, "%u\n")
ssb_config_attr(coreid, id.coreid, "0x%04x\n")
ssb_config_attr(vendor, id.vendor, "0x%04x\n")
ssb_config_attr(revision, id.revision, "%u\n")
ssb_config_attr(irq, irq, "%u\n")
static ssize_t
name_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n",
ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
}
static DEVICE_ATTR_RO(name);
static struct attribute *ssb_device_attrs[] = {
&dev_attr_name.attr,
&dev_attr_core_num.attr,
&dev_attr_coreid.attr,
&dev_attr_vendor.attr,
&dev_attr_revision.attr,
&dev_attr_irq.attr,
NULL,
};
ATTRIBUTE_GROUPS(ssb_device);
static const struct bus_type ssb_bustype = {
.name = "ssb",
.match = ssb_bus_match,
.probe = ssb_device_probe,
.remove = ssb_device_remove,
.shutdown = ssb_device_shutdown,
.suspend = ssb_device_suspend,
.resume = ssb_device_resume,
.uevent = ssb_device_uevent,
.dev_groups = ssb_device_groups,
};
static void ssb_buses_lock(void)
{
/* See the comment at the ssb_is_early_boot definition */
if (!ssb_is_early_boot)
mutex_lock(&buses_mutex);
}
static void ssb_buses_unlock(void)
{
/* See the comment at the ssb_is_early_boot definition */
if (!ssb_is_early_boot)
mutex_unlock(&buses_mutex);
}
static void ssb_devices_unregister(struct ssb_bus *bus)
Annotation
- Immediate include surface: `ssb_private.h`, `linux/delay.h`, `linux/io.h`, `linux/module.h`, `linux/platform_device.h`, `linux/ssb/ssb.h`, `linux/ssb/ssb_regs.h`, `linux/ssb/ssb_driver_gige.h`.
- Detected declarations: `function ssb_for_each_bus_call`, `function ssb_device_put`, `function ssb_device_resume`, `function ssb_device_suspend`, `function ssb_bus_resume`, `function ssb_bus_suspend`, `function ssb_devices_freeze`, `function ssb_devices_thaw`, `function ssb_device_shutdown`, `function ssb_device_remove`.
- Atlas domain: Driver Families / drivers/ssb.
- Implementation status: pattern 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.