From patchwork Tue Feb 19 13:50:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 2163061 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D995ADF24C for ; Tue, 19 Feb 2013 13:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932809Ab3BSNvC (ORCPT ); Tue, 19 Feb 2013 08:51:02 -0500 Received: from mail.skyhub.de ([78.46.96.112]:59224 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932802Ab3BSNvA (ORCPT ); Tue, 19 Feb 2013 08:51:00 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1361281859; bh=FabOwFzEvUYTftDYzKB1NyqT8Z1SJ6PlrHjIc6KCcXA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=KN3znyrVXMf8FpLCpBORNZEl7M2BHEB1EHx+Jn /kauRK7dSC3hec0ZTiHAyJH/hgza4P4yzp1AYgF57YFWMYZVh9x8JatI0F/bZEIPQ+7 wJzr6mDZtk0RpB4DtByJOFmMFU9CuYYy5YYBi/3c61M8xB31gaI97V7q/ERwxOGgtU= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id y-BchZDS5kmA; Tue, 19 Feb 2013 14:50:59 +0100 (CET) Received: from liondog.tnic (p4FF1D58E.dip.t-dialin.net [79.241.213.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id BD1551D9CF2; Tue, 19 Feb 2013 14:50:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1361281859; bh=FabOwFzEvUYTftDYzKB1NyqT8Z1SJ6PlrHjIc6KCcXA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=KN3znyrVXMf8FpLCpBORNZEl7M2BHEB1EHx+Jn /kauRK7dSC3hec0ZTiHAyJH/hgza4P4yzp1AYgF57YFWMYZVh9x8JatI0F/bZEIPQ+7 wJzr6mDZtk0RpB4DtByJOFmMFU9CuYYy5YYBi/3c61M8xB31gaI97V7q/ERwxOGgtU= Received: by liondog.tnic (Postfix, from userid 1000) id 2F28810070F; Tue, 19 Feb 2013 14:50:56 +0100 (CET) Date: Tue, 19 Feb 2013 14:50:56 +0100 From: Borislav Petkov To: Felipe Balbi Cc: Mauro Carvalho Chehab , Greg KH , Linux Kernel Mailing List , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , JBottomley@parallels.com, linux-scsi@vger.kernel.org, davem@davemloft.net, netdev@vger.kernel.org, Doug Thompson , linux-edac@vger.kernel.org, rjw@sisk.pl, linux-pm@vger.kernel.org Subject: Re: SYSFS "errors" Message-ID: <20130219135056.GH26623@pd.tnic> Mail-Followup-To: Borislav Petkov , Felipe Balbi , Mauro Carvalho Chehab , Greg KH , Linux Kernel Mailing List , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , JBottomley@parallels.com, linux-scsi@vger.kernel.org, davem@davemloft.net, netdev@vger.kernel.org, Doug Thompson , linux-edac@vger.kernel.org, rjw@sisk.pl, linux-pm@vger.kernel.org References: <20130219101121.GJ23197@arwen.pp.htv.fi> <20130219081149.46972f56@redhat.com> <20130219114345.GA26623@pd.tnic> <20130219091610.2b746a30@redhat.com> <20130219123502.GD26623@pd.tnic> <20130219094640.2abf1a66@redhat.com> <20130219130626.GE26623@pd.tnic> <20130219131500.GW23197@arwen.pp.htv.fi> <20130219132853.GG26623@pd.tnic> <20130219133809.GA4390@arwen.pp.htv.fi> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130219133809.GA4390@arwen.pp.htv.fi> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Tue, Feb 19, 2013 at 03:38:09PM +0200, Felipe Balbi wrote: > because changing the permission will cause the same issue: Actually, I take that back. Mauro's patch will already create the file anyway: if (mci->set_sdram_scrub_rate || mci->get_sdram_scrub_rate) Adjusting the permissions is simply the last missing piece to this patch to make the interface to userspace 100% coherent. --- From: Mauro Carvalho Chehab Date: Tue, 19 Feb 2013 09:16:10 -0300 Subject: [PATCH] EDAC: only create sdram_scrub_rate where supported Currently, sdram_scrub_rate sysfs node is created even if the device doesn't support get/set the scub rate. Change the logic to only create this device node when the operation is supported. If only read or only write is supported, it will keep returning -ENODEV just like before. Reported-by: Felipe Balbi Signed-off-by: Mauro Carvalho Chehab --- drivers/edac/edac_mc_sysfs.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 0ca1ca71157f..5a788e60ff67 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -7,7 +7,7 @@ * * Written Doug Thompson www.softwarebitmaker.com * - * (c) 2012 - Mauro Carvalho Chehab + * (c) 2012-2013 - Mauro Carvalho Chehab * The entire API were re-written, and ported to use struct device * */ @@ -878,7 +878,6 @@ static struct attribute *mci_attrs[] = { &dev_attr_ce_noinfo_count.attr, &dev_attr_ue_count.attr, &dev_attr_ce_count.attr, - &dev_attr_sdram_scrub_rate.attr, &dev_attr_max_location.attr, NULL }; @@ -1012,6 +1011,23 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) return err; } + if (mci->set_sdram_scrub_rate || mci->get_sdram_scrub_rate) { + umode_t mode = 0; + + if (mci->get_sdram_scrub_rate) + mode = S_IRUGO; + + if (mci->set_sdram_scrub_rate) + mode |= S_IWUSR; + + dev_attr_sdram_scrub_rate.attr.mode = mode; + + err = device_create_file(&mci->dev, &dev_attr_sdram_scrub_rate); + if (err) { + edac_dbg(1, "failure: create sdram_scrub_rate\n"); + goto fail2; + } + } /* * Create the dimm/rank devices */ @@ -1056,6 +1072,7 @@ fail: continue; device_unregister(&dimm->dev); } +fail2: device_unregister(&mci->dev); bus_unregister(&mci->bus); kfree(mci->bus.name);