devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Wendy Ng <wendy.ng@broadcom.com>
Cc: Rob Herring <rob.herring@calxeda.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Eduardo Valentin <eduardo.valentin@ti.com>,
	Kumar Gala <galak@codeaurora.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, Christian Daudt <bcm@fixthebug.org>,
	Markus Mayer <mmayer@broadcom.com>,
	Tim Kryger <tim.kryger@linaro.org>,
	Matt Porter <matt.porter@linaro.org>
Subject: Re: [PATCH V2 1/3] thermal: bcm281xx: Add Temperature Monitor driver
Date: Tue, 05 Nov 2013 12:15:29 -0800	[thread overview]
Message-ID: <1383682529.4387.37.camel@joe-AO722> (raw)
In-Reply-To: <1383681284-17643-2-git-send-email-wendy.ng@broadcom.com>

On Tue, 2013-11-05 at 11:54 -0800, Wendy Ng wrote:
> This adds the support for Temperature Monitor (TMON) driver for
> Broadcom bcm281xx SoCs. This driver plugs into the Thermal Framework.

trivia:

> diff --git a/drivers/thermal/bcm_kona_tmon.c b/drivers/thermal/bcm_kona_tmon.c

Please add
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any #include to prefix the pr_<level> dmesg output.

If you _really_ want __func__ with each output, you could use
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
though I think __func__ isn't particularly useful.

> +#include <linux/clk.h>
> +#include <linux/err.h>
[]
> +static int bcm_get_temp(void *sensor_data, long *temp)
> +{
> +	u32 raw;
> +	long mcelsius;
> +	struct bcm_tmon_data_priv *priv = sensor_data;
> +
> +	if (!priv) {
> +		pr_err("%s: input sensor_data not initialized.\n", __func__);

then this could become
		pr_err("input sensor_data not initialized\n");

Also, there's no real need to terminate messages with sentence
ending ".".  dmesg output generally isn't a sentence.

> +		return -EINVAL;
> +	}
> +
> +	raw = (readl(priv->base + TMON_TEMP_VAL_OFFSET)
> +		& TMON_TEMP_VAL_TEMP_VAL_MASK) >> TMON_TEMP_VAL_TEMP_VAL_SHIFT;
> +
> +	pr_debug("%s: raw temp 0x%x\n", __func__, raw);

also consider:

	pr_debug("raw temp: %#x\n", raw);


> +static int bcm_kona_tmon_probe(struct platform_device *pdev)
> +{
[]
> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv) {
> +		dev_err(&pdev->dev, "Failed to malloc priv.\n");
> +		return -ENOMEM;
> +	}

Generic OOM messages are already emitted by devm_kzalloc.
This could be written as:

	priv = devm_kzalloc(etc...)
	if (!priv)
		return -ENOMEM;

  reply	other threads:[~2013-11-05 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 19:54 [PATCH V2 0/3] thermal: bcm281xx: Add Temperature Monitor driver Wendy Ng
2013-11-05 19:54 ` [PATCH V2 1/3] " Wendy Ng
2013-11-05 20:15   ` Joe Perches [this message]
2013-11-05 19:54 ` [PATCH V2 2/3] ARM: configs:enable thermal framework for bcm281xx Wendy Ng
2013-11-05 19:54 ` [PATCH V2 3/3] ARM: dts: Add TMON driver support to bcm281xx Wendy Ng

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=1383682529.4387.37.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=bcm@fixthebug.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eduardo.valentin@ti.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt.porter@linaro.org \
    --cc=mmayer@broadcom.com \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tim.kryger@linaro.org \
    --cc=wendy.ng@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).