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


Groups > linux.kernel > #1255802

Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver

From Sascha Hauer <s.hauer@pengutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver
Date 2015-10-26 11:30 +0100
Message-ID <qnNcm-71B-19@gated-at.bofh.it> (permalink)
References <qk8S6-12c-11@gated-at.bofh.it> <qk8S6-12c-9@gated-at.bofh.it> <qnMJj-6CU-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Oct 26, 2015 at 09:56:24AM +0000, Srinivas Kandagatla wrote:
> >+	.val_bits = 32,
> >+	.reg_stride = 4,
> >+};
> >+
> >+static int mtk_efuse_probe(struct platform_device *pdev)
> >+{
> >+	struct device *dev = &pdev->dev;
> >+	struct resource *res;
> >+	struct nvmem_device *nvmem;
> >+	struct nvmem_config *econfig;
> >+	struct regmap *regmap;
> >+	void __iomem *base;
> >+
> >+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >+	base = devm_ioremap_resource(dev, res);
> >+	if (IS_ERR(base))
> >+		return PTR_ERR(base);
> >+
> >+	econfig = devm_kzalloc(dev, sizeof(*econfig), GFP_KERNEL);
> >+	if (!econfig)
> >+		return -ENOMEM;
> Why not use static econfig variable?

Because drivers should not assume there is only one instance of them in
the system. The qfprom driver does this and it's only a matter of
putting a second qcom,qfprom node into the device tree to break the
driver.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-10-26 11:00 +0100
  Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver Sascha Hauer <s.hauer@pengutronix.de> - 2015-10-26 11:30 +0100
    Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-10-26 11:50 +0100
  Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver andrew-ct chen <andrew-ct.chen@mediatek.com> - 2015-10-27 06:40 +0100
    Re: [PATCH 2/3] nvmem: mediatek: Add Mediatek EFUSE driver andrew-ct chen <andrew-ct.chen@mediatek.com> - 2015-10-27 10:30 +0100

csiph-web