Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp212205imn; Fri, 29 Jul 2022 04:59:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6r9qHB+F+VCJgGvOR7deZghqz8qKwKvV2s6LKGOv//wnFDB863iSFnsBoVOnULYuZHF7vP X-Received: by 2002:a17:902:6b86:b0:16c:eaef:6b3c with SMTP id p6-20020a1709026b8600b0016ceaef6b3cmr3384327plk.173.1659095953002; Fri, 29 Jul 2022 04:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659095952; cv=none; d=google.com; s=arc-20160816; b=bpTBrJ8ER6RjVvRle7GPNLhn0rVCfesk1cno+ZFPTDjjoEqB0NNGLA9A1gHobR2iNs 18MTpJQBX7VPQW5SwMiCOizAs9JkOVKyg/WRw/UBR9FVbdCO16AdPD2X/5luTgdP/UJn xCmblZ8vBlbjiOCXRArVsLhXgQrseYYtif1JdfDUgYZctU4awxyWmqPrYtICGq727wor mWx7pWHjGuteXXypexB6leO8MohZwMSZGMO5CEltn/k1tVyzQ/x40QevuM0NmwQQykuX keYnSJjTpykDDp2Q77Qu0F25POFc68zCkkIRgratBsNcpKwcCAqSddfGM6XkJ00UG376 2NGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=J/Ax/37cjW+/p+U+E5phBYBteKbR49XDDN83ZIsK5QI=; b=ZNwYrv34OJ0BKY/ERIMbRbrUBjS+pn+Aq+PW/msHG2Iy2X+Ao1Opcj/KKbaxXBOZcp ckZpRgo+Lcjilh8sbRcENtKLqecKMZxovsXJBD95vyxA13733Na9p2CV0eFW8gfSdK5I Uj6b8RZobK+/5lVR5JTWlmzjFQr54KS/u2xhu9f/JzCXbNOn/BhtY8r8/YN6Pcz5W5Lj Kk8cmIZIjzMr1XiC7/I/OlK81F0uRmbzMxwsVTaMRVB1bHK4WfEWWABU7DOQZNNRCNih M3TJOkfj5AALY+VLYRiD0cE6o+ahE/S+BsZePIvazVNVNyeCvGYH5yS1Z/GG5u1XDksv APOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F+/xlHV4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a636d0a000000b0041ab2b8bb33si4023163pgc.245.2022.07.29.04.58.57; Fri, 29 Jul 2022 04:59:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F+/xlHV4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236089AbiG2LoC (ORCPT + 99 others); Fri, 29 Jul 2022 07:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236063AbiG2Ln7 (ORCPT ); Fri, 29 Jul 2022 07:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54D7787C28 for ; Fri, 29 Jul 2022 04:43:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D817D61EDC for ; Fri, 29 Jul 2022 11:43:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC545C433D6; Fri, 29 Jul 2022 11:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659095038; bh=PlDpUa9kKZeXXUnnE5veinbmwK3klYqqIJ+ubLGpGs4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F+/xlHV46vb8oTFDjdYlS09pHN1sQnHJbfskwHRvRAZYd4veiUeDSQRxhatsos8SX uNJkMz66b4Bu6hxsLc9m1gVkW8JqmPQAnos1U858RTF3gl1kEwkQ8B4VhlSgrOjK3L +CKmKlCyz8Y561H/fHRbSGnvPaZq5/ofRbn/owXo= Date: Fri, 29 Jul 2022 13:43:55 +0200 From: Greg KH To: Pierre-Louis Bossart Cc: kah.jing.lee@intel.com, linux-kernel@vger.kernel.org, arnd@arndb.de, rafael.j.wysocki@intel.com, tien.sung.ang@intel.com, dinh.nguyen@intel.com, Zhou@kroah.com, Furong , Vinod Koul , Bard Liao Subject: Re: [PATCH v2 1/3] drivers: misc: intel_sysid: Add sysid from arch to drivers Message-ID: References: <20220721123017.416438-1-kah.jing.lee@intel.com> <20220721123149.416618-1-kah.jing.lee@intel.com> <7686403c-7252-ef7a-70fc-040c5ab8cb79@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7686403c-7252-ef7a-70fc-040c5ab8cb79@linux.intel.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 28, 2022 at 11:53:33AM -0500, Pierre-Louis Bossart wrote: > > > On 7/28/22 10:59, Greg KH wrote: > > On Thu, Jul 28, 2022 at 10:37:37AM -0500, Pierre-Louis Bossart wrote: > >> Thanks for the review Greg, > >> > >>>> +static int intel_sysid_probe(struct platform_device *pdev) > >>>> +{ > >>>> + struct intel_sysid *sysid; > >>>> + struct resource *regs; > >>>> + > >>>> + sysid = devm_kzalloc(&pdev->dev, sizeof(struct intel_sysid), > >>>> + GFP_KERNEL); > >>>> + if (!sysid) > >>>> + return -ENOMEM; > >>>> + > >>>> + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >>>> + if (!regs) > >>>> + return -ENXIO; > >>>> + > >>>> + sysid->regs = devm_ioremap_resource(&pdev->dev, regs); > >>>> + if (IS_ERR(sysid->regs)) > >>>> + return PTR_ERR(sysid->regs); > >>>> + > >>>> + platform_set_drvdata(pdev, sysid); > >>>> + > >>>> + return devm_device_add_group(&pdev->dev, &intel_sysid_attr_group); > >>> > >>> You just raced with userspace and lost. Please use the default group > >>> for the platform device. > >>> > >>> I need to go remove this function, it should not be used at all as it is > >>> broken. > >> > >> Can you elaborate on the issue and suggested replacement? > >> > >> We used this function for the SoundWire sysfs based on your review > >> comments (2 years ago?) that we should not muck with kobj, and that > >> function devm_device_add_group() is also used in a probe function. > > > > Use the default_groups pointer in the driver structure. > > did you mean dev_groups? Yes, sorry, that's the correct name. > I am not following the idea, for SoundWire all the attributes are really > device-specific or described by ACPI and cannot be hard-coded in the > driver structure. That's what the is_visible() callback is for in the groups structure, you determine if the attribute is visable or not at runtime, you don't rely on the driver itself to add/remove attributes, that does not scale and again, is racy. thanks, greg k-h