cregit-Linux how code gets into the kernel

Release 4.11 drivers/acpi/container.c

Directory: drivers/acpi
/*
 * container.c  - ACPI Generic Container Driver
 *
 * Copyright (C) 2004 Anil S Keshavamurthy (anil.s.keshavamurthy@intel.com)
 * Copyright (C) 2004 Keiichiro Tokunaga (tokunaga.keiich@jp.fujitsu.com)
 * Copyright (C) 2004 Motoyuki Ito (motoyuki@soft.fujitsu.com)
 * Copyright (C) 2004 FUJITSU LIMITED
 * Copyright (C) 2004, 2013 Intel Corp.
 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or (at
 *  your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
#include <linux/acpi.h>
#include <linux/container.h>

#include "internal.h"


#define _COMPONENT			ACPI_CONTAINER_COMPONENT
ACPI_MODULE_NAME("container");


static const struct acpi_device_id container_device_ids[] = {
	{"ACPI0004", 0},
	{"PNP0A05", 0},
	{"PNP0A06", 0},
	{"", 0},
};

#ifdef CONFIG_ACPI_CONTAINER


static int acpi_container_offline(struct container_dev *cdev) { struct acpi_device *adev = ACPI_COMPANION(&cdev->dev); struct acpi_device *child; /* Check all of the dependent devices' physical companions. */ list_for_each_entry(child, &adev->children, node) if (!acpi_scan_is_offline(child, false)) return -EBUSY; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki55100.00%1100.00%
Total55100.00%1100.00%


static void acpi_container_release(struct device *dev) { kfree(to_container_dev(dev)); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki19100.00%1100.00%
Total19100.00%1100.00%


static int container_device_attach(struct acpi_device *adev, const struct acpi_device_id *not_used) { struct container_dev *cdev; struct device *dev; int ret; if (adev->flags.is_dock_station) return 0; cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); if (!cdev) return -ENOMEM; cdev->offline = acpi_container_offline; dev = &cdev->dev; dev->bus = &container_subsys; dev_set_name(dev, "%s", dev_name(&adev->dev)); ACPI_COMPANION_SET(dev, adev); dev->release = acpi_container_release; ret = device_register(dev); if (ret) { put_device(dev); return ret; } adev->driver_data = dev; return 1; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki141100.00%5100.00%
Total141100.00%5100.00%


static void container_device_detach(struct acpi_device *adev) { struct device *dev = acpi_driver_data(adev); adev->driver_data = NULL; if (dev) device_unregister(dev); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki36100.00%2100.00%
Total36100.00%2100.00%


static void container_device_online(struct acpi_device *adev) { struct device *dev = acpi_driver_data(adev); kobject_uevent(&dev->kobj, KOBJ_ONLINE); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki31100.00%1100.00%
Total31100.00%1100.00%

static struct acpi_scan_handler container_handler = { .ids = container_device_ids, .attach = container_device_attach, .detach = container_device_detach, .hotplug = { .enabled = true, .demand_offline = true, .notify_online = container_device_online, }, };
void __init acpi_container_init(void) { acpi_scan_add_handler(&container_handler); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki964.29%266.67%
Len Brown535.71%133.33%
Total14100.00%3100.00%

#else static struct acpi_scan_handler container_handler = { .ids = container_device_ids, };
void __init acpi_container_init(void) { acpi_scan_add_handler_with_hotplug(&container_handler, "container"); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki1168.75%266.67%
Len Brown531.25%133.33%
Total16100.00%3100.00%

#endif /* CONFIG_ACPI_CONTAINER */

Overall Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki35082.16%960.00%
Len Brown368.45%213.33%
Thomas Renninger347.98%16.67%
Toshi Kani40.94%16.67%
Patrick Mochel10.23%16.67%
Jarkko Nikula10.23%16.67%
Total426100.00%15100.00%
Directory: drivers/acpi
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.