From: Krzysztof Kozlowski <krzk@kernel.org>
To: songchai <quic_songchai@quicinc.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v1 2/7] coresight: Add coresight TGU driver
Date: Fri, 30 Aug 2024 12:24:34 +0200 [thread overview]
Message-ID: <db2bc170-052e-4c9b-a191-4d916bbe0993@kernel.org> (raw)
In-Reply-To: <20240830092311.14400-3-quic_songchai@quicinc.com>
On 30/08/2024 11:23, songchai wrote:
> Add driver to support Coresight device TGU (Trigger Generation Unit).
> TGU is a Data Engine which can be utilized to sense a plurality of
> signals and create a trigger into the CTI or generate interrupts to
> processors. Add probe/enable/disable functions for tgu.
>
> Signed-off-by: songchai <quic_songchai@quicinc.com>
...
> +
> +static struct attribute *tgu_common_attrs[] = {
> + &dev_attr_enable_tgu.attr,
> + NULL,
> +};
> +
> +static struct attribute_group tgu_common_grp = {
Not const?
> + .attrs = tgu_common_attrs,
> + NULL,
> +};
> +
> +static const struct attribute_group *tgu_attr_groups[] = {
> + &tgu_common_grp,
> + NULL,
> +};
> +
> +static int tgu_probe(struct amba_device *adev, const struct amba_id *id)
> +{
> + int ret = 0;
> + struct device *dev = &adev->dev;
> + struct coresight_platform_data *pdata;
> + struct tgu_drvdata *drvdata;
> + struct coresight_desc desc = { 0 };
Code is quite mixed here... Bring some order - declarations with and
without assignments.
> +
> + desc.name = coresight_alloc_device_name(&tgu_devs, dev);
> + if (!desc.name)
> + return -ENOMEM;
> +
> + pdata = coresight_get_platform_data(dev);
> + if (IS_ERR(pdata))
> + return PTR_ERR(pdata);
> +
> + adev->dev.platform_data = pdata;
> +
> + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> + if (!drvdata)
> + return -ENOMEM;
> +
> + drvdata->dev = &adev->dev;
> + dev_set_drvdata(dev, drvdata);
> +
> + drvdata->base = devm_ioremap_resource(dev, &adev->res);
> + if (!drvdata->base)
> + return -ENOMEM;
> +
> + spin_lock_init(&drvdata->spinlock);
> +
> + drvdata->enable = false;
> + desc.type = CORESIGHT_DEV_TYPE_HELPER;
> + desc.pdata = adev->dev.platform_data;
> + desc.dev = &adev->dev;
> + desc.ops = &tgu_ops;
> + desc.groups = tgu_attr_groups;
> +
> + drvdata->csdev = coresight_register(&desc);
> + if (IS_ERR(drvdata->csdev)) {
> + ret = PTR_ERR(drvdata->csdev);
> + goto err;
> + }
> +
> + pm_runtime_put(&adev->dev);
> + dev_dbg(dev, "TGU initialized\n");
Drop, useless. Kernel provides you already ways to know probe status.
> + return 0;
> +err:
> + pm_runtime_put(&adev->dev);
> + return ret;
> +}
> +
> +static struct amba_id tgu_ids[] = {
Not const?
> + {
> + .id = 0x0003b999,
> + .mask = 0x0003ffff,
> + .data = "TGU",
> + },
> + { 0, 0 },
> +};
No module device table?
> +
> +static struct amba_driver tgu_driver = {
> + .drv = {
> + .name = "coresight-tgu",
> + .owner = THIS_MODULE,
Please drop. Also one-less indentation.
> + .suppress_bind_attrs = true,
> + },
> + .probe = tgu_probe,
> + .id_table = tgu_ids,
> +};
> +
> +module_amba_driver(tgu_driver);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("CoreSight TGU driver");
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-08-30 10:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 9:23 [PATCH v1 0/7] Provides support for Trigger Generation Unit songchai
2024-08-30 9:23 ` [PATCH v1 1/7] dt-bindings: arm: Add support for Coresight TGU trace songchai
2024-08-30 10:11 ` Krzysztof Kozlowski
2024-08-30 16:44 ` Trilok Soni
[not found] ` <65732921-988f-41f7-886e-94415b07608e@quicinc.com>
2024-09-02 7:02 ` Krzysztof Kozlowski
2024-09-02 7:24 ` songchai
2024-09-02 8:05 ` Krzysztof Kozlowski
[not found] ` <686f4ff6-d7f0-483e-b5c4-4d2db0661c08@quicinc.com>
2024-09-02 10:24 ` Krzysztof Kozlowski
[not found] ` <8dbe831f-d48a-4e4f-8681-d0b56b8c5213@quicinc.com>
2024-09-03 11:30 ` Krzysztof Kozlowski
2024-08-30 22:15 ` Trilok Soni
2024-08-30 9:23 ` [PATCH v1 2/7] coresight: Add coresight TGU driver songchai
2024-08-30 10:24 ` Krzysztof Kozlowski [this message]
2024-08-31 15:51 ` kernel test robot
2024-08-30 9:23 ` [PATCH v1 3/7] coresight-tgu: Add signal priority support songchai
2024-08-30 9:23 ` [PATCH v1 4/7] coresight-tgu: Add TGU decode support songchai
2024-08-30 9:23 ` [PATCH v1 5/7] coresight-tgu: add support to configure next action songchai
2024-08-30 9:23 ` [PATCH v1 6/7] coresight-tgu: add timer/counter functionality for TGU songchai
2024-08-30 9:23 ` [PATCH v1 7/7] coresight-tgu: add reset node to initialize songchai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db2bc170-052e-4c9b-a191-4d916bbe0993@kernel.org \
--to=krzk@kernel.org \
--cc=agross@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=james.clark@arm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=quic_songchai@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.