From nobody Wed Dec 17 17:25:00 2025 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26262205E3C for ; Tue, 2 Jul 2024 21:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719957520; cv=none; b=WtS9KVxzP+pJFPgYTj6hn4QmtS0mIRzOaG+lrN4dLlQ72F+9dvcJT8AgAGh92YQPPVfwED6F+5KWz1OF2IlTZEciuStibDKINmQfLcjn2BfnAfDyT3NKcGa5dlMsCmoRHDM3xYkYVPVJYjkcyXdX9aTAD6BFfE/ZTV8X1lQ1KEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719957520; c=relaxed/simple; bh=icwqeywsyrttsSDlGtVX51FXgI87DPMODzf+SUKMTJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bwMUvcPN2HKujvbe8QZE94HMHFp7mTWtVe9Qb+vho5mgdZA5trncpWWyBDFMVpDraZOrnoy6NNVwHJCyCHD0HoLc4lqjleFT3lkEpiemvU18SMOaav7ZpJt3lhFEoja0JIkToMw3hfCJ4DK3R/1EBWyzSwFyZeDOyWVxN3rReeg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CDUKS2oB; arc=none smtp.client-ip=209.85.166.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CDUKS2oB" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-7f65715fe2cso34945439f.0 for ; Tue, 02 Jul 2024 14:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719957518; x=1720562318; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xowWZ+ekpberKm26oOQ15iL0A2hZa3GfKHRI1+lg3PY=; b=CDUKS2oBC3O0yTIFkaPKK8EADDkiMmo6xQZYmnYMNZAF55W9sPMo1cwiFGJwZVdi/z g3LTHIBlUDE8zOlT0p+yyZAvTWwVDKNSVcrWeRvJd/4yOeyka6WJsphjxtGH+c9Ju3o9 L8GsBQyjRc7S0Nvhw+BBfNwUEQxvKdmt1e12VeKjBjfTLVHiJ1jb7WcIRYlLOO34dKT7 zFBl/Q3fHvzKVW2wzNI36xZevFOiw4xq0k79ucAWVhE7stIxA4JwYG695pL6HbrtfVcH rnOE+ls+m1LDyH4P4A/egmDtS85khtFwm6SGMSv3JfCGefEnDYrN8g2iNK7x1QWnk8RK SZ6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719957518; x=1720562318; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xowWZ+ekpberKm26oOQ15iL0A2hZa3GfKHRI1+lg3PY=; b=n1bMz9gPd0SZClK6xM9CpnlOwF5x3IKAFwebx+kUsESlhSzAe+q+i0ORZt7hEb+iX3 jB+Yw0vW1Dsbrtf2gvV8AHHaflrhutcd99nppYzWyVc3QwjyCHV+5Vrw7V3XOHxdagjj rpEgmrfDvppIik5hSWH+LFnCze0QjZKeoVSpTXz7vGLHKz/LTHNoTOmy9CAQfkWdj24U XGoLNQBZNkc7nfdSC5P3abWLYvwOO8ichC1JVw7JY094OGxUGH9HilfqgYfvb7WxKSMR uNzfkQpiTHHu8byiVx99fXutDx+rQIjnZspGIhXdnsF/Ip3ihK1IHHsH96fZ/rxs5obR dNsA== X-Gm-Message-State: AOJu0YzyIzad+dpybtKhfxOPdyJew072z7QWe4VHWul5r9xMEls1bwLw OPH8/XFpaaoSwhHCzO3ecgRq7IDb5BVDNs6+h63DIxopjhfgE7DK X-Google-Smtp-Source: AGHT+IFEGPMJ0Jh14wpvUFc2djetIH1c1nAPVR9FTMSLomEU1MSc3gn/62MyPuGbMB621f76l28FXg== X-Received: by 2002:a05:6602:2bfa:b0:7f3:d731:c6df with SMTP id ca18e2360f4ac-7f62ee501eamr1142864839f.10.1719957518165; Tue, 02 Jul 2024 14:58:38 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id ca18e2360f4ac-7f61d207fcesm279944739f.51.2024.07.02.14.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 14:58:37 -0700 (PDT) From: Jim Cromie To: daniel.vetter@ffwll.ch, tvrtko.ursulin@linux.intel.com, jani.nikula@intel.com, ville.syrjala@linux.intel.com, jbaron@akamai.com, gregkh@linuxfoundation.org, ukaszb@chromium.org Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux@rasmusvillemoes.dk, joe@perches.com, mcgrof@kernel.org, Jim Cromie Subject: [PATCH v9 19/52] dyndbg: treat comma as a token separator Date: Tue, 2 Jul 2024 15:57:09 -0600 Message-ID: <20240702215804.2201271-20-jim.cromie@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702215804.2201271-1-jim.cromie@gmail.com> References: <20240702215804.2201271-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Treat comma as a token terminator, just like a space. This allows a user to avoid quoting hassles when spaces are otherwise needed: :#> modprobe drm dyndbg=3Dclass,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p or as a boot arg: drm.dyndbg=3Dclass,DRM_UT_CORE,+p # todo: support multi-query here Given the many ways a boot-line +args can be assembled and then passed in/down/around shell based tools, this may allow side-stepping all sorts of quoting hassles thru those layers. existing query format: modprobe test_dynamic_debug dyndbg=3D"class D2_CORE +p" new format: modprobe test_dynamic_debug dyndbg=3Dclass,D2_CORE,+p Signed-off-by: Jim Cromie Co-developed-by: =C5=81ukasz Bartosik Signed-off-by: =C5=81ukasz Bartosik --- lib/dynamic_debug.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e9a95b0f3757..235d85765b63 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -290,6 +290,14 @@ static int ddebug_change(const struct ddebug_query *qu= ery, return nfound; } =20 +static char *skip_spaces_and_commas(const char *str) +{ + str =3D skip_spaces(str); + while (*str =3D=3D ',') + str =3D skip_spaces(++str); + return (char *)str; +} + /* * Split the buffer `buf' into space-separated words. * Handles simple " and ' quoting, i.e. without nested, @@ -303,8 +311,8 @@ static int ddebug_tokenize(char *buf, char *words[], in= t maxwords) while (*buf) { char *end; =20 - /* Skip leading whitespace */ - buf =3D skip_spaces(buf); + /* Skip leading whitespace and comma */ + buf =3D skip_spaces_and_commas(buf); if (!*buf) break; /* oh, it was trailing whitespace */ if (*buf =3D=3D '#') @@ -320,7 +328,7 @@ static int ddebug_tokenize(char *buf, char *words[], in= t maxwords) return -EINVAL; /* unclosed quote */ } } else { - for (end =3D buf; *end && !isspace(*end); end++) + for (end =3D buf; *end && !isspace(*end) && *end !=3D ','; end++) ; if (end =3D=3D buf) { pr_err("parse err after word:%d=3D%s\n", nwords, @@ -592,7 +600,8 @@ static int ddebug_exec_queries(char *query, const char = *modname) if (split) *split++ =3D '\0'; =20 - query =3D skip_spaces(query); + query =3D skip_spaces_and_commas(query); + if (!query || !*query || *query =3D=3D '#') continue; =20 --=20 2.45.2