mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-27 07:01:24 +00:00
41575d8e4c
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>
36 lines
689 B
C
36 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),
|
|
};
|