Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755347Ab1EXL2b (ORCPT ); Tue, 24 May 2011 07:28:31 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:63914 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755030Ab1EXL23 (ORCPT ); Tue, 24 May 2011 07:28:29 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=V7EiEdCJ1mxokwOVzaOR74eG5KR7OWjoWy1/a7ciDg0/Tcrz0pVUwBJYVbuaeOFOQ1 W89tpKY9Hy79Z1zl0o0dJ63958nwgPEmLY8TTqMrlA5AId05rEna93W9ct5upvu+WH5m zrQm0/4Ovp+3RFcQ0eWfp9FWTWfjvGEULxTDY= Date: Tue, 24 May 2011 14:28:31 +0300 From: Sergey Senozhatsky To: Jean Delvare Cc: Guenter Roeck , lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org Subject: [PATCH] coretemp: Initialize sysfs attrs Message-ID: <20110524112831.GA5520@swordfish.minsk.epam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3488 Lines: 70 Initialize sysfs attrs before device_create_file() call to suppress lockdep_init_map() warning: [ 3.653628] WARNING: at kernel/lockdep.c:2885 lockdep_init_map+0xea/0x43c() [ 3.653698] Modules linked in: [ 3.654835] Pid: 1, comm: swapper Not tainted 2.6.39-dbg-git8-05624-g46187f8 #576 [ 3.656014] Call Trace: [ 3.657139] [] warn_slowpath_common+0x7e/0x96 [ 3.658298] [] warn_slowpath_null+0x15/0x17 [ 3.659460] [] lockdep_init_map+0xea/0x43c [ 3.660616] [] sysfs_add_file_mode+0x5d/0xa8 [ 3.661785] [] sysfs_add_file+0xc/0xe [ 3.662929] [] sysfs_create_file+0x23/0x25 [ 3.664045] [] device_create_file+0x14/0x16 [ 3.665172] [] coretemp_probe+0xf9/0x185 [ 3.666306] [] platform_drv_probe+0x12/0x14 [ 3.667420] [] driver_probe_device+0xb0/0x14b [ 3.668542] [] __device_attach+0x35/0x3a [ 3.669710] [] ? __driver_attach+0x7c/0x7c [ 3.670816] [] bus_for_each_drv+0x54/0x88 [ 3.671921] [] device_attach+0x77/0x9b [ 3.673027] [] bus_probe_device+0x22/0x39 [ 3.674137] [] device_add+0x3c1/0x550 [ 3.675249] [] ? dev_set_name+0x3c/0x3e [ 3.676371] [] platform_device_add+0x10c/0x156 [ 3.677491] [] get_core_online+0xab/0x16e [ 3.678608] [] coretemp_init+0x4b/0x80 [ 3.679724] [] ? hwmon_init+0xee/0xee [ 3.680853] [] do_one_initcall+0x7a/0x13c [ 3.681975] [] kernel_init+0xe1/0x15b [ 3.683081] [] kernel_thread_helper+0x4/0x10 [ 3.684174] [] ? finish_task_switch+0x76/0xf0 [ 3.685266] [] ? retint_restore_args+0x13/0x13 [ 3.686356] [] ? start_kernel+0x3ee/0x3ee [ 3.687425] [] ? gs_change+0x13/0x13 [ 3.688489] ---[ end trace 7392ad3e6a92ae39 ]--- Signed-off-by: Sergey Senozhatsky --- drivers/hwmon/coretemp.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 9577c43..d9e70ac 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -350,6 +350,7 @@ static int get_pkg_tjmax(unsigned int cpu, struct device *dev) static int create_name_attr(struct platform_data *pdata, struct device *dev) { + sysfs_attr_init(&pdata->name_attr.attr); pdata->name_attr.attr.name = "name"; pdata->name_attr.attr.mode = S_IRUGO; pdata->name_attr.show = show_name; @@ -372,6 +373,7 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev, for (i = 0; i < MAX_ATTRS; i++) { snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i], attr_no); + sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr); tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i]; tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO; tdata->sd_attrs[i].dev_attr.show = rd_ptr[i]; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/