mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-31 06:18:51 +09:00
![Simon Glass](/assets/img/avatar_default.png)
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
37 lines
689 B
C
37 lines
689 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <dm/device-internal.h>
|
|
#include <errno.h>
|
|
#include <mtd.h>
|
|
|
|
/**
|
|
* mtd_probe - Probe the device @dev if not already done
|
|
*
|
|
* @dev: U-Boot device to probe
|
|
*
|
|
* @return 0 on success, an error otherwise.
|
|
*/
|
|
int mtd_probe(struct udevice *dev)
|
|
{
|
|
if (device_active(dev))
|
|
return 0;
|
|
|
|
return device_probe(dev);
|
|
}
|
|
|
|
/*
|
|
* Implement a MTD uclass which should include most flash drivers.
|
|
* The uclass private is pointed to mtd_info.
|
|
*/
|
|
|
|
UCLASS_DRIVER(mtd) = {
|
|
.id = UCLASS_MTD,
|
|
.name = "mtd",
|
|
.per_device_auto = sizeof(struct mtd_info),
|
|
};
|