Commit 487532ec authored by Wei Li's avatar Wei Li Committed by Hans de Goede

platform/x86: acerhdf: Cleanup str_starts_with()

Since there is already a generic function strstarts() that check if a
string starts with a given prefix, cleanup str_starts_with().
Signed-off-by: default avatarWei Li <liwei391@huawei.com>
Acked-by: default avatarPeter Kästle <peter@piie.net>
Link: https://lore.kernel.org/r/20220326020249.3266561-1-liwei391@huawei.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 9aa64714
...@@ -584,21 +584,6 @@ static struct platform_driver acerhdf_driver = { ...@@ -584,21 +584,6 @@ static struct platform_driver acerhdf_driver = {
.remove = acerhdf_remove, .remove = acerhdf_remove,
}; };
/* checks if str begins with start */
static int str_starts_with(const char *str, const char *start)
{
unsigned long str_len = 0, start_len = 0;
str_len = strlen(str);
start_len = strlen(start);
if (str_len >= start_len &&
!strncmp(str, start, start_len))
return 1;
return 0;
}
/* check hardware */ /* check hardware */
static int __init acerhdf_check_hardware(void) static int __init acerhdf_check_hardware(void)
{ {
...@@ -651,9 +636,9 @@ static int __init acerhdf_check_hardware(void) ...@@ -651,9 +636,9 @@ static int __init acerhdf_check_hardware(void)
* check if actual hardware BIOS vendor, product and version * check if actual hardware BIOS vendor, product and version
* IDs start with the strings of BIOS table entry * IDs start with the strings of BIOS table entry
*/ */
if (str_starts_with(vendor, bt->vendor) && if (strstarts(vendor, bt->vendor) &&
str_starts_with(product, bt->product) && strstarts(product, bt->product) &&
str_starts_with(version, bt->version)) { strstarts(version, bt->version)) {
found = 1; found = 1;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment