Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp688652ybl; Fri, 6 Dec 2019 04:46:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxZnhD4WRk45r9WcvpI6BLzOfTWks9g+riBj13KF0sgx6m5XjROX4cjCk+tQGuGEtlO9Hho X-Received: by 2002:a05:6830:1407:: with SMTP id v7mr10955771otp.58.1575636361684; Fri, 06 Dec 2019 04:46:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575636361; cv=none; d=google.com; s=arc-20160816; b=SwZFfH0HoeqKrdTDS7EfV2XrGo9poToz1lQ4DtnJjZDao8N4KUNzxyOLM6F32stgCJ spWgQmKpQclURDI10jCvLgxwORvmI4gfCCv82oQWYYGrIoGv4hKH2+UXfi5iLGWG62rg mIZiBLHXFo7BWhflK0sK3jO/RNISpXcpEQZOZ26u+O2UNgpepAqJ6yqMhi6un+TNn/VQ MsJC2hxFaLxx06nUcMW2ZbjQdYrR8O5wFi1FfI0/DnF7Ju0ADzFaK0eZDW4niQfWJ6Uc 5d99s38Ry9uQ7yNBhojvgHYxxFBLxLKum4Q3qX+kDCvWZq/CmLPH5HX2yAMjyKsAkHu+ iHrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=IvVuoIr9L01V4Rjg3gJlW4WsWW9B/4IJxXaFZwAjBkQ=; b=0l/oCMwv5GaGPCW+hIHfCkP5D1qOhW/QcgheSJoE1V0ZuarpB6NYV8CQy5qxBSn5RR D95eSZBMooqWcZwkLGYs4iG1pv7F39EFzGEtnSiUWOLICjHKNgGQoIDmNH5BebCUomJG j0l80N0A5LBfenTYsoIsuukpZEzt8o5P/eXNRSwHU74xKKvJNbl2NG6qF3YTJ/t4kbQ4 h2gGsDzf+DvTk6j6Qo1JUYn098+7HjkFoUoQab/HGipuqnw+2xj+/vIwcF6SF1IOUVk0 qxQqAyMVDVuvC+LS8guwn37pl7QbuboTFEuCnu0o9cbda8TeHQWNAVl4pPIcm6eT0Voz 5haQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M9gl0sSC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si6963062otp.139.2019.12.06.04.45.49; Fri, 06 Dec 2019 04:46:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M9gl0sSC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726245AbfLFMpL (ORCPT + 99 others); Fri, 6 Dec 2019 07:45:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:49572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbfLFMpL (ORCPT ); Fri, 6 Dec 2019 07:45:11 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED01D205F4; Fri, 6 Dec 2019 12:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575636310; bh=GHMiXwT065uPwUwIIqQU+AS8Kz5f4G24qOnNzLCcVR8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M9gl0sSCJbv/ZU5qkoIHQlVe78vfB54tu/5RvIJNlSEZQtkeyvaQmDmwSUPODHIKE IuuuoGKl3uaJ2EDiwtpNhJ0PznME4zlZefVzyVR0ZFIb3kvz3snk3mdk2/vjZ6P0Ao JBjQwUoGO385uoxocK0605KJsvMdMdttKgJpGwPs= Date: Fri, 6 Dec 2019 13:45:08 +0100 From: Greg KH To: Sourabh Jain Cc: mpe@ellerman.id.au, mahesh@linux.vnet.ibm.com, hbathini@linux.ibm.com, linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, corbet@lwn.net, linux-doc@vger.kernel.org Subject: Re: [PATCH v4 3/6] powerpc/fadump: reorganize /sys/kernel/fadump_* sysfs files Message-ID: <20191206124508.GA1360047@kroah.com> References: <20191206122434.29587-1-sourabhjain@linux.ibm.com> <20191206122434.29587-4-sourabhjain@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191206122434.29587-4-sourabhjain@linux.ibm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 06, 2019 at 05:54:31PM +0530, Sourabh Jain wrote: > +static struct kobj_attribute release_attr = __ATTR(release_mem, > 0200, NULL, > fadump_release_memory_store); > -static struct kobj_attribute fadump_attr = __ATTR(fadump_enabled, > +static struct kobj_attribute enable_attr = __ATTR(enabled, > 0444, fadump_enabled_show, > NULL); __ATTR_RO()? > -static struct kobj_attribute fadump_register_attr = __ATTR(fadump_registered, > +static struct kobj_attribute register_attr = __ATTR(registered, > 0644, fadump_register_show, > fadump_register_store); __ATTR_RW()? And then use an ATTRIBUTE_GROUP() macro to create a group so that you then can do: > @@ -1452,11 +1450,47 @@ static void fadump_init_files(void) > printk(KERN_ERR "fadump: unable to create debugfs file" > " fadump_region\n"); > > + rc = sysfs_create_file(fadump_kobj, &enable_attr.attr); > + if (rc) > + pr_err("unable to create enabled sysfs file (%d)\n", > + rc); > + rc = sysfs_create_file(fadump_kobj, ®ister_attr.attr); > + if (rc) > + pr_err("unable to create registered sysfs file (%d)\n", > + rc); > + if (fw_dump.dump_active) { > + rc = sysfs_create_file(fadump_kobj, &release_attr.attr); > + if (rc) > + pr_err("unable to create release_mem sysfs file (%d)\n", > + rc); > + } a single call to sysfs_create_groups() here instead of trying to unwind the mess if something went wrong. thanks, greg k-h