raspberrypi.c (1e7c57355a3bc617fc220234889e49fe722a6305) raspberrypi.c (f663204c9a1f8d6fcc590667d9d7a9f44e064644)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Defines interfaces for interacting with the Raspberry Pi firmware's
4 * property channel.
5 *
6 * Copyright © 2015 Broadcom
7 */
8

--- 229 unchanged lines hidden (view full) ---

238}
239
240void rpi_firmware_put(struct rpi_firmware *fw)
241{
242 kref_put(&fw->consumers, rpi_firmware_delete);
243}
244EXPORT_SYMBOL_GPL(rpi_firmware_put);
245
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Defines interfaces for interacting with the Raspberry Pi firmware's
4 * property channel.
5 *
6 * Copyright © 2015 Broadcom
7 */
8

--- 229 unchanged lines hidden (view full) ---

238}
239
240void rpi_firmware_put(struct rpi_firmware *fw)
241{
242 kref_put(&fw->consumers, rpi_firmware_delete);
243}
244EXPORT_SYMBOL_GPL(rpi_firmware_put);
245
246static void devm_rpi_firmware_put(void *data)
247{
248 struct rpi_firmware *fw = data;
249
250 rpi_firmware_put(fw);
251}
252
246static int rpi_firmware_probe(struct platform_device *pdev)
247{
248 struct device *dev = &pdev->dev;
249 struct rpi_firmware *fw;
250
251 /*
252 * Memory will be freed by rpi_firmware_delete() once all users have
253 * released their firmware handles. Don't use devm_kzalloc() here.

--- 72 unchanged lines hidden (view full) ---

326
327 if (!kref_get_unless_zero(&fw->consumers))
328 return NULL;
329
330 return fw;
331}
332EXPORT_SYMBOL_GPL(rpi_firmware_get);
333
253static int rpi_firmware_probe(struct platform_device *pdev)
254{
255 struct device *dev = &pdev->dev;
256 struct rpi_firmware *fw;
257
258 /*
259 * Memory will be freed by rpi_firmware_delete() once all users have
260 * released their firmware handles. Don't use devm_kzalloc() here.

--- 72 unchanged lines hidden (view full) ---

333
334 if (!kref_get_unless_zero(&fw->consumers))
335 return NULL;
336
337 return fw;
338}
339EXPORT_SYMBOL_GPL(rpi_firmware_get);
340
341/**
342 * devm_rpi_firmware_get - Get pointer to rpi_firmware structure.
343 * @firmware_node: Pointer to the firmware Device Tree node.
344 *
345 * Returns NULL is the firmware device is not ready.
346 */
347struct rpi_firmware *devm_rpi_firmware_get(struct device *dev,
348 struct device_node *firmware_node)
349{
350 struct rpi_firmware *fw;
351
352 fw = rpi_firmware_get(firmware_node);
353 if (!fw)
354 return NULL;
355
356 if (devm_add_action_or_reset(dev, devm_rpi_firmware_put, fw))
357 return NULL;
358
359 return fw;
360}
361EXPORT_SYMBOL_GPL(devm_rpi_firmware_get);
362
334static const struct of_device_id rpi_firmware_of_match[] = {
335 { .compatible = "raspberrypi,bcm2835-firmware", },
336 {},
337};
338MODULE_DEVICE_TABLE(of, rpi_firmware_of_match);
339
340static struct platform_driver rpi_firmware_driver = {
341 .driver = {

--- 12 unchanged lines hidden ---
363static const struct of_device_id rpi_firmware_of_match[] = {
364 { .compatible = "raspberrypi,bcm2835-firmware", },
365 {},
366};
367MODULE_DEVICE_TABLE(of, rpi_firmware_of_match);
368
369static struct platform_driver rpi_firmware_driver = {
370 .driver = {

--- 12 unchanged lines hidden ---