Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp235307pxj; Wed, 16 Jun 2021 00:54:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7fzoiVYtnvK0CUW/skh3zqT/BEdMX9+HMzQipYnvX33x2cSX4cqV0wKzPsLYdIXy7UWSF X-Received: by 2002:a17:907:9d0:: with SMTP id bx16mr2811753ejc.72.1623830059058; Wed, 16 Jun 2021 00:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623830059; cv=none; d=google.com; s=arc-20160816; b=DDYY7Vxsyc4eK3qCF8XYXu/sAX8AQ2OQlhzko4DCw571rp34Bj7JzlqtnLlPTrqB6T feCaMGknC3PuI6ANkimOhsBcNBHyvB6D1bGp7OUoEFeQ6vMKDHhRhlb8MbUleQdUHXkx D+ugiyO9TmMmvm+IUS4j+6IVyltgig5QkSlPETbxwi3JUF3IBPlZl/SGJ0/lVS71BfId PT6xzfmx7DQswGjUx25PsVbWULpwIrFZBj7AblUpGk0Y3NIqsChZYCL6fjkKEqo6BwrC Eyo3gRJKhUh8Ys6uV0VzIW2vaCCqOlJVvWmhOAnz3wqm2fx+66njsHC+I1jROyarHt2k YvHQ== 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=UwfmCPu/mbZwOlOIBkePMgqsk1G5x8YVbaW+HvghHbk=; b=zQ7VuOZl8nDrqBLCQhIi+HlxeshvSckbugwGWBF5HugD3+Ll0tYTS7+/27oRHPHxXe LeNLSSdkl6iAZVAgLk6xEX6llDTKS6CnDS+ntCfsgksO98Z0q+vKOejJ2gk60XkkK3rX DAjwh80kNOszJhpvLe24tD8HYep8GhvbSjdsqUOZOIBgHPAp5IvL5QlurjjnstA8F9Uv h5b42ENmVGmZhZwUQ3cpFqig6FrrC1NriWGdrJuyH5GGGK/rsH7ViJpSUxGVMIk7LaQP AoGxto9TGgVFQf98Wr2i6EVqrk9k3XmdmRtDHsjBVKO3X9xgWXR+Xya6ZWbSXy9wP4/r Febw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c0ZNKkTR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si1387339ede.324.2021.06.16.00.53.56; Wed, 16 Jun 2021 00:54:19 -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=@kernel.org header.s=k20201202 header.b=c0ZNKkTR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbhFPHzE (ORCPT + 99 others); Wed, 16 Jun 2021 03:55:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:56104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231290AbhFPHzD (ORCPT ); Wed, 16 Jun 2021 03:55:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61F9C60FDB; Wed, 16 Jun 2021 07:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623829978; bh=CwVhy/XtNtzhNeGQ44S4VfDUyl2kVZR4eIdRTYD1qsE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c0ZNKkTRz1bxdxBJABJqVaaig8Gnc8FVCedUxfBWT01gFpdiaPzH7YP1zN9v9jo4c JnpndnOGvzpWqkyMrzfSvvo1oroCuWJ4rMpUeNYM/J2ZjFGylrLdUAzZIqff24lJ7f YZ8ZggpFGZGBO1OcyPX99YZhmL+8OPCXDDZuz2RvRDEWtnagqxPBK8FH4lol5e+KfU xJ1LI/005LzBeC7QYP+pRp2qsrWnyJPVkrd4g+QAHflPLy0PcgCAiafTUMixNou83E SNl36kmWOBJk++cmOiD2RW7HPs3Jcuz+KDnWgFrNNsErnAklNIboIcAifTEMRDL9hO caJO/JfgQdghQ== Date: Wed, 16 Jun 2021 13:22:54 +0530 From: Vinod Koul To: Sanjay R Mehta Cc: Greg KH , Sanjay R Mehta , dan.j.williams@intel.com, Thomas.Lendacky@amd.com, Shyam-sundar.S-k@amd.com, Nehal-bakulchandra.Shah@amd.com, robh@kernel.org, mchehab+samsung@kernel.org, davem@davemloft.net, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org Subject: Re: [PATCH v9 1/3] dmaengine: ptdma: Initial driver for the AMD PTDMA Message-ID: References: <1622654551-9204-1-git-send-email-Sanju.Mehta@amd.com> <1622654551-9204-2-git-send-email-Sanju.Mehta@amd.com> <94bba5dd-b755-81d0-de30-ce3cdaa3f241@amd.com> <0bc4e249-b8ce-1d92-ddde-b763667a0bcb@amd.com> <12ff7989-c89d-d220-da23-c13ddc53384e@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12ff7989-c89d-d220-da23-c13ddc53384e@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16-06-21, 12:27, Sanjay R Mehta wrote: > > > On 6/16/2021 11:46 AM, Greg KH wrote: > > [CAUTION: External Email] > > > > On Wed, Jun 16, 2021 at 10:24:52AM +0530, Sanjay R Mehta wrote: > >> > >> > >> On 6/16/2021 9:45 AM, Vinod Koul wrote: > >>> [CAUTION: External Email] > >>> > >>> On 15-06-21, 16:50, Sanjay R Mehta wrote: > >>> > >>>>>> +static struct pt_device *pt_alloc_struct(struct device *dev) > >>>>>> +{ > >>>>>> + struct pt_device *pt; > >>>>>> + > >>>>>> + pt = devm_kzalloc(dev, sizeof(*pt), GFP_KERNEL); > >>>>>> + > >>>>>> + if (!pt) > >>>>>> + return NULL; > >>>>>> + pt->dev = dev; > >>>>>> + pt->ord = atomic_inc_return(&pt_ordinal); > >>>>> > >>>>> What is the use of this number? > >>>>> > >>>> > >>>> There are eight similar instances of this DMA engine on AMD SOC. > >>>> It is to differentiate each of these instances. > >>> > >>> Are they individual device objects? > >>> > >> > >> Yes, they are individual device objects. > > > > Then what is "ord" for? Why are you using an atomic variable for this? > > What does this field do? Why doesn't the normal way of naming a device > > come into play here instead? > > > > Hi Greg, > > The value of "ord" is incremented for each device instance and then it > is used to store different name for each device as shown in below snippet. > > pt->ord = atomic_inc_return(&pt_ordinal); > snprintf(pt->name, MAX_PT_NAME_LEN, "pt-%u", pt->ord); Okay why not use device->name ? Trying to unroll further, who creates pt_device? who creates the dev object under this..? Thanks -- ~Vinod