Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp240168pxf; Wed, 24 Mar 2021 04:07:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIwBcXdrdTopZ9y9jFsXsAiZb0U5hbFBLIZA5tQ9IdwqUZqdvhX1/AjP0tdWPZQw5ctXb+ X-Received: by 2002:aa7:d5c9:: with SMTP id d9mr2969664eds.102.1616584064216; Wed, 24 Mar 2021 04:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616584064; cv=none; d=google.com; s=arc-20160816; b=HY+4D/Uon0biij589ZY7BV/+kpk6NK71hqNsWT9IqBrW6eD6aYyMW1BC0LibzacslR z1gFiGtvoKv8rnWAR85XQJuntQ3dcm0QNVf54NcNcNTfkwoSQvkLxZhDrcEi4Rxhgrsm e08etAh7X8CK024tLiEdGvQjg7zY7cIRs6ktXBHms1EZfQra67/fWC/7xcSvZ39pcqzn X3TfwxE8Wa6LyAeVpkzxhGj9ZYHg2/eZhxVulpJqRBRLK29li0Pf+cBMgvvymESRSVa/ vg9wAOisrnp6wBnekUMcncCSXkZQAStXzqF3UmeK4nm30ZLBaZpr6jcNQGMLkX4dyE3S va9w== 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=MjE4C78iDd5Hk5HQ/TJVmYe0vcHqv3N0szUhWr77E1s=; b=D8WATqG+BhvmElz6EJ/v2SpUJbkLf9F5pw62TyHjdjsDwulll/M3EGvDsei8Spk6Bx XwDI43IMiRjwhYFox3A1TSlEU3CPqSk/KvW7u7JqX2P8wkumqZFH1/+aj0ddDAcXfT+5 xBC/NiqK+rDICU9OcxWgQKlzdULW9tQGFm3CxmYA1fuMfO6JinaJd3MkVrn0E+LtiW4R YS3vQGOi/KSRQzevt7OtkJc8Ass2p+wPjmrHcVAh9KX/kfGGkb+jPfAXcp8YFfZutdZ3 y8f9F40sVY28suky7sDONluxOAeSF/l9puDPri9RdAGtYeI3IuH1yKZiSeDVJBlAYbYD disg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SZe2UqDg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw25si1353328ejb.357.2021.03.24.04.07.20; Wed, 24 Mar 2021 04:07:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SZe2UqDg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234668AbhCXJZb (ORCPT + 99 others); Wed, 24 Mar 2021 05:25:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:56252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232107AbhCXJZX (ORCPT ); Wed, 24 Mar 2021 05:25:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8946C61A03; Wed, 24 Mar 2021 09:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616577923; bh=O0a1n/S9dOJwgzqzEYVtbF/EMLMwvmSvIJcKg0dHGk4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SZe2UqDgmE3mBmxzcopgzJJ/qqPsLzWARBLPVf5MxeJY+HBk4VzFOeTC3U4sHVguB ZtYeUb5lqzxc7elP6qQQDU1ioSU8klOHkVDoUUlkOWFKYEe6FxHmcjni6UrYOprkmr A4zxm87IqwXlmv/Mihcfc2FclrfYiH3NPK6NWaS0= Date: Wed, 24 Mar 2021 10:25:20 +0100 From: Greg Kroah-Hartman To: Gustavo Pimentel Cc: "linux-doc@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Andrew Morton , Jonathan Corbet , Bjorn Helgaas Subject: Re: [PATCH v6 1/5] misc: Add Synopsys DesignWare xData IP driver Message-ID: References: <724f5d30e3a9b86448df7e32fb5ed1e814416368.1613150798.git.gustavo.pimentel@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 09:15:46AM +0000, Gustavo Pimentel wrote: > Hi Greg, > > On Tue, Mar 23, 2021 at 13:0:4, Greg Kroah-Hartman > wrote: > > > On Fri, Feb 12, 2021 at 06:28:03PM +0100, Gustavo Pimentel wrote: > > > +static const struct attribute_group xdata_attr_group = { > > > + .attrs = default_attrs, > > > + .name = DW_XDATA_DRIVER_NAME, > > > +}; > > > > ATTRIBUTE_GROUPS()? > > Nicely catched! > > > > > > +static int dw_xdata_pcie_probe(struct pci_dev *pdev, > > > + const struct pci_device_id *pid) > > > +{ > > > + const struct dw_xdata_pcie_data *pdata = (void *)pid->driver_data; > > > + struct dw_xdata *dw; > > > + u64 addr; > > > + int err; > > > + > > > + /* Enable PCI device */ > > > + err = pcim_enable_device(pdev); > > > + if (err) { > > > + pci_err(pdev, "enabling device failed\n"); > > > + return err; > > > + } > > > + > > > + /* Mapping PCI BAR regions */ > > > + err = pcim_iomap_regions(pdev, BIT(pdata->rg_bar), pci_name(pdev)); > > > + if (err) { > > > + pci_err(pdev, "xData BAR I/O remapping failed\n"); > > > + return err; > > > + } > > > + > > > + pci_set_master(pdev); > > > + > > > + /* Allocate memory */ > > > + dw = devm_kzalloc(&pdev->dev, sizeof(*dw), GFP_KERNEL); > > > + if (!dw) > > > + return -ENOMEM; > > > + > > > + /* Data structure initialization */ > > > + mutex_init(&dw->mutex); > > > + > > > + dw->rg_region.vaddr = pcim_iomap_table(pdev)[pdata->rg_bar]; > > > + if (!dw->rg_region.vaddr) > > > + return -ENOMEM; > > > + > > > + dw->rg_region.vaddr += pdata->rg_off; > > > + dw->rg_region.paddr = pdev->resource[pdata->rg_bar].start; > > > + dw->rg_region.paddr += pdata->rg_off; > > > + dw->rg_region.sz = pdata->rg_sz; > > > + > > > + dw->max_wr_len = pcie_get_mps(pdev); > > > + dw->max_wr_len >>= 2; > > > + > > > + dw->max_rd_len = pcie_get_readrq(pdev); > > > + dw->max_rd_len >>= 2; > > > + > > > + dw->pdev = pdev; > > > + > > > + writel(0x0, &(__dw_regs(dw)->RAM_addr)); > > > + writel(0x0, &(__dw_regs(dw)->RAM_port)); > > > + > > > + addr = dw->rg_region.paddr + DW_XDATA_EP_MEM_OFFSET; > > > + writel(lower_32_bits(addr), &(__dw_regs(dw)->addr_lsb)); > > > + writel(upper_32_bits(addr), &(__dw_regs(dw)->addr_msb)); > > > + pci_dbg(pdev, "xData: target address = 0x%.16llx\n", addr); > > > + > > > + pci_dbg(pdev, "xData: wr_len=%zu, rd_len=%zu\n", > > > + dw->max_wr_len * 4, dw->max_rd_len * 4); > > > + > > > + /* Saving data structure reference */ > > > + pci_set_drvdata(pdev, dw); > > > + > > > + /* Sysfs */ > > > + err = sysfs_create_group(&pdev->dev.kobj, &xdata_attr_group); > > > > You just raced with userspace and lost :( > > > > Have the driver core properly create/remove your sysfs files, set the > > default groups pointer in your driver and all will be fine. > > I've gone around and around, searched in other drivers, but I'm not > understanding your PoV or what I should do. Can you throw me a bone here? > I'm starting to pull my hair off, lol Set the dev_groups field of the struct device_driver in your pci driver structure and all should be fine. But wait, why are you adding attributes to a pci device and not your "own" device? You should make a sub-device for this device-specific things, otherwise it will be impossible to find these types of attributes anywhere in sysfs. > I would like to ask you about something, it's you the maintainer of misc > drivers right? MAINTAINERS shows this so I guess it must be true... > After fixing this issue, does this driver have a chance to be pulled on > 5.13? No idea, I do not promise anything :) thanks, greg k-h