Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2214687rwd; Fri, 19 May 2023 02:33:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79tVaWcnF8Ui8wJVfkR/2aGmqbQjPZAAVPrPCHGUjL+ppWIuNPDHy15+Z4oHFRDHJ9FSjp X-Received: by 2002:a05:6a00:1596:b0:63b:8778:99e4 with SMTP id u22-20020a056a00159600b0063b877899e4mr2368710pfk.2.1684488826217; Fri, 19 May 2023 02:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684488826; cv=none; d=google.com; s=arc-20160816; b=hlMlph9gdBE91X0sriEOqzJE/D2dqvlR4+tVTPnbI3nrVohjkaYzW680oOkY+RtSx6 fuFyF/PJvhcwIT5/0+ZRfy1aWqE/mOG9EySRTrAEdu1iDPtnF9ty83TVb0mypcIdfaYI URwm8PkvRWuwzUdeQbUfsgX/kc9975gJXbcqOdSghtc/IQ4RIMROEpWjED5U8JZrn7k2 enKIIyrkGWw6V0YI2L3Oc6jHKqGEHjIJ02dLr5QwORiGXnMk3otECDO2Cf2VvbomRHh3 W4eD9ZX2zaMqrhsQUOyq/p6udDDuLO4eK3A6L2Q/ODmzrEtbzaKTKI4SAZZOdm0waV61 B+OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=HpltZXyn7IFUsWYubb3YXnbYdNZhgEiIMwEl6o8+pfI=; b=WGHhyqedPLeR7msRjnmri/OycV7RnYeJNwSe1HeCPBd7Rcey8/SBaT2Asqkce0Q2q0 kQXJq6sAki+QzwbdGlll8KWC0BlcBIIYam/2HZwviw8f1y+BuLjXgQ+Q0N+xLuETz6U8 VNchDnVH6z4czzGQjdwncbqPyn4KQ/C+N5ZYHFmjMwt1W93FtquV7EmFnvPHbm5CA+yI F/rK549irkyqosGvhQ4Eji5e5VRQZyUvtOISyXEhBmPRSmkNvllgOOLoP/r/Gswtrwmk z6Sue/D10i367EJGYa9w5iUbAa68QIclo4/Hgee7O5+U7LVUUcGNWPa0gK6804gWOy8p l7tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XHlsMepz; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=fpkqDSsC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020aa78432000000b0064d2f7f1622si1298403pfn.68.2023.05.19.02.33.30; Fri, 19 May 2023 02:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XHlsMepz; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=fpkqDSsC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbjESJcA (ORCPT + 99 others); Fri, 19 May 2023 05:32:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbjESJbi (ORCPT ); Fri, 19 May 2023 05:31:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75EF319A for ; Fri, 19 May 2023 02:31:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 306C9222AD; Fri, 19 May 2023 09:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684488696; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HpltZXyn7IFUsWYubb3YXnbYdNZhgEiIMwEl6o8+pfI=; b=XHlsMepz9Ecz5V3B5jMYmkMAhmrpWcTfpzRCSnLhpsK52nMLN4v/exslyBR4xYO5WBZ1oa XYtp1dHj53CyNtaBWTSRUWu6I3E4B2sB78mqY2M5tL9/MXyIw7NwsgizZGTEAG2QkKNpx0 rhFEXW/1l8YJZigqMFZShcRdIDIbzWw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684488696; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HpltZXyn7IFUsWYubb3YXnbYdNZhgEiIMwEl6o8+pfI=; b=fpkqDSsCF6U/EotfWEZ2rlrvzm2cr5QeZMRvJe2C5H4t5OH817O1OMas25Z0AgDEP65Te+ j/os724xbF0dw3DQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0E93713A12; Fri, 19 May 2023 09:31:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OFO6APhBZ2RXJAAAMHmgww (envelope-from ); Fri, 19 May 2023 09:31:36 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 10/36] ALSA: usb-audio: Trim superfluous "MIDI" suffix from UMP EP name Date: Fri, 19 May 2023 11:30:48 +0200 Message-Id: <20230519093114.28813-11-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230519093114.28813-1-tiwai@suse.de> References: <20230519093114.28813-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A single USB audio device may have multiple interfaces for different purposes (e.g. audio, MIDI and HID), where the iInterface descriptor of each interface may contain an own suffix, e.g. "MIDI" for a MIDI interface. as such a suffix is superfluous as a rawmidi and UMP Endpoint name, this patch trims the superfluous "MIDI" suffix from the name string. Signed-off-by: Takashi Iwai --- sound/usb/midi2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c index 2ac3f96216bc..790e4cd5d35c 100644 --- a/sound/usb/midi2.c +++ b/sound/usb/midi2.c @@ -896,7 +896,14 @@ static int set_altset(struct snd_usb_midi2_interface *umidi) static void fill_ump_ep_name(struct snd_ump_endpoint *ump, struct usb_device *dev, int id) { + int len; + usb_string(dev, id, ump->info.name, sizeof(ump->info.name)); + + /* trim superfluous "MIDI" suffix */ + len = strlen(ump->info.name); + if (len > 5 && !strcmp(ump->info.name + len - 5, " MIDI")) + ump->info.name[len - 5] = 0; } /* fill the fallback name string for each rawmidi instance */ -- 2.35.3