This was a scripted change: $ git ls-files \ | grep '\.[ch]$' \ | grep -v -e ^tools/ -e ^scripts/ -e ^include/ \ | xargs grep -l strstarts \ | xargs sed -i 's/strstarts/strprefix/g'; Signed-off-by: Alejandro Colomar --- arch/arm/kernel/module.c | 12 ++--- arch/mips/bcm47xx/board.c | 4 +- arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- arch/powerpc/perf/imc-pmu.c | 2 +- crypto/essiv.c | 2 +- .../firmware/efi/libstub/efi-stub-helper.c | 2 +- drivers/firmware/efi/libstub/gop.c | 10 ++-- drivers/gpu/drm/omapdrm/dss/base.c | 2 +- .../gpu/drm/renesas/rcar-du/rcar_du_crtc.c | 2 +- drivers/hid/hid-uclogic-params.c | 2 +- drivers/input/mouse/psmouse-base.c | 2 +- drivers/input/mouse/trackpoint.c | 2 +- drivers/md/dm-crypt.c | 4 +- drivers/memory/tegra/tegra20.c | 4 +- drivers/mtd/spi-nor/issi.c | 2 +- drivers/net/ethernet/intel/ice/ice_parser.c | 10 ++-- drivers/of/property.c | 2 +- drivers/pci/pwrctrl/core.c | 2 +- drivers/platform/x86/acerhdf.c | 6 +-- drivers/platform/x86/dell/dell-lis3lv02d.c | 2 +- .../x86/hp/hp-bioscfg/spmobj-attributes.c | 4 +- drivers/platform/x86/lenovo/thinkpad_acpi.c | 54 +++++++++---------- drivers/platform/x86/touchscreen_dmi.c | 2 +- drivers/remoteproc/imx_dsp_rproc.c | 2 +- drivers/remoteproc/imx_rproc.c | 8 +-- drivers/remoteproc/st_remoteproc.c | 2 +- drivers/remoteproc/stm32_rproc.c | 2 +- drivers/remoteproc/xlnx_r5_remoteproc.c | 2 +- drivers/usb/dwc3/dwc3-pci.c | 2 +- drivers/usb/musb/musb_cppi41.c | 4 +- drivers/usb/musb/musb_debugfs.c | 20 +++---- fs/smb/client/reparse.c | 14 ++--- init/main.c | 2 +- kernel/module/kallsyms.c | 2 +- kernel/module/main.c | 8 +-- .../hda/codecs/side-codecs/tas2781_hda_i2c.c | 6 +-- 36 files changed, 105 insertions(+), 105 deletions(-) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index 55ca3fcd37e8..91af37789ecb 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -22,16 +22,16 @@ bool module_init_section(const char *name) { - return strstarts(name, ".init") || - strstarts(name, ".ARM.extab.init") || - strstarts(name, ".ARM.exidx.init"); + return strprefix(name, ".init") || + strprefix(name, ".ARM.extab.init") || + strprefix(name, ".ARM.exidx.init"); } bool module_exit_section(const char *name) { - return strstarts(name, ".exit") || - strstarts(name, ".ARM.extab.exit") || - strstarts(name, ".ARM.exidx.exit"); + return strprefix(name, ".exit") || + strprefix(name, ".ARM.extab.exit") || + strprefix(name, ".ARM.exidx.exit"); } #ifdef CONFIG_ARM_HAS_GROUP_RELOCS diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c index b487f687f62d..25fa1ef36ce8 100644 --- a/arch/mips/bcm47xx/board.c +++ b/arch/mips/bcm47xx/board.c @@ -251,7 +251,7 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void) if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) { for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) { - if (strstarts(buf1, e1->value1)) + if (strprefix(buf1, e1->value1)) return &e1->board; } } @@ -259,7 +259,7 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void) if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 && bcm47xx_nvram_getenv("boardnum", buf2, sizeof(buf2)) >= 0) { for (e2 = bcm47xx_board_list_hw_version_num; e2->value1; e2++) { - if (!strstarts(buf1, e2->value1) && + if (!strprefix(buf1, e2->value1) && !strcmp(buf2, e2->value2)) return &e2->board; } diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index 71628dac6c26..8083aeaab5b5 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -748,7 +748,7 @@ void __init board_prom_init(void) /* dump cfe version */ cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; - if (strstarts(cfe, "cfe-")) { + if (strprefix(cfe, "cfe-")) { if(cfe[4] == 'v') { if(cfe[5] == 'd') snprintf(cfe_version, 11, "%s", diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index a9f8464997a2..aff88b1fd3cf 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -1023,7 +1023,7 @@ static int thread_imc_event_init(struct perf_event *event) static bool is_thread_imc_pmu(struct perf_event *event) { - return strstarts(event->pmu->name, "thread_imc"); + return strprefix(event->pmu->name, "thread_imc"); } static __be64 *get_event_base_addr(struct perf_event *event) diff --git a/crypto/essiv.c b/crypto/essiv.c index a47a3eab6935..ee1bba6a48ce 100644 --- a/crypto/essiv.c +++ b/crypto/essiv.c @@ -508,7 +508,7 @@ static int essiv_create(struct crypto_template *tmpl, struct rtattr **tb) goto out_free_inst; aead_alg = crypto_spawn_aead_alg(&ictx->u.aead_spawn); block_base = &aead_alg->base; - if (!strstarts(block_base->cra_name, "authenc(")) { + if (!strprefix(block_base->cra_name, "authenc(")) { pr_warn("Only authenc() type AEADs are supported by ESSIV\n"); err = -EINVAL; goto out_drop_skcipher; diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 8e43eb3f418b..fbd0dda856b8 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -104,7 +104,7 @@ efi_status_t efi_parse_options(char const *cmdline) if (parse_option_str(val, "debug")) efi_loglevel = CONSOLE_LOGLEVEL_DEBUG; } else if (!strcmp(param, "video") && - val && strstarts(val, "efifb:")) { + val && strprefix(val, "efifb:")) { efi_parse_option_graphics(val + strlen("efifb:")); } } diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c index b800a6c2290c..c1cbf2b91867 100644 --- a/drivers/firmware/efi/libstub/gop.c +++ b/drivers/firmware/efi/libstub/gop.c @@ -42,7 +42,7 @@ static bool parse_modenum(char *option, char **next) { u32 m; - if (!strstarts(option, "mode=")) + if (!strprefix(option, "mode=")) return false; option += strlen("mode="); m = simple_strtoull(option, &option, 0); @@ -68,10 +68,10 @@ static bool parse_res(char *option, char **next) h = simple_strtoull(option, &option, 10); if (*option == '-') { option++; - if (strstarts(option, "rgb")) { + if (strprefix(option, "rgb")) { option += strlen("rgb"); pf = PIXEL_RGB_RESERVED_8BIT_PER_COLOR; - } else if (strstarts(option, "bgr")) { + } else if (strprefix(option, "bgr")) { option += strlen("bgr"); pf = PIXEL_BGR_RESERVED_8BIT_PER_COLOR; } else if (isdigit(*option)) @@ -93,7 +93,7 @@ static bool parse_res(char *option, char **next) static bool parse_auto(char *option, char **next) { - if (!strstarts(option, "auto")) + if (!strprefix(option, "auto")) return false; option += strlen("auto"); if (*option && *option++ != ',') @@ -106,7 +106,7 @@ static bool parse_auto(char *option, char **next) static bool parse_list(char *option, char **next) { - if (!strstarts(option, "list")) + if (!strprefix(option, "list")) return false; option += strlen("list"); if (*option && *option++ != ',') diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index a4ac113e1690..4179a89a4395 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -260,7 +260,7 @@ static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp) { if (comp->dss_core_component) return true; - if (!strstarts(comp->compat, "omapdss,")) + if (!strprefix(comp->compat, "omapdss,")) return true; if (omapdss_device_is_registered(comp->node)) return true; diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c index 59c2a4b76137..60aa8720f622 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.c @@ -1051,7 +1051,7 @@ static int rcar_du_crtc_parse_crc_source(struct rcar_du_crtc *rcrtc, } else if (!strcmp(source_name, "auto")) { *source = VSP1_DU_CRC_OUTPUT; return 0; - } else if (strstarts(source_name, "plane")) { + } else if (strprefix(source_name, "plane")) { unsigned int i; *source = VSP1_DU_CRC_PLANE; diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index ed16f50f21ed..fc8297d76a3c 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1270,7 +1270,7 @@ static bool uclogic_params_ugee_v2_has_battery(struct hid_device *hdev) hdev->product == USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_L) { struct usb_device *udev = hid_to_usb_dev(hdev); - if (strstarts(udev->product, "Deco LW")) + if (strprefix(udev->product, "Deco LW")) return true; } diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 23164688210d..3f5556227acb 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -513,7 +513,7 @@ bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) struct serio *serio = psmouse->ps2dev.serio; const char *p = serio->firmware_id; - if (!strstarts(p, "PNP: ")) + if (!strprefix(p, "PNP: ")) return false; p += 5; diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 3bd8fdf56cd3..b7fc22ffd174 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c @@ -418,7 +418,7 @@ static bool trackpoint_is_dt_capable(const char *pnp_id) return false; /* Must start with "PNP: LEN03" */ - if (!strstarts(pnp_id, "PNP: LEN03")) + if (!strprefix(pnp_id, "PNP: LEN03")) return false; /* Ensure enough length before comparing */ diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index a7655bba7ce3..e3ce3880f3f1 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -2847,7 +2847,7 @@ static int crypt_ctr_auth_cipher(struct crypt_config *cc, char *cipher_api) char *start, *end, *mac_alg = NULL; struct crypto_ahash *mac; - if (!strstarts(cipher_api, "authenc(")) + if (!strprefix(cipher_api, "authenc(")) return 0; start = strchr(cipher_api, '('); @@ -3051,7 +3051,7 @@ static int crypt_ctr_cipher(struct dm_target *ti, char *cipher_in, char *key) return -ENOMEM; } - if (strstarts(cipher_in, "capi:")) + if (strprefix(cipher_in, "capi:")) ret = crypt_ctr_cipher_new(ti, cipher_in, key, &ivmode, &ivopts); else ret = crypt_ctr_cipher_old(ti, cipher_in, key, &ivmode, &ivopts); diff --git a/drivers/memory/tegra/tegra20.c b/drivers/memory/tegra/tegra20.c index 27dd6886f86e..edb4d10ae36d 100644 --- a/drivers/memory/tegra/tegra20.c +++ b/drivers/memory/tegra/tegra20.c @@ -408,8 +408,8 @@ tegra20_mc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data) ndata->node = node; /* these clients are isochronous by default */ - if (strstarts(node->name, "display") || - strstarts(node->name, "vi")) + if (strprefix(node->name, "display") || + strprefix(node->name, "vi")) ndata->tag = TEGRA_MC_ICC_TAG_ISO; else ndata->tag = TEGRA_MC_ICC_TAG_DEFAULT; diff --git a/drivers/mtd/spi-nor/issi.c b/drivers/mtd/spi-nor/issi.c index 2f057d731df2..7fb8fc7b6b8f 100644 --- a/drivers/mtd/spi-nor/issi.c +++ b/drivers/mtd/spi-nor/issi.c @@ -138,7 +138,7 @@ static bool issi_pm25lv_match(const struct spi_nor *nor) { const char *name = nor->info ? nor->info->name : NULL; - return name && strstarts(name, "pm25lv"); + return name && strprefix(name, "pm25lv"); } static const struct spi_nor_fixup issi_fixup_list[] = { diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c index d239102c52ff..0db6407d7453 100644 --- a/drivers/net/ethernet/intel/ice/ice_parser.c +++ b/drivers/net/ethernet/intel/ice/ice_parser.c @@ -1375,15 +1375,15 @@ static void ice_parse_lbl_item(struct ice_hw *hw, u16 idx, void *item, lbl_item->idx = lbl_data->idx; memcpy(lbl_item->label, lbl_data->label, sizeof(lbl_item->label)); - if (strstarts(lbl_item->label, ICE_LBL_BST_DVM)) + if (strprefix(lbl_item->label, ICE_LBL_BST_DVM)) lbl_item->type = ICE_LBL_BST_TYPE_DVM; - else if (strstarts(lbl_item->label, ICE_LBL_BST_SVM)) + else if (strprefix(lbl_item->label, ICE_LBL_BST_SVM)) lbl_item->type = ICE_LBL_BST_TYPE_SVM; - else if (strstarts(lbl_item->label, ICE_LBL_TNL_VXLAN)) + else if (strprefix(lbl_item->label, ICE_LBL_TNL_VXLAN)) lbl_item->type = ICE_LBL_BST_TYPE_VXLAN; - else if (strstarts(lbl_item->label, ICE_LBL_TNL_GENEVE)) + else if (strprefix(lbl_item->label, ICE_LBL_TNL_GENEVE)) lbl_item->type = ICE_LBL_BST_TYPE_GENEVE; - else if (strstarts(lbl_item->label, ICE_LBL_TNL_UDP_ECPRI)) + else if (strprefix(lbl_item->label, ICE_LBL_TNL_UDP_ECPRI)) lbl_item->type = ICE_LBL_BST_TYPE_UDP_ECPRI; if (hw->debug_mask & ICE_DBG_PARSER) diff --git a/drivers/of/property.c b/drivers/of/property.c index 45e55f618488..f0729619a2a0 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1421,7 +1421,7 @@ DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") static struct device_node *parse_pinctrl_n(struct device_node *np, const char *prop_name, int index) { - if (!strstarts(prop_name, "pinctrl-")) + if (!strprefix(prop_name, "pinctrl-")) return NULL; if (!isdigit(prop_name[strlen("pinctrl-")])) diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index 0e2387cf4657..4544352d39c0 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -159,7 +159,7 @@ static bool pci_pwrctrl_is_required(struct device_node *np) if (ret < 0) return false; - if (!strstarts(compat, "pci")) + if (!strprefix(compat, "pci")) return false; if (of_pci_supply_present(np)) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 5ce5ad3efe69..25540b169339 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -582,9 +582,9 @@ static int __init acerhdf_check_hardware(void) * check if actual hardware BIOS vendor, product and version * IDs start with the strings of BIOS table entry */ - if (strstarts(vendor, bt->vendor) && - strstarts(product, bt->product) && - strstarts(version, bt->version)) { + if (strprefix(vendor, bt->vendor) && + strprefix(product, bt->product) && + strprefix(version, bt->version)) { found = 1; break; } diff --git a/drivers/platform/x86/dell/dell-lis3lv02d.c b/drivers/platform/x86/dell/dell-lis3lv02d.c index fe52bcd896f7..8ff52a7a9242 100644 --- a/drivers/platform/x86/dell/dell-lis3lv02d.c +++ b/drivers/platform/x86/dell/dell-lis3lv02d.c @@ -106,7 +106,7 @@ static bool i2c_adapter_is_main_i801(struct i2c_adapter *adap) * Only match the main I801 adapter and reject secondary adapters * which names start with "SMBus I801 IDF adapter". */ - return strstarts(adap->name, "SMBus I801 adapter"); + return strprefix(adap->name, "SMBus I801 adapter"); } static int find_i801(struct device *dev, void *data) diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c index a38d200bd0d9..dd50581a1572 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c @@ -49,7 +49,7 @@ size_t hp_calculate_security_buffer(const char *authentication) authlen = strlen(authentication); size = sizeof(u16) + authlen * sizeof(u16); - if (!strstarts(authentication, BEAM_PREFIX)) + if (!strprefix(authentication, BEAM_PREFIX)) size += strlen(UTF_PREFIX) * sizeof(u16); return size; @@ -70,7 +70,7 @@ int hp_populate_security_buffer(u16 *authbuf, const char *authentication) char *prefix = NULL; int ret = 0; - if (strstarts(authentication, BEAM_PREFIX)) { + if (strprefix(authentication, BEAM_PREFIX)) { /* * BEAM_PREFIX is append to authbuf when a signature * is provided and Sure Admin is enabled in BIOS diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c b/drivers/platform/x86/lenovo/thinkpad_acpi.c index 4f81855ad721..293ef2e2c9a5 100644 --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c @@ -1311,9 +1311,9 @@ static int tpacpi_rfk_procfs_write(const enum tpacpi_rfk_id id, char *buf) return -ENODEV; while ((cmd = strsep(&buf, ","))) { - if (strstarts(cmd, "enable")) + if (strprefix(cmd, "enable")) status = TPACPI_RFK_RADIO_ON; - else if (strstarts(cmd, "disable")) + else if (strprefix(cmd, "disable")) status = TPACPI_RFK_RADIO_OFF; else return -EINVAL; @@ -4119,12 +4119,12 @@ static int hotkey_write(char *buf) res = 0; while ((cmd = strsep(&buf, ","))) { - if (strstarts(cmd, "enable")) { + if (strprefix(cmd, "enable")) { hotkey_enabledisable_warn(1); - } else if (strstarts(cmd, "disable")) { + } else if (strprefix(cmd, "disable")) { hotkey_enabledisable_warn(0); res = -EPERM; - } else if (strstarts(cmd, "reset")) { + } else if (strprefix(cmd, "reset")) { mask = (hotkey_all_mask | hotkey_source_mask) & ~hotkey_reserved_mask; } else if (sscanf(cmd, "0x%x", &mask) == 1) { @@ -5043,33 +5043,33 @@ static int video_write(char *buf) disable = 0; while ((cmd = strsep(&buf, ","))) { - if (strstarts(cmd, "lcd_enable")) { + if (strprefix(cmd, "lcd_enable")) { enable |= TP_ACPI_VIDEO_S_LCD; - } else if (strstarts(cmd, "lcd_disable")) { + } else if (strprefix(cmd, "lcd_disable")) { disable |= TP_ACPI_VIDEO_S_LCD; - } else if (strstarts(cmd, "crt_enable")) { + } else if (strprefix(cmd, "crt_enable")) { enable |= TP_ACPI_VIDEO_S_CRT; - } else if (strstarts(cmd, "crt_disable")) { + } else if (strprefix(cmd, "crt_disable")) { disable |= TP_ACPI_VIDEO_S_CRT; } else if (video_supported == TPACPI_VIDEO_NEW && - strstarts(cmd, "dvi_enable")) { + strprefix(cmd, "dvi_enable")) { enable |= TP_ACPI_VIDEO_S_DVI; } else if (video_supported == TPACPI_VIDEO_NEW && - strstarts(cmd, "dvi_disable")) { + strprefix(cmd, "dvi_disable")) { disable |= TP_ACPI_VIDEO_S_DVI; - } else if (strstarts(cmd, "auto_enable")) { + } else if (strprefix(cmd, "auto_enable")) { res = video_autosw_set(1); if (res) return res; - } else if (strstarts(cmd, "auto_disable")) { + } else if (strprefix(cmd, "auto_disable")) { res = video_autosw_set(0); if (res) return res; - } else if (strstarts(cmd, "video_switch")) { + } else if (strprefix(cmd, "video_switch")) { res = video_outputsw_cycle(); if (res) return res; - } else if (strstarts(cmd, "expand_toggle")) { + } else if (strprefix(cmd, "expand_toggle")) { res = video_expand_toggle(); if (res) return res; @@ -5458,9 +5458,9 @@ static int light_write(char *buf) return -ENODEV; while ((cmd = strsep(&buf, ","))) { - if (strstarts(cmd, "on")) { + if (strprefix(cmd, "on")) { newstatus = 1; - } else if (strstarts(cmd, "off")) { + } else if (strprefix(cmd, "off")) { newstatus = 0; } else return -EINVAL; @@ -6983,10 +6983,10 @@ static int brightness_write(char *buf) return level; while ((cmd = strsep(&buf, ","))) { - if (strstarts(cmd, "up")) { + if (strprefix(cmd, "up")) { if (level < bright_maxlvl) level++; - } else if (strstarts(cmd, "down")) { + } else if (strprefix(cmd, "down")) { if (level > 0) level--; } else if (sscanf(cmd, "level %d", &level) == 1 && @@ -7731,13 +7731,13 @@ static int volume_write(char *buf) while ((cmd = strsep(&buf, ","))) { if (!tp_features.mixer_no_level_control) { - if (strstarts(cmd, "up")) { + if (strprefix(cmd, "up")) { if (new_mute) new_mute = 0; else if (new_level < TP_EC_VOLUME_MAX) new_level++; continue; - } else if (strstarts(cmd, "down")) { + } else if (strprefix(cmd, "down")) { if (new_mute) new_mute = 0; else if (new_level > 0) @@ -7749,9 +7749,9 @@ static int volume_write(char *buf) continue; } } - if (strstarts(cmd, "mute")) + if (strprefix(cmd, "mute")) new_mute = TP_EC_AUDIO_MUTESW_MSK; - else if (strstarts(cmd, "unmute")) + else if (strprefix(cmd, "unmute")) new_mute = 0; else return -EINVAL; @@ -9245,9 +9245,9 @@ static int fan_write_cmd_level(const char *cmd, int *rc) { int level; - if (strstarts(cmd, "level auto")) + if (strprefix(cmd, "level auto")) level = TP_EC_FAN_AUTO; - else if (strstarts(cmd, "level disengaged") || strstarts(cmd, "level full-speed")) + else if (strprefix(cmd, "level disengaged") || strprefix(cmd, "level full-speed")) level = TP_EC_FAN_FULLSPEED; else if (sscanf(cmd, "level %d", &level) != 1) return 0; @@ -9265,7 +9265,7 @@ static int fan_write_cmd_level(const char *cmd, int *rc) static int fan_write_cmd_enable(const char *cmd, int *rc) { - if (!strstarts(cmd, "enable")) + if (!strprefix(cmd, "enable")) return 0; *rc = fan_set_enable(); @@ -9280,7 +9280,7 @@ static int fan_write_cmd_enable(const char *cmd, int *rc) static int fan_write_cmd_disable(const char *cmd, int *rc) { - if (!strstarts(cmd, "disable")) + if (!strprefix(cmd, "disable")) return 0; *rc = fan_set_disable(); diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c index d83c387821ea..72f18dfc4368 100644 --- a/drivers/platform/x86/touchscreen_dmi.c +++ b/drivers/platform/x86/touchscreen_dmi.c @@ -1877,7 +1877,7 @@ static void ts_dmi_add_props(struct i2c_client *client) int error; if (has_acpi_companion(dev) && - strstarts(client->name, ts_data->acpi_name)) { + strprefix(client->name, ts_data->acpi_name)) { error = device_create_managed_software_node(dev, ts_data->properties, NULL); if (error) dev_err(dev, "failed to add properties: %d\n", error); diff --git a/drivers/remoteproc/imx_dsp_rproc.c b/drivers/remoteproc/imx_dsp_rproc.c index 96d619daf3f5..8e8085f27a64 100644 --- a/drivers/remoteproc/imx_dsp_rproc.c +++ b/drivers/remoteproc/imx_dsp_rproc.c @@ -699,7 +699,7 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv) * Ignore the first memory region which will be used vdev buffer. * No need to do extra handlings, rproc_add_virtio_dev will handle it. */ - if (strstarts(res.name, "vdev0buffer")) + if (strprefix(res.name, "vdev0buffer")) continue; if (imx_dsp_rproc_sys_to_da(priv, res.start, resource_size(&res), &da)) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 581bb07f5893..9f39e1a10f99 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -656,10 +656,10 @@ static int imx_rproc_prepare(struct rproc *rproc) * Ignore the first memory region which will be used vdev buffer. * No need to do extra handlings, rproc_add_virtio_dev will handle it. */ - if (strstarts(res.name, "vdev0buffer")) + if (strprefix(res.name, "vdev0buffer")) continue; - if (strstarts(res.name, "rsc-table")) + if (strprefix(res.name, "rsc-table")) continue; /* No need to translate pa to da, i.MX use same map */ @@ -834,7 +834,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, } /* Not map vdevbuffer, vdevring region */ - if (strstarts(res.name, "vdev")) + if (strprefix(res.name, "vdev")) continue; if (b >= IMX_RPROC_MEM_MAX) @@ -848,7 +848,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, } priv->mem[b].sys_addr = res.start; priv->mem[b].size = resource_size(&res); - if (strstarts(res.name, "rsc-table")) + if (strprefix(res.name, "rsc-table")) priv->rsc_table = priv->mem[b].cpu_addr; b++; } diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c index 486180cdccb4..3a351313b0c1 100644 --- a/drivers/remoteproc/st_remoteproc.c +++ b/drivers/remoteproc/st_remoteproc.c @@ -106,7 +106,7 @@ static int st_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw) return ret; /* No need to map vdev buffer */ - if (!strstarts(res.name, "vdev0buffer")) { + if (!strprefix(res.name, "vdev0buffer")) { /* Register memory region */ mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)res.start, diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c index a47e040c6db8..254ebc820721 100644 --- a/drivers/remoteproc/stm32_rproc.c +++ b/drivers/remoteproc/stm32_rproc.c @@ -203,7 +203,7 @@ static int stm32_rproc_prepare(struct rproc *rproc) } /* No need to map vdev buffer */ - if (!strstarts(res.name, "vdev0buffer")) { + if (!strprefix(res.name, "vdev0buffer")) { /* Register memory region */ mem = rproc_mem_entry_init(dev, NULL, (dma_addr_t)res.start, diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c index a9873a37dd8f..6b2eaa221334 100644 --- a/drivers/remoteproc/xlnx_r5_remoteproc.c +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c @@ -471,7 +471,7 @@ static int add_mem_regions_carveout(struct rproc *rproc) if (err) return 0; - if (strstarts(res.name, "vdev0buffer")) { + if (strprefix(res.name, "vdev0buffer")) { /* Init reserved memory for vdev buffer */ rproc_mem = rproc_of_resm_mem_entry_init(&rproc->dev, i, resource_size(&res), diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 6c1cbb722ca8..21e6e14ced31 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -301,7 +301,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc, acpi_quirk_skip_acpi_ac_and_battery() && /* Lenovo Yoga Tablet 2 Pro 1380 uses LC824206XA instead */ !(bios_ver && - strstarts(bios_ver, "BLADE_21.X64.0005.R00.1504101516"))) { + strprefix(bios_ver, "BLADE_21.X64.0005.R00.1504101516"))) { dev_info(&pdev->dev, "Using TUSB1211 phy for charger detection\n"); swnode = &dwc3_pci_intel_phy_charger_detect_swnode; } diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 28e958fcc862..c0786ad5a97f 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c @@ -686,9 +686,9 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) ret = of_property_read_string_index(np, "dma-names", i, &str); if (ret) goto err; - if (strstarts(str, "tx")) + if (strprefix(str, "tx")) is_tx = 1; - else if (strstarts(str, "rx")) + else if (strprefix(str, "rx")) is_tx = 0; else { dev_err(dev, "Wrong dmatype %s\n", str); diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 5092d62c2062..97cf89c6e451 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -179,36 +179,36 @@ static ssize_t musb_test_mode_write(struct file *file, goto ret; } - if (strstarts(buf, "force host full-speed")) + if (strprefix(buf, "force host full-speed")) test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; - else if (strstarts(buf, "force host high-speed")) + else if (strprefix(buf, "force host high-speed")) test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_HS; - else if (strstarts(buf, "force host")) + else if (strprefix(buf, "force host")) test = MUSB_TEST_FORCE_HOST; - else if (strstarts(buf, "fifo access")) + else if (strprefix(buf, "fifo access")) test = MUSB_TEST_FIFO_ACCESS; - else if (strstarts(buf, "force full-speed")) + else if (strprefix(buf, "force full-speed")) test = MUSB_TEST_FORCE_FS; - else if (strstarts(buf, "force high-speed")) + else if (strprefix(buf, "force high-speed")) test = MUSB_TEST_FORCE_HS; - else if (strstarts(buf, "test packet")) { + else if (strprefix(buf, "test packet")) { test = MUSB_TEST_PACKET; musb_load_testpacket(musb); } - else if (strstarts(buf, "test K")) + else if (strprefix(buf, "test K")) test = MUSB_TEST_K; - else if (strstarts(buf, "test J")) + else if (strprefix(buf, "test J")) test = MUSB_TEST_J; - else if (strstarts(buf, "test SE0 NAK")) + else if (strprefix(buf, "test SE0 NAK")) test = MUSB_TEST_SE0_NAK; musb_writeb(musb->mregs, MUSB_TESTMODE, test); diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c index 3a27773186ae..d35af97cdbad 100644 --- a/fs/smb/client/reparse.c +++ b/fs/smb/client/reparse.c @@ -97,7 +97,7 @@ static int create_native_symlink(const unsigned int xid, struct inode *inode, * ensure compatibility of this symlink stored in absolute form * on the SMB server. */ - if (!strstarts(symname, symroot)) { + if (!strprefix(symname, symroot)) { /* * If the absolute Linux symlink target path is not * inside "symlinkroot" location then there is no way @@ -171,7 +171,7 @@ static int create_native_symlink(const unsigned int xid, struct inode *inode, * letter so the prefix occupies six characters in UTF-16 too. */ if (!(sbflags & CIFS_MOUNT_POSIX_PATHS) && symname[0] == '/') { - if (!strstarts(sym, "\\??\\") || !isascii(sym[4]) || + if (!strprefix(sym, "\\??\\") || !isascii(sym[4]) || !isalpha(sym[4]) || sym[5] != ':') { rc = -EINVAL; goto out; @@ -905,11 +905,11 @@ int smb2_parse_native_symlink(char **target, const char *buf, unsigned int len, */ abs_path = smb_target; globalroot: - if (strstarts(abs_path, "\\??\\")) + if (strprefix(abs_path, "\\??\\")) abs_path += sizeof("\\??\\")-1; - else if (strstarts(abs_path, "\\DosDevices\\")) + else if (strprefix(abs_path, "\\DosDevices\\")) abs_path += sizeof("\\DosDevices\\")-1; - else if (strstarts(abs_path, "\\GLOBAL??\\")) + else if (strprefix(abs_path, "\\GLOBAL??\\")) abs_path += sizeof("\\GLOBAL??\\")-1; else goto out_unhandled_target; @@ -918,10 +918,10 @@ int smb2_parse_native_symlink(char **target, const char *buf, unsigned int len, if (abs_path[0] == '\\') abs_path++; - while (strstarts(abs_path, "Global\\")) + while (strprefix(abs_path, "Global\\")) abs_path += sizeof("Global\\")-1; - if (strstarts(abs_path, "GLOBALROOT\\")) { + if (strprefix(abs_path, "GLOBALROOT\\")) { /* Label globalroot requires path with leading '\\', so do not trim '\\' */ abs_path += sizeof("GLOBALROOT")-1; goto globalroot; diff --git a/init/main.c b/init/main.c index 7b0c8c34e6a9..44513443d127 100644 --- a/init/main.c +++ b/init/main.c @@ -586,7 +586,7 @@ static int __init unknown_bootoption(char *param, char *val, /* Handle bootloader identifier */ for (int i = 0; bootloader[i]; i++) { - if (strstarts(param, bootloader[i])) + if (strprefix(param, bootloader[i])) return 0; } diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c index 1ff8ce857d92..bcdf2ebe0d32 100644 --- a/kernel/module/kallsyms.c +++ b/kernel/module/kallsyms.c @@ -68,7 +68,7 @@ static char elf_type(const Elf_Sym *sym, const struct load_info *info) else return 'b'; } - if (strstarts(info->secstrings + sechdrs[sym->st_shndx].sh_name, + if (strprefix(info->secstrings + sechdrs[sym->st_shndx].sh_name, ".debug")) { return 'n'; } diff --git a/kernel/module/main.c b/kernel/module/main.c index 34e0204ea37c..d97502225b3d 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -1195,7 +1195,7 @@ static bool verify_module_namespace(const char *namespace, const char *modname) const char *sep; bool glob; - if (!strstarts(namespace, prefix)) + if (!strprefix(namespace, prefix)) return false; for (namespace += strlen(prefix); *namespace; namespace = sep) { @@ -1836,7 +1836,7 @@ static int setup_modinfo(struct module *mod, struct load_info *info) * 'module:' prefixed namespaces are implicit, disallow * explicit imports. */ - if (strstarts(imported_namespace, "module:")) { + if (strprefix(imported_namespace, "module:")) { pr_err("%s: module tries to import module namespace: %s\n", mod->name, imported_namespace); return -EPERM; @@ -1863,12 +1863,12 @@ static void free_modinfo(struct module *mod) bool __weak module_init_section(const char *name) { - return strstarts(name, ".init"); + return strprefix(name, ".init"); } bool __weak module_exit_section(const char *name) { - return strstarts(name, ".exit"); + return strprefix(name, ".exit"); } static int validate_section_offset(const struct load_info *info, Elf_Shdr *shdr) diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c index 0c8faa583baa..bf24dce50e23 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c @@ -636,14 +636,14 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) tas_hda->priv->chip_id = TAS2781; hda_priv->save_calibration = tas2781_save_calibration; tas_hda->priv->global_addr = TAS2781_GLOBAL_ADDR; - } else if (strstarts(dev_name(&clt->dev), "i2c-TXNW2770")) { + } else if (strprefix(dev_name(&clt->dev), "i2c-TXNW2770")) { /* * TAS2770, has no on-chip DSP, so no calibration data * required; has no global I2C address supported. */ device_name = "TXNW2770"; hda_priv->hda_chip_id = HDA_TAS2770; - } else if (strstarts(dev_name(&clt->dev), + } else if (strprefix(dev_name(&clt->dev), "i2c-TXNW2781:00-tas2781-hda.0")) { device_name = "TXNW2781"; hda_priv->hda_chip_id = HDA_TAS2781; @@ -659,7 +659,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) hda_priv->hda_chip_id = HDA_TAS2563; hda_priv->save_calibration = tas2563_save_calibration; tas_hda->priv->global_addr = TAS2563_GLOBAL_ADDR; - } else if (strstarts(dev_name(&clt->dev), "i2c-TXNW5825")) { + } else if (strprefix(dev_name(&clt->dev), "i2c-TXNW5825")) { /* * TAS5825, integrated on-chip DSP without * global I2C address and calibration supported. -- 2.55.0