lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1446714564.3894.6.camel@pengutronix.de>
Date:	Thu, 05 Nov 2015 10:09:24 +0100
From:	Philipp Zabel <p.zabel@...gutronix.de>
To:	Jitao Shi <jitao.shi@...iatek.com>
Cc:	Rob Herring <robh+dt@...nel.org>, Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	David Airlie <airlied@...ux.ie>,
	Matthias Brugger <matthias.bgg@...il.com>,
	devicetree@...r.kernel.org, eddie.huang@...iatek.com,
	Sascha Hauer <kernel@...gutronix.de>,
	srv_heupstream@...iatek.com, bibby.hsieh@...iatek.com,
	linux-mediatek@...ts.infradead.org,
	Russell King <rmk+kernel@....linux.org.uk>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	Inki Dae <inki.dae@...sung.com>, yingjoe.chen@...iatek.com,
	cawa.cheng@...iatek.com, Sean Paul <seanpaul@...omium.org>,
	Andy Yan <andy.yan@...k-chips.com>,
	Vincent Palatin <vpalatin@...omium.org>,
	Thierry Reding <treding@...dia.com>,
	Ajay Kumar <ajaykumar.rs@...sung.com>,
	linux-arm-kernel@...ts.infradead.org,
	Rahul Sharma <rahul.sharma@...sung.com>
Subject: Re: [RFC v2 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

Hi Jitao,

some things I missed before.

Am Montag, den 02.11.2015, 10:09 +0800 schrieb Jitao Shi:
[...]
> +static int ps8640_regr(struct i2c_client *client, u16 i2c_addr,
> +		       u8 reg, u8 *value)
> +{
> +	int ret;
> +
> +	client->addr = i2c_addr;

I think i2c_new_dummy should be used to create additional clients for
the secondary addresses, instead of changing the address of the client
with every transfer.

> +	ret = i2c_master_send(client, &reg, 1);
> +	if (ret <= 0) {
> +		DRM_ERROR("Failed to send i2c command, ret=%d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = i2c_master_recv(client, value, 1);
> +	if (ret <= 0) {
> +		DRM_ERROR("Failed to recv i2c data, ret=%d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
[...]
> +static int ps8640_probe(struct i2c_client *client,
> +			const struct i2c_device_id *id)
> +{
> +	struct device *dev = &client->dev;
> +	struct ps8640 *ps_bridge;
> +	struct device_node *np = dev->of_node;
> +	struct device_node *in_ep, *out_ep;
> +	struct device_node *panel_node = NULL;
> +	int ret;
> +	u32 temp_reg;
> +
> +	ps_bridge = devm_kzalloc(dev, sizeof(*ps_bridge), GFP_KERNEL);
> +	if (!ps_bridge)
> +		return -ENOMEM;
> +
> +	in_ep = of_graph_get_next_endpoint(np, NULL);
> +	if (in_ep) {
> +		out_ep = of_graph_get_next_endpoint(np, in_ep);
> +		of_node_put(in_ep);
> +		if (out_ep) {
> +			panel_node = of_graph_get_remote_port_parent(out_ep);
> +			of_node_put(out_ep);
> +		}
> +	}
> +	if (panel_node) {
> +		ps_bridge->panel = of_drm_find_panel(panel_node);
> +		of_node_put(panel_node);
> +		if (!ps_bridge->panel)
> +			return -EPROBE_DEFER;
> +	}
> +
> +	ps_bridge->client = client;
> +
> +	ps_bridge->pwr_3v3_supply = devm_regulator_get(dev, "vdd33-supply");

Should be "vdd3", regulator_get will add the "-supply" suffix.

> +	if (IS_ERR(ps_bridge->pwr_3v3_supply)) {
> +		dev_err(dev, "cannot get ps_bridge->pwr_3v3_supply\n");
> +		return PTR_ERR(ps_bridge->pwr_3v3_supply);
> +	}
> +
> +	ps_bridge->pwr_1v2_supply = devm_regulator_get(dev, "vdd12-supply");

Same here, "vdd12".

> +	if (IS_ERR(ps_bridge->pwr_1v2_supply)) {
> +		dev_err(dev, "cannot get ps_bridge->pwr_1v2_supply\n");
> +		return PTR_ERR(ps_bridge->pwr_1v2_supply);
> +	}
> +
> +	ps_bridge->gpio_mode_sel_n = devm_gpiod_get(&client->dev, "mode-sel",
> +						    GPIOD_OUT_HIGH);
> +	if (IS_ERR(ps_bridge->gpio_mode_sel_n)) {
> +		ret = PTR_ERR(ps_bridge->gpio_mode_sel_n);
> +		DRM_ERROR("cannot get gpio_mode_sel_n %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = gpiod_direction_output(ps_bridge->gpio_mode_sel_n, 1);
> +	if (ret) {
> +		DRM_ERROR("cannot configure gpio_mode_sel_n\n");
> +		return ret;
> +	}
> +
> +	ps_bridge->gpio_slp_n = devm_gpiod_get(&client->dev, "sleep-gpios",
> +					       GPIOD_OUT_HIGH);

Should be "sleep", gpiod_get will add the "-gpios" suffix.

> +	if (IS_ERR(ps_bridge->gpio_slp_n)) {
> +		ret = PTR_ERR(ps_bridge->gpio_slp_n);
> +		DRM_ERROR("cannot get gpio_slp_n %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = gpiod_direction_output(ps_bridge->gpio_slp_n, 1);
> +	if (ret) {
> +		DRM_ERROR("cannot configure gpio_slp_n\n");
> +		return ret;
> +	}

This can be removed, the "devm_gpiod_get(..., GPIOD_OUT_HIGH);" already
does the same.

> +
> +	ps_bridge->gpio_rst_n = devm_gpiod_get(&client->dev, "reset",
> +					       GPIOD_OUT_HIGH);
> +	if (IS_ERR(ps_bridge->gpio_rst_n)) {
> +		ret = PTR_ERR(ps_bridge->gpio_rst_n);
> +		DRM_ERROR("cannot get gpio_rst_n %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = gpiod_direction_output(ps_bridge->gpio_rst_n, 1);
> +	if (ret) {
> +		DRM_ERROR("cannot configure gpio_rst_n\n");
> +		return ret;
> +	}

Same here, the gpiod_direction_output can be removed.

best regards
Philipp

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ