devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
To: Chris Bostic
	<christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
	geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Chris Bostic <cbostic-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	andrew-zrmu5oMJ5Fs@public.gmane.org,
	alistair-Y4h6yKqj69EXC2x5gXVKYQ@public.gmane.org,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 16/16] drivers/fsi: Add GPIO based FSI master
Date: Fri, 9 Dec 2016 15:12:05 +1100	[thread overview]
Message-ID: <6a39f4d9-0f20-a146-3122-86d3f75c58fa@ozlabs.org> (raw)
In-Reply-To: <1481069677-53660-17-git-send-email-christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Hi Chris,

> +static ssize_t store_scan(struct device *dev,
> +				struct device_attribute *attr,
> +				const char *buf,
> +				size_t count)
> +{
> +	struct fsi_master_gpio *master = dev_get_drvdata(dev);
> +
> +	fsi_master_gpio_init(master);
> +
> +	/* clear out any old scan data if present */
> +	fsi_master_unregister(&master->master);
> +	fsi_master_register(&master->master);
> +
> +	return count;
> +}
> +
> +static DEVICE_ATTR(scan, 0200, NULL, store_scan);

I think it would make more sense to have the scan attribute populated by
the fsi core; we want this on all masters, not just GPIO.

Currently, the only GPIO-master-specific functionality here is the
fsi_master_gpio_init() - but isn't this something that we can do at
probe time instead?

> +static int fsi_master_gpio_probe(struct platform_device *pdev)
> +{
> +	struct fsi_master_gpio *master;
> +	struct gpio_desc *gpio;
> +
> +	master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);
> +	if (!master)
> +		return -ENOMEM;

We should be populating master->dev.parent, see

  https://github.com/jk-ozlabs/linux/commit/5225d6c47


> +	/* Optional pins */
> +
> +	gpio = devm_gpiod_get(&pdev->dev, "trans", 0);
> +	if (IS_ERR(gpio))
> +		dev_dbg(&pdev->dev, "probe: failed to get trans pin\n");
> +	else
> +		master->gpio_trans = gpio;

I found devm_gpiod_get_optional(), which might make this a little
neater.

Cheers,


Jeremy
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-12-09  4:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07  0:14 [PATCH 00/16] FSI device driver introduction Chris Bostic
2016-12-07  0:14 ` [PATCH 01/16] drivers/fsi: Add empty fsi bus definitions Chris Bostic
2016-12-07  0:14 ` [PATCH 03/16] drivers/fsi: add driver to device matches Chris Bostic
2016-12-07  0:14 ` [PATCH 05/16] drivers/fsi: Add fake master driver Chris Bostic
     [not found]   ` <1481069677-53660-6-git-send-email-christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-07 12:09     ` Mark Rutland
2016-12-07 23:27       ` Jeremy Kerr
2016-12-07  0:14 ` [PATCH 06/16] drivers/fsi: Add slave definition Chris Bostic
2016-12-07  0:14 ` [PATCH 07/16] drivers/fsi: Add empty master scan Chris Bostic
     [not found] ` <1481069677-53660-1-git-send-email-christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-07  0:14   ` [PATCH 02/16] drivers/fsi: Add device & driver definitions Chris Bostic
2016-12-07  0:14   ` [PATCH 10/16] drivers/fsi: scan slaves & register devices Chris Bostic
2016-12-07  1:52   ` [PATCH 00/16] FSI device driver introduction Sebastian Reichel
2016-12-07  0:14 ` [PATCH 13/16] drivers/fsi: Set slave SMODE to init communication Chris Bostic
2016-12-07  0:14 ` [PATCH 14/16] drivers/fsi: Add master unscan Chris Bostic
     [not found]   ` <1481069677-53660-15-git-send-email-christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-07  9:31     ` Greg KH
2016-12-07  0:14 ` [PATCH 15/16] drivers/fsi: Add documentation for GPIO bindings Chris Bostic
2016-12-07 12:02   ` Mark Rutland
2016-12-07  0:14 ` [PATCH 16/16] drivers/fsi: Add GPIO based FSI master Chris Bostic
     [not found]   ` <1481069677-53660-17-git-send-email-christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-09  4:12     ` Jeremy Kerr [this message]
     [not found]       ` <6a39f4d9-0f20-a146-3122-86d3f75c58fa-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
2016-12-12 19:49         ` Christopher Bostic

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=6a39f4d9-0f20-a146-3122-86d3f75c58fa@ozlabs.org \
    --to=jk-mnsaurcq41sdnm+yrofe0a@public.gmane.org \
    --cc=alistair-Y4h6yKqj69EXC2x5gXVKYQ@public.gmane.org \
    --cc=andrew-zrmu5oMJ5Fs@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=cbostic-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=christopher.lee.bostic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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).