Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1539061

Re: [PATCH 16/16] drivers/fsi: Add GPIO based FSI master

From Jeremy Kerr <jk@ozlabs.org>
Newsgroups linux.kernel
Subject Re: [PATCH 16/16] drivers/fsi: Add GPIO based FSI master
Date 2016-12-09 05:20 +0100
Message-ID <sMkP8-72E-7@gated-at.bofh.it> (permalink)
References <sLy7L-GS-9@gated-at.bofh.it> <sLy7L-GS-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 16/16] drivers/fsi: Add GPIO based FSI master Chris Bostic <christopher.lee.bostic@gmail.com> - 2016-12-07 01:20 +0100
  Re: [PATCH 16/16] drivers/fsi: Add GPIO based FSI master Jeremy Kerr <jk@ozlabs.org> - 2016-12-09 05:20 +0100

csiph-web