diff options
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/class.c | 2 | ||||
| -rw-r--r-- | drivers/base/core.c | 6 | ||||
| -rw-r--r-- | drivers/base/cpu.c | 16 | ||||
| -rw-r--r-- | drivers/base/firmware_class.c | 2 | ||||
| -rw-r--r-- | drivers/base/memory.c | 15 | ||||
| -rw-r--r-- | drivers/base/node.c | 7 | ||||
| -rw-r--r-- | drivers/base/platform.c | 33 | 
7 files changed, 59 insertions, 22 deletions
| diff --git a/drivers/base/class.c b/drivers/base/class.c index 0147f476b8a9..9c6a0d6408e7 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -219,6 +219,8 @@ static void class_create_release(struct class *cls)   * This is used to create a struct class pointer that can then be used   * in calls to device_create().   * + * Returns &struct class pointer on success, or ERR_PTR() on error. + *   * Note, the pointer created here is to be destroyed when finished by   * making a call to class_destroy().   */ diff --git a/drivers/base/core.c b/drivers/base/core.c index ef55df34ddd0..b56a0ba31d4a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1345,6 +1345,8 @@ static void root_device_release(struct device *dev)   * 'module' symlink which points to the @owner directory   * in sysfs.   * + * Returns &struct device pointer on success, or ERR_PTR() on error. + *   * Note: You probably want to use root_device_register().   */  struct device *__root_device_register(const char *name, struct module *owner) @@ -1432,6 +1434,8 @@ static void device_create_release(struct device *dev)   * Any further sysfs files that might be required can be created using this   * pointer.   * + * Returns &struct device pointer on success, or ERR_PTR() on error. + *   * Note: the struct class passed to this function must have previously   * been created with a call to class_create().   */ @@ -1492,6 +1496,8 @@ EXPORT_SYMBOL_GPL(device_create_vargs);   * Any further sysfs files that might be required can be created using this   * pointer.   * + * Returns &struct device pointer on success, or ERR_PTR() on error. + *   * Note: the struct class passed to this function must have previously   * been created with a call to class_create().   */ diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 7036e8e96ab8..b5242e1e8bc4 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -79,24 +79,24 @@ void unregister_cpu(struct cpu *cpu)  }  #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE -static ssize_t cpu_probe_store(struct sys_device *dev, -				struct sysdev_attribute *attr, -				const char *buf, +static ssize_t cpu_probe_store(struct sysdev_class *class, +			       struct sysdev_class_attribute *attr, +			       const char *buf,  			       size_t count)  {  	return arch_cpu_probe(buf, count);  } -static ssize_t cpu_release_store(struct sys_device *dev, -				struct sysdev_attribute *attr, -				const char *buf, +static ssize_t cpu_release_store(struct sysdev_class *class, +				 struct sysdev_class_attribute *attr, +				 const char *buf,  				 size_t count)  {  	return arch_cpu_release(buf, count);  } -static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); -static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store); +static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); +static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store);  #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */  #else /* ... !CONFIG_HOTPLUG_CPU */ diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index d0dc26ad5387..18518ba13c81 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -78,6 +78,7 @@ firmware_timeout_show(struct class *class,  /**   * firmware_timeout_store - set number of seconds to wait for firmware   * @class: device class pointer + * @attr: device attribute pointer   * @buf: buffer to scan for timeout value   * @count: number of bytes in @buf   * @@ -442,6 +443,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,  	fw_priv = dev_get_drvdata(f_dev);  	fw_priv->fw = fw; +	sysfs_bin_attr_init(&fw_priv->attr_data);  	retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);  	if (retval) {  		dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2f8691511190..db0848e54cc6 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -429,12 +429,16 @@ static inline int memory_fail_init(void)   * differentiation between which *physical* devices each   * section belongs to...   */ +int __weak arch_get_memory_phys_device(unsigned long start_pfn) +{ +	return 0; +}  static int add_memory_block(int nid, struct mem_section *section, -			unsigned long state, int phys_device, -			enum mem_add_context context) +			unsigned long state, enum mem_add_context context)  {  	struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL); +	unsigned long start_pfn;  	int ret = 0;  	if (!mem) @@ -443,7 +447,8 @@ static int add_memory_block(int nid, struct mem_section *section,  	mem->phys_index = __section_nr(section);  	mem->state = state;  	mutex_init(&mem->state_mutex); -	mem->phys_device = phys_device; +	start_pfn = section_nr_to_pfn(mem->phys_index); +	mem->phys_device = arch_get_memory_phys_device(start_pfn);  	ret = register_memory(mem, section);  	if (!ret) @@ -515,7 +520,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,   */  int register_new_memory(int nid, struct mem_section *section)  { -	return add_memory_block(nid, section, MEM_OFFLINE, 0, HOTPLUG); +	return add_memory_block(nid, section, MEM_OFFLINE, HOTPLUG);  }  int unregister_memory_section(struct mem_section *section) @@ -548,7 +553,7 @@ int __init memory_dev_init(void)  		if (!present_section_nr(i))  			continue;  		err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, -					0, BOOT); +				       BOOT);  		if (!ret)  			ret = err;  	} diff --git a/drivers/base/node.c b/drivers/base/node.c index ad43185ec15a..93b3ac65c2d4 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -165,8 +165,11 @@ static ssize_t node_read_distance(struct sys_device * dev,  	int len = 0;  	int i; -	/* buf currently PAGE_SIZE, need ~4 chars per node */ -	BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2); +	/* +	 * buf is currently PAGE_SIZE in length and each node needs 4 chars +	 * at the most (distance + space or newline). +	 */ +	BUILD_BUG_ON(MAX_NUMNODES * 4 > PAGE_SIZE);  	for_each_online_node(i)  		len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 1ba9d617d241..4b4b565c835f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -362,6 +362,8 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);   * enumeration tasks, they don't fully conform to the Linux driver model.   * In particular, when such drivers are built as modules, they can't be   * "hotplugged". + * + * Returns &struct platform_device pointer on success, or ERR_PTR() on error.   */  struct platform_device *platform_device_register_simple(const char *name,  							int id, @@ -408,6 +410,8 @@ EXPORT_SYMBOL_GPL(platform_device_register_simple);   * allocated for the device allows drivers using such devices to be   * unloaded without waiting for the last reference to the device to be   * dropped. + * + * Returns &struct platform_device pointer on success, or ERR_PTR() on error.   */  struct platform_device *platform_device_register_data(  		struct device *parent, @@ -559,6 +563,8 @@ EXPORT_SYMBOL_GPL(platform_driver_probe);   *   * Use this in legacy-style modules that probe hardware directly and   * register a single platform device and corresponding platform driver. + * + * Returns &struct platform_device pointer on success, or ERR_PTR() on error.   */  struct platform_device * __init_or_module platform_create_bundle(  			struct platform_driver *driver, @@ -1052,9 +1058,11 @@ static __initdata LIST_HEAD(early_platform_driver_list);  static __initdata LIST_HEAD(early_platform_device_list);  /** - * early_platform_driver_register + * early_platform_driver_register - register early platform driver   * @epdrv: early_platform driver structure   * @buf: string passed from early_param() + * + * Helper function for early_platform_init() / early_platform_init_buffer()   */  int __init early_platform_driver_register(struct early_platform_driver *epdrv,  					  char *buf) @@ -1106,9 +1114,12 @@ int __init early_platform_driver_register(struct early_platform_driver *epdrv,  }  /** - * early_platform_add_devices - add a numbers of early platform devices + * early_platform_add_devices - adds a number of early platform devices   * @devs: array of early platform devices to add   * @num: number of early platform devices in array + * + * Used by early architecture code to register early platform devices and + * their platform data.   */  void __init early_platform_add_devices(struct platform_device **devs, int num)  { @@ -1128,8 +1139,12 @@ void __init early_platform_add_devices(struct platform_device **devs, int num)  }  /** - * early_platform_driver_register_all + * early_platform_driver_register_all - register early platform drivers   * @class_str: string to identify early platform driver class + * + * Used by architecture code to register all early platform drivers + * for a certain class. If omitted then only early platform drivers + * with matching kernel command line class parameters will be registered.   */  void __init early_platform_driver_register_all(char *class_str)  { @@ -1151,7 +1166,7 @@ void __init early_platform_driver_register_all(char *class_str)  }  /** - * early_platform_match + * early_platform_match - find early platform device matching driver   * @epdrv: early platform driver structure   * @id: id to match against   */ @@ -1169,7 +1184,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id)  }  /** - * early_platform_left + * early_platform_left - check if early platform driver has matching devices   * @epdrv: early platform driver structure   * @id: return true if id or above exists   */ @@ -1187,7 +1202,7 @@ static  __init int early_platform_left(struct early_platform_driver *epdrv,  }  /** - * early_platform_driver_probe_id + * early_platform_driver_probe_id - probe drivers matching class_str and id   * @class_str: string to identify early platform driver class   * @id: id to match against   * @nr_probe: number of platform devices to successfully probe before exiting @@ -1257,10 +1272,14 @@ static int __init early_platform_driver_probe_id(char *class_str,  }  /** - * early_platform_driver_probe + * early_platform_driver_probe - probe a class of registered drivers   * @class_str: string to identify early platform driver class   * @nr_probe: number of platform devices to successfully probe before exiting   * @user_only: only probe user specified early platform devices + * + * Used by architecture code to probe registered early platform drivers + * within a certain class. For probe to happen a registered early platform + * device matching a registered early platform driver is needed.   */  int __init early_platform_driver_probe(char *class_str,  				       int nr_probe, | 
