From nobody Tue Dec 16 07:28:41 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CDE920D507 for ; Tue, 14 Jan 2025 21:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736891103; cv=none; b=qDYRpVLHYclp7aTusWqku2QPRkvqzUVr0UZJ2G/0FkWt0RiqGPkm+CMjfiO/4czs5+HHsNrgud2VOviPYTdAI423/Nrsx3Mw24bTpPKTB0ogvTNI+4Wym7BNh/KpH5XEwqYXw/PbmL0s/EyE+2jlZaRwSMK9DEMGr6Vl7pe7rtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736891103; c=relaxed/simple; bh=oV0Cv7k7TNZrKo+rio9MWcpQZ8LKPqoa0QDWQx35aLI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eZ5n3CWBtJ3lKLuuTujl6ClfToVHQDazdLzbSHFd1/dB5SmB7EYWeQ6asoKFg3VwAeYkUUZIsF0UHY4bb29lMg8Le+pJcfoksp40HLPIqden4ISoB5k7cEYjma/W74sGY1ivZP2gvunFJMDDg0TV2wvJsyI2cVgxH8go7Jp0TLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=sjKGH8zj; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="sjKGH8zj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1736891100; bh=oV0Cv7k7TNZrKo+rio9MWcpQZ8LKPqoa0QDWQx35aLI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sjKGH8zjegGG7hbjzEG4hDgTXfOkhoIjXSQBUX/VOoVEfRn9K+bIzdWJ0MI2VN4qt YiwrOsN4msiF1dBu5+NhxHxSDorwiEe6QdVL4LJ89UWDvvtJ15anYSM5YNUYpHqQ6H o/lf9k6iGUQN4+A4IwLpD9hSYQAlfMfvbpzuDSgQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 14 Jan 2025 22:44:58 +0100 Subject: [PATCH 1/2] devcoredump: Define 'struct bin_attribute' through macro Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250114-sysfs-const-bin_attr-devcoredump-v1-1-fa93be30efae@weissschuh.net> References: <20250114-sysfs-const-bin_attr-devcoredump-v1-0-fa93be30efae@weissschuh.net> In-Reply-To: <20250114-sysfs-const-bin_attr-devcoredump-v1-0-fa93be30efae@weissschuh.net> To: Johannes Berg , Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1736891099; l=1002; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=oV0Cv7k7TNZrKo+rio9MWcpQZ8LKPqoa0QDWQx35aLI=; b=piioJhG1HC2JwF5SlQM5Doptu/Nncw8SWiUaMRGL3uvyoxjXwtJZGY4HN/9P2S5vgYM4Dcc6J bHW7cy0263NCPquGPdh7NryglvQl/kKIOvKv5nH68MXic9YIgi7TClf X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The macro saves some lines of code and simplifies the constification of the attribute. Signed-off-by: Thomas Wei=C3=9Fschuh --- drivers/base/devcoredump.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c index c795edad1b969bc212dda5bd37578cb83118e850..13b3614c9ac911e704d3485b4f0= 370ce3b0afff6 100644 --- a/drivers/base/devcoredump.c +++ b/drivers/base/devcoredump.c @@ -132,12 +132,8 @@ static ssize_t devcd_data_write(struct file *filp, str= uct kobject *kobj, return count; } =20 -static struct bin_attribute devcd_attr_data =3D { - .attr =3D { .name =3D "data", .mode =3D S_IRUSR | S_IWUSR, }, - .size =3D 0, - .read =3D devcd_data_read, - .write =3D devcd_data_write, -}; +static struct bin_attribute devcd_attr_data =3D + __BIN_ATTR(data, 0600, devcd_data_read, devcd_data_write, 0); =20 static struct bin_attribute *devcd_dev_bin_attrs[] =3D { &devcd_attr_data, NULL, --=20 2.48.0