From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fritzc.com (mail.fritzc.com [213.160.72.247]) (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 577A88F7A; Thu, 9 May 2024 17:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.160.72.247 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715274420; cv=none; b=C6V/RjJp3lCjUDYaOEGYbvgCbE5NbqcimHUa2fumenad2f7nCuldrZ4UUClSb8WFwv8xQEuQ3M7U66qbAD8bY6W9vGEuXTmaCNAgPK/se4LM349ehSpIUGbRgr/rG4cftFDmIyeA4VwBRElLIGVhvcn4XNJwl0HzHlFlF5GKOek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715274420; c=relaxed/simple; bh=MxdtaIuvP3af2wFj0GTldAPW14Q+V43o4PQXcu6p13o=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jBCF4cY0WRHFaVaS8yOKJwxa/yyOkPivc42NRSSUVc0aPPqV76Ocmxh5cf0vcuEfM33HdD34g8U8ybA0+QaCfbJegDKE8hmd9zW+VGeJj0XeHN0Y65UjKeZpqfNDHySejDOAVWEH33VVNX1UIErE0zH3iydWF3gjWPFkxUGMHdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hexdev.de; spf=pass smtp.mailfrom=hexdev.de; dkim=pass (1024-bit key) header.d=fritzc.com header.i=@fritzc.com header.b=gxr20lvq; arc=none smtp.client-ip=213.160.72.247 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hexdev.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hexdev.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fritzc.com header.i=@fritzc.com header.b="gxr20lvq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fritzc.com; s=dkim; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References: In-Reply-To:Date:Cc:To:Reply-To:From:Subject:Message-ID:Sender:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=25MzYlO2dmwacwaZXrREWevweli0BDq/E6j0rp9hAtM=; b=gxr20lvqEjMnY/UBmuWitZIj9+ DUIqH7StRf/p5OXpbbH09L/EsjAPuV/9QWRmH58vcj5oC6PNA/H8YC3K7kSw3AmRC+pfR2xswEhUm LXwpCzG6LoMm6u1UmJcvdZNUfomrvoJc6MCdAU94kCrinPIQIwkf51oTaz2XJvJotoXY=; Received: from 127.0.0.1 by fritzc.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim latest) (envelope-from ) id 1s57Dr-001jbE-0e; Thu, 09 May 2024 19:06:23 +0200 Message-ID: <333fae36f2332b705320186c2068e1236c9d1142.camel@hexdev.de> Subject: Re: [PATCH v3 01/11] can: Add LIN bus as CAN abstraction From: Christoph Fritz Reply-To: christoph.fritz@hexdev.de To: Greg Kroah-Hartman Cc: Ilpo =?ISO-8859-1?Q?J=E4rvinen?= , Oliver Hartkopp , Marc Kleine-Budde , Jiri Slaby , Vincent Mailhol , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jiri Kosina , Benjamin Tissoires , Sebastian Reichel , Linus Walleij , Andreas Lauser , Jonathan Corbet , Pavel Pisa , linux-can@vger.kernel.org, Netdev , devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-serial Date: Thu, 09 May 2024 19:06:19 +0200 In-Reply-To: <2024050852-vixen-arson-cb42@gregkh> References: <20240502182804.145926-1-christoph.fritz@hexdev.de> <20240502182804.145926-2-christoph.fritz@hexdev.de> <61adf428-2205-1563-d0b6-fa843e08559d@linux.intel.com> <4e8a50a0-f938-8aaf-fe4b-d18765407d4d@linux.intel.com> <215d898a0244d717467d44a8e93f186e2f282daa.camel@hexdev.de> <2024050852-vixen-arson-cb42@gregkh> Organization: hexDEV GmbH Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit On Wed, 2024-05-08 at 19:48 +0100, Greg Kroah-Hartman wrote: > On Wed, May 08, 2024 at 08:20:51PM +0200, Christoph Fritz wrote: > > ... > > > ... > > > > > > +static int lin_create_sysfs_id_files(struct net_device *ndev) > > > > > > +{ > > > > > > + struct lin_device *ldev = netdev_priv(ndev); > > > > > > + struct kobj_attribute *attr; > > > > > > + int ret; > > > > > > + > > > > > > + for (int id = 0; id < LIN_NUM_IDS; id++) { > > > > > > + ldev->sysfs_entries[id].ldev = ldev; > > > > > > + attr = &ldev->sysfs_entries[id].attr; > > > > > > + attr->attr.name = kasprintf(GFP_KERNEL, "%02x", id); > > > > > > + if (!attr->attr.name) > > > > > > + return -ENOMEM; > > > > > > + attr->attr.mode = 0644; > > > > > > + attr->show = lin_identifier_show; > > > > > > + attr->store = lin_identifier_store; > > > > > > + > > > > > > + sysfs_attr_init(&attr->attr); > > > > > > + ret = sysfs_create_file(ldev->lin_ids_kobj, &attr->attr); > > > > > > + if (ret) { > > > > > > + kfree(attr->attr.name); > > > > > > + return -ENOMEM; > > > > > > + } > > > > > > + } > > > > > > + > > > > > > + return 0; > > > > > > +} > > > > > > > > > > Can you use .dev_groups instead ? > > > > > > > > I'm not sure where to attach this in this glue code here. Should I do a > > > > class_register() and add the .dev_groups there? > > > > > > I guess struct class would be correct direction but I'm not sure if it's > > > viable in this case. It would avoid the need for custom sysfs setup code > > > if it's workable. > > > > I just tried to find a way, but these are 64 sysfs files and declaring > > them all static looks a bit odd to me. I might be missing something > > here. > > > > For v4 I would stick to the dynamic setup and fix the rollback. > > > > Any objections? > > Yes, you race with userspace and loose by trying to do this "by hand". > Make this static please. OK, static init coming up in v4 thanks -- Christoph