From: Greg KH <gregkh@linuxfoundation.org>
To: richard.gong@linux.intel.com
Cc: robh+dt@kernel.org, mark.rutland@arm.com, dinguyen@kernel.org,
atull@kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Richard Gong <richard.gong@intel.com>
Subject: Re: [PATCHv1 4/6] firmware: add Intel Stratix10 remote system update driver
Date: Thu, 25 Apr 2019 22:33:41 +0200 [thread overview]
Message-ID: <20190425203341.GF22307@kroah.com> (raw)
In-Reply-To: <1554835562-25056-5-git-send-email-richard.gong@linux.intel.com>
On Tue, Apr 09, 2019 at 01:46:00PM -0500, richard.gong@linux.intel.com wrote:
> +static ssize_t reboot_image_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct stratix10_rsu_priv *priv = dev_get_drvdata(dev);
> + unsigned long address;
> + int ret;
> +
> + if (priv == 0)
> + return -ENODEV;
> +
> + ret = kstrtoul(buf, 0, &address);
> + if (ret)
> + return ret;
> +
> + rsu_send_msg(priv, COMMAND_RSU_UPDATE,
> + address, rsu_update_callback);
> +
> + return count;
> +}
No error checking that the value was a sane one? That this message
actually worked? I can write any random number in here and have no
error happen at all? Nice! :(
> +static ssize_t notify_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct stratix10_rsu_priv *priv = dev_get_drvdata(dev);
> + unsigned long status;
> + int ret;
> +
> + if (priv == 0)
> + return -ENODEV;
> +
> + ret = kstrtoul(buf, 0, &status);
> + if (ret)
> + return ret;
> +
> + rsu_send_msg(priv, COMMAND_RSU_NOTIFY,
> + status, rsu_notify_callback);
> +
> + return count;
> +}
Same comment here.
> +
> +static DEVICE_ATTR_RO(current_image);
> +static DEVICE_ATTR_RO(fail_image);
> +static DEVICE_ATTR_RO(state);
> +static DEVICE_ATTR_RO(version);
> +static DEVICE_ATTR_RO(error_location);
> +static DEVICE_ATTR_RO(error_details);
> +static DEVICE_ATTR_WO(reboot_image);
> +static DEVICE_ATTR_WO(notify);
> +
> +static struct attribute *attrs[] = {
> + &dev_attr_current_image.attr,
> + &dev_attr_fail_image.attr,
> + &dev_attr_state.attr,
> + &dev_attr_version.attr,
> + &dev_attr_error_location.attr,
> + &dev_attr_error_details.attr,
> + &dev_attr_reboot_image.attr,
> + &dev_attr_notify.attr,
> + NULL
> +};
> +
> +static struct attribute_group attr_group = {
> + .attrs = attrs
> +};
ATTRIBUTE_GROUP()?
> +static int stratix10_rsu_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct stratix10_rsu_priv *priv;
> + int ret;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->client.dev = dev;
> + priv->client.receive_cb = NULL;
> + priv->client.priv = priv;
> + priv->status.current_image = 0;
> + priv->status.fail_image = 0;
> + priv->status.error_location = 0;
> + priv->status.error_details = 0;
> + priv->status.version = 0;
> + priv->status.state = 0;
> +
> + mutex_init(&priv->lock);
> + priv->chan = stratix10_svc_request_channel_byname(&priv->client,
> + SVC_CLIENT_RSU);
> + if (IS_ERR(priv->chan)) {
> + dev_err(dev, "couldn't get service channel (%s)\n",
> + SVC_CLIENT_RSU);
> + return PTR_ERR(priv->chan);
> + }
> +
> + init_completion(&priv->completion);
> + platform_set_drvdata(pdev, priv);
> +
> + /* status is only updated after reboot */
> + ret = rsu_send_msg(priv, COMMAND_RSU_STATUS,
> + 0, rsu_status_callback);
> + if (ret) {
> + dev_err(dev, "Error getting RSU status (%i)\n", ret);
> + stratix10_svc_free_channel(priv->chan);
> + return ret;
> + }
> +
> + ret = sysfs_create_group(&dev->kobj, &attr_group);
Why not add this to the device earlier so that the driver core creates
it all for your automatically?
Or does platform devices not do this? I can never remember...
> + if (ret)
> + stratix10_svc_free_channel(priv->chan);
> +
> + pr_info("Intel RSU Driver Initialized\n");
Don't be noisy, if all goes well, never say anything.
thanks,
greg k-h
next prev parent reply other threads:[~2019-04-25 20:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 18:45 [PATCHv1 0/6] add Intel Stratix10 remote system update driver richard.gong
2019-04-09 18:45 ` [PATCHv1 1/6] firmware: stratix10-svc: add to support RSU notify richard.gong
2019-04-09 18:45 ` [PATCHv1 2/6] dt-bindings, firmware: add Intel Stratix10 remote system update binding richard.gong
2019-04-29 17:48 ` Rob Herring
2019-04-09 18:45 ` [PATCHv1 3/6] arm64: dts: stratix10: add remote system update richard.gong
2019-04-09 18:46 ` [PATCHv1 4/6] firmware: add Intel Stratix10 remote system update driver richard.gong
2019-04-25 20:30 ` Greg KH
2019-04-25 20:33 ` Greg KH [this message]
2019-04-09 18:46 ` [PATCHv1 5/6] firmware: rsu: document sysfs interface richard.gong
2019-04-25 20:27 ` Greg KH
2019-04-25 20:28 ` Greg KH
2019-04-09 18:46 ` [PATCHv1 6/6] MAINTAINERS: add maintainer for Intel Stratix10 FW drivers richard.gong
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=20190425203341.GF22307@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=atull@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dinguyen@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=richard.gong@intel.com \
--cc=richard.gong@linux.intel.com \
--cc=robh+dt@kernel.org \
/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.