Skip to content

Commit 487532e

Browse files
stkidjwrdegoede
authored andcommitted
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: Wei Li <liwei391@huawei.com> Acked-by: Peter Kästle <peter@piie.net> Link: https://lore.kernel.org/r/20220326020249.3266561-1-liwei391@huawei.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 9aa6471 commit 487532e

1 file changed

Lines changed: 3 additions & 18 deletions

File tree

drivers/platform/x86/acerhdf.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -584,21 +584,6 @@ static struct platform_driver acerhdf_driver = {
584584
.remove = acerhdf_remove,
585585
};
586586

587-
/* checks if str begins with start */
588-
static int str_starts_with(const char *str, const char *start)
589-
{
590-
unsigned long str_len = 0, start_len = 0;
591-
592-
str_len = strlen(str);
593-
start_len = strlen(start);
594-
595-
if (str_len >= start_len &&
596-
!strncmp(str, start, start_len))
597-
return 1;
598-
599-
return 0;
600-
}
601-
602587
/* check hardware */
603588
static int __init acerhdf_check_hardware(void)
604589
{
@@ -651,9 +636,9 @@ static int __init acerhdf_check_hardware(void)
651636
* check if actual hardware BIOS vendor, product and version
652637
* IDs start with the strings of BIOS table entry
653638
*/
654-
if (str_starts_with(vendor, bt->vendor) &&
655-
str_starts_with(product, bt->product) &&
656-
str_starts_with(version, bt->version)) {
639+
if (strstarts(vendor, bt->vendor) &&
640+
strstarts(product, bt->product) &&
641+
strstarts(version, bt->version)) {
657642
found = 1;
658643
break;
659644
}

0 commit comments

Comments
 (0)