/**//***************************************************************************** * Extern Function Details */ /**//**[drivers/base/driver.c] * driver_register - register driver with bus * @drv: driver to register * * We pass off most of the work to the bus_add_driver() call, * since most of the things we have to do deal with the bus * structures. * * The one interesting aspect is that we setup @drv->unloaded * as a completion that gets complete when the driver reference * count reaches 0. */ int driver_register(struct device_driver * drv) ...{ klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put); init_completion(&drv->unloaded); return bus_add_driver(drv); }
/**//**[drivers/base/platform.c] * platform_get_irq - get an IRQ for a device * @dev: platform device * @num: IRQ number index */ int platform_get_irq(struct platform_device *dev, unsigned int num) ...{ struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
return r ? r->start : 0; }
/**//**[drivers/base/platform.c] * platform_get_resource - get a resource for a device * @dev: platform device * @type: resource type * @num: resource index */ struct resource * platform_get_resource(struct platform_device *dev, unsigned int type, unsigned int num) ...{ int i;
for (i =0; i < dev->num_resources; i++) ...{ struct resource *r =&dev->resource[i];
if ((r->flags & (IORESOURCE_IO|IORESOURCE_MEM| IORESOURCE_IRQ|IORESOURCE_DMA)) == type) if (num--==0) return r; } return NULL; }
/**//*[../include/linux/ioport.h] * Resources are tree-like, allowing * nesting etc.. */ struct resource ...{ constchar*name; unsigned long start, end; unsigned long flags; struct resource *parent, *sibling, *child; };
/**//**[arch/arm/kernel/time.c] * save_time_delta - Save the offset between system time and RTC time * @delta: pointer to timespec to store delta * @rtc: pointer to timespec for current RTC time * * Return a delta between the system time and the RTC time, such * that system time can be restored later with restore_time_delta() * *[LiY]返回一个系统时间和RTC时间的差值,在重起或系统去读RTC后,可以再用这个差值(delta)来恢复系统时间(系统时间不一定非要和RTC时间相同的); */ void save_time_delta(struct timespec *delta, struct timespec *rtc) ...{ set_normalized_timespec(delta, xtime.tv_sec - rtc->tv_sec, xtime.tv_nsec - rtc->tv_nsec); }
/**//***[arch/arm/kernel/time.c] * restore_time_delta - Restore the current system time * @delta: delta returned by save_time_delta() * @rtc: pointer to timespec for current RTC time */ void restore_time_delta(struct timespec *delta, struct timespec *rtc) ...{ struct timespec ts;