Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp228611imn; Fri, 29 Jul 2022 05:21:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZKOLEkixj0QxAaahzB9+RPx4sSHyu6K1n9/w7KKboKPNgn4kmu3AZhjzLx/Fh7B+U33Mi X-Received: by 2002:a17:907:3f02:b0:6f3:5c42:321a with SMTP id hq2-20020a1709073f0200b006f35c42321amr2619186ejc.521.1659097303642; Fri, 29 Jul 2022 05:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659097303; cv=none; d=google.com; s=arc-20160816; b=zQCqXdTUMDtlSvrs181tz56Z5L9y+8Izy5UphKZfnjOq1ov6DCSDQm0odk6HWQI+sS Jw88RbDKBqZ/ANrW8vlYJtS2BzUlnVtZv9isTfnpPcSpYgpla8nU3PI5iS15OunjAvzZ yBGexwOyDNwux20NFBMsiRBVEU9O8mSuciegBZk+PdEtED0E7vjCYtjoFjdDdqrrl5Kl VYC2smyPdYQVTUUPTtMMcoQix8SxbkqqzQmc7Mor0iJmB6HQKVf9b6csgDYD2ctBoewh nLMl1U2ikKwpuf7JeH8ZfJ2l5eOAzNDeShi1pU5Yd9QvQB6W10TeSgExpbFKUi4XuQCl o3sw== 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=iqH6UQZl1/YJUc3L6FmH71TvBB8gM+SUgW6gG/WfpkI=; b=YYEoc7Szdtuz9UPIWFQZT/xdJ7JZ0AV4xBDSVrGVkrb2RhwsNJmME6WvA+98rlABXe mHfZHmZBPeA8ae+DL4eRbPZ6C0820HSMknisRTtsH9vN+x3/207NVDS4X7gCCkjNqzXX 7EAVQT9lXoH23Agjc0qzdMcl/vUjFmaaAmXOoYO/blLUfNCjyk8uQqOAIY7vJHcKPtmj a1m2VVJ0E8yDE8RX4o0K99prAQab2bFocpzRFklQj2Y6XDWe4t8yW2K7dGtg6hLQu7LH /+3Rwyj0LnNVi1oAdROdrnEttDieKWAWoqOuMUWA+n0o2c1wGLrKYuhL4UZpj3nQX++6 8oJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=avOTw1qK; 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 rn9-20020a170906d92900b0072629f08048si2663227ejb.303.2022.07.29.05.21.18; Fri, 29 Jul 2022 05:21:43 -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=avOTw1qK; 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 S235560AbiG2L4e (ORCPT + 99 others); Fri, 29 Jul 2022 07:56:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230456AbiG2L4c (ORCPT ); Fri, 29 Jul 2022 07:56:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D9D587C13 for ; Fri, 29 Jul 2022 04:56:30 -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 ams.source.kernel.org (Postfix) with ESMTPS id 6267EB827B2 for ; Fri, 29 Jul 2022 11:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CA64C433D6; Fri, 29 Jul 2022 11:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659095788; bh=FpYePSzwbplmdejBdMeFXedH1y4tEBzFKTXBCQoAWik=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=avOTw1qKxp2kxtkPw0Tj9xfHq7/K8LzDFt/K5FwBz/Fjz4erlkFV+62wjnSul0Mqg QOZ+wJQ/RZorKDFnLxxTKybba94kd0In85d5ehje2UN5VIRpWS8Cyej/u3tn5XJVCp jNQ3SYPY4w/A+bnVYL8t4MqIydllLvNTNuBjWvzg= Date: Fri, 29 Jul 2022 13:56:25 +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: 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 Fri, Jul 29, 2022 at 01:43:55PM +0200, Greg KH wrote: > 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. In looking at your attribute code, ick, you dynamically create a ton of them. But for the ones that you do not, you can just have the driver core add them. Let me make up a patch that shows what I am thinking of... thanks, greg k-h