Skip to content

Commit 0281522

Browse files
committed
Revert "of: base: Introduce of_alias_get_alias_list() to check alias IDs"
This reverts commit b1078c3. The single user of of_alias_get_alias_list(), drivers/tty/serial/xilinx_uartps.c, has since been refactored and no longer needs this function. It also contained a Smatch checker warning: drivers/of/base.c:2038 of_alias_get_alias_list() warn: passing negative bit value 's32min-(-2),0-s32max' to 'set_bit()' Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rob Herring <robh@kernel.org>
1 parent 6ac02df commit 0281522

2 files changed

Lines changed: 0 additions & 64 deletions

File tree

drivers/of/base.c

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#define pr_fmt(fmt) "OF: " fmt
1818

19-
#include <linux/bitmap.h>
2019
#include <linux/console.h>
2120
#include <linux/ctype.h>
2221
#include <linux/cpu.h>
@@ -1992,59 +1991,6 @@ int of_alias_get_id(struct device_node *np, const char *stem)
19921991
}
19931992
EXPORT_SYMBOL_GPL(of_alias_get_id);
19941993

1995-
/**
1996-
* of_alias_get_alias_list - Get alias list for the given device driver
1997-
* @matches: Array of OF device match structures to search in
1998-
* @stem: Alias stem of the given device_node
1999-
* @bitmap: Bitmap field pointer
2000-
* @nbits: Maximum number of alias IDs which can be recorded in bitmap
2001-
*
2002-
* The function travels the lookup table to record alias ids for the given
2003-
* device match structures and alias stem.
2004-
*
2005-
* Return: 0 or -ENOSYS when !CONFIG_OF or
2006-
* -EOVERFLOW if alias ID is greater then allocated nbits
2007-
*/
2008-
int of_alias_get_alias_list(const struct of_device_id *matches,
2009-
const char *stem, unsigned long *bitmap,
2010-
unsigned int nbits)
2011-
{
2012-
struct alias_prop *app;
2013-
int ret = 0;
2014-
2015-
/* Zero bitmap field to make sure that all the time it is clean */
2016-
bitmap_zero(bitmap, nbits);
2017-
2018-
mutex_lock(&of_mutex);
2019-
pr_debug("%s: Looking for stem: %s\n", __func__, stem);
2020-
list_for_each_entry(app, &aliases_lookup, link) {
2021-
pr_debug("%s: stem: %s, id: %d\n",
2022-
__func__, app->stem, app->id);
2023-
2024-
if (strcmp(app->stem, stem) != 0) {
2025-
pr_debug("%s: stem comparison didn't pass %s\n",
2026-
__func__, app->stem);
2027-
continue;
2028-
}
2029-
2030-
if (of_match_node(matches, app->np)) {
2031-
pr_debug("%s: Allocated ID %d\n", __func__, app->id);
2032-
2033-
if (app->id >= nbits) {
2034-
pr_warn("%s: ID %d >= than bitmap field %d\n",
2035-
__func__, app->id, nbits);
2036-
ret = -EOVERFLOW;
2037-
} else {
2038-
set_bit(app->id, bitmap);
2039-
}
2040-
}
2041-
}
2042-
mutex_unlock(&of_mutex);
2043-
2044-
return ret;
2045-
}
2046-
EXPORT_SYMBOL_GPL(of_alias_get_alias_list);
2047-
20481994
/**
20491995
* of_alias_get_highest_id - Get highest alias id for the given stem
20501996
* @stem: Alias stem to be examined

include/linux/of.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,6 @@ extern int of_phandle_iterator_args(struct of_phandle_iterator *it,
388388
extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
389389
extern int of_alias_get_id(struct device_node *np, const char *stem);
390390
extern int of_alias_get_highest_id(const char *stem);
391-
extern int of_alias_get_alias_list(const struct of_device_id *matches,
392-
const char *stem, unsigned long *bitmap,
393-
unsigned int nbits);
394391

395392
extern int of_machine_is_compatible(const char *compat);
396393

@@ -766,13 +763,6 @@ static inline int of_alias_get_highest_id(const char *stem)
766763
return -ENOSYS;
767764
}
768765

769-
static inline int of_alias_get_alias_list(const struct of_device_id *matches,
770-
const char *stem, unsigned long *bitmap,
771-
unsigned int nbits)
772-
{
773-
return -ENOSYS;
774-
}
775-
776766
static inline int of_machine_is_compatible(const char *compat)
777767
{
778768
return 0;

0 commit comments

Comments
 (0)