From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 562FB17C7C2 for ; Tue, 13 Aug 2024 09:41:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723542091; cv=none; b=hpNcukhBQBDhoF8/F6lvQsCSsbhw2b22WAnK14lfR/W/Hf7GAqMuaAnnRStHEXoeueddIBH5DArkRriJYrUWB2Sk1q4/sUtsFFVAvc7wYbWqrsGgXEp12KuKMYYnI0iQPZDkoRWKyZEq7TIurkcJxlWWiKrZ8/0vdwMirDKUiog= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723542091; c=relaxed/simple; bh=GowZfBUArZDrThXkpk1uy4u6pTSdlwhoXMcs/PPonto=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IA4x+cP2DAXj2nhBE/CpytRYAYqd5BTDUCBlIIUjm3uw+kYAE8ZJSZWd1mPz49pwHeyZzH9AHrlLJTDhhyiEB/xejkKl/TdXi7no53McASCemgGqAAv1smW+a8GYki+RMJw2KkiqamPZD/dr4j4BgKtkjO5xClN7KaAWcayUsQM= 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=Aes8Por/; arc=none smtp.client-ip=209.85.167.52 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="Aes8Por/" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5314c6dbaa5so4559828e87.2 for ; Tue, 13 Aug 2024 02:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723542087; x=1724146887; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=eItjPGBQyvpJiWnOn46lnVpGsIhUMx1VDP+7wHZATso=; b=Aes8Por/VM2IqllsAZT5nQL76L2qzu0cNGSuqZtlJOYjI8fbvnMv1JMZRcq7Ompib3 Lb1q0SY8O6UkUIStf7ukbRjXrMXWItkyeMQzfuiLKSL35LtmVSJw8Q3zPTf+yN5c5kOY 2IpsyO7BN76aF1MwCw0L6c1u+fE9aC2pmmJ+fNd6IL2KITOAV75+hkDAcGIGKJKKXopA X1u2gCGaJCSKzwMGfVmam4C/UqWThwIMsk47yfQ5qozs6vjs3xSoYBc2KYDq08/XEtpY v9ubtKtYvseEYapkIDDocn0uTxZoWGB7ooUczVuZjxnYTsCBjSBoo2hzz1aB41q7xs21 ltaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723542087; x=1724146887; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eItjPGBQyvpJiWnOn46lnVpGsIhUMx1VDP+7wHZATso=; b=DZVUv36ZZLAzaCOkMGvR3Mcyx4Oo5jsDbzenveqv1J9J/o9RwVtwOHme2RmJGebo2X mXqKSWrGSAX5RGLUHBOTQl/vkM79tjo8QCfYf6XgY/Zu0EQXRmQm0NptecZWYCpxh/zd 09oaWBtyDKBzL4drR3jhxLJredGHJluOw0zOTL0MjsPbjSinzQ9ZZb6Tiy0LI/Y/vjqW GnnuLeCldAZRE+9qxrgKAghaiEq6CFr2ZdKnKEYlz/3k23hYnOW0QaQigBz6awVceZ4f TAel18cd+gHCjwvP/197aqWEupyLxcaQXVBjNb0PZ9HQ4p5TMl7bxLfSQ6hKslEd0N0D Mizg== X-Forwarded-Encrypted: i=1; AJvYcCU4k5XPTQ15FyiMh25xcSR6XqkLIvI3pC74KxfB9FIwUfkodcN+BPrVruO9+K5gxelAbSs+pyabT4ackAs=@vger.kernel.org X-Gm-Message-State: AOJu0YzjY3KMSeJbU7fCuyKyRsdcOLGm++RcyZjwL2IUzN9L4MYfGCY9 IbJ/yhX/d9nnFVTcSPbNijZ471xKwS7TbqYmIg4SNNedX1bJji9q X-Google-Smtp-Source: AGHT+IEmVGyzW4I6MImE67T9Pw4r0FlDQHXbCStVpUhgRs/dbKdieg8qONNaAYIQ0vAUOwy+lNnZvA== X-Received: by 2002:a05:6512:1088:b0:530:e1ee:d95 with SMTP id 2adb3069b0e04-5321364847emr2009121e87.1.1723542086719; Tue, 13 Aug 2024 02:41:26 -0700 (PDT) Received: from ?IPV6:2a10:a5c0:800d:dd00:8cfe:d6e7:6701:9dfd? ([2a10:a5c0:800d:dd00:8cfe:d6e7:6701:9dfd]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53200eb3c33sm967879e87.19.2024.08.13.02.41.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Aug 2024 02:41:26 -0700 (PDT) Message-ID: <0c68db10-5d3a-4fdb-ae7a-6465d17c0712@gmail.com> Date: Tue, 13 Aug 2024 12:41:24 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] irqdomain: Unify checks for bus_token To: Andy Shevchenko , Thomas Gleixner , linux-kernel@vger.kernel.org Cc: Herve Codina , Mark Brown References: <20240812193101.1266625-1-andriy.shevchenko@linux.intel.com> <20240812193101.1266625-2-andriy.shevchenko@linux.intel.com> Content-Language: en-US, en-GB From: Matti Vaittinen In-Reply-To: <20240812193101.1266625-2-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/12/24 22:29, Andy Shevchenko wrote: > The code uses if (bus_token) and if (bus_token == DOMAIN_BUS_ANY). > Since bus_token is enum, the later is more robust against changes. > Unify all checks to follow the latter variant. I don't really have a strong opinion on this but for me the if (bus_token) reads better. Te bus_token is either set (and set to something else but zero), or not. This logic is nicely reflected by the check 'if (bus_token)'. Still, I suppose the 'DOMAIN_BUS_ANY' is for a reason, and some people indeed claim that consistency matters ;) > Fixes: 0b21add71bd9 ("irqdomain: Handle domain bus token in irq_domain_create()") > Fixes: 1bf2c9282927 ("irqdomain: Cleanup domain name allocation") > Signed-off-by: Andy Shevchenko > --- > kernel/irq/irqdomain.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c > index 01001eb615ec..18d253e10e87 100644 > --- a/kernel/irq/irqdomain.c > +++ b/kernel/irq/irqdomain.c > @@ -130,8 +130,10 @@ EXPORT_SYMBOL_GPL(irq_domain_free_fwnode); > > static int alloc_name(struct irq_domain *domain, char *base, enum irq_domain_bus_token bus_token) > { > - domain->name = bus_token ? kasprintf(GFP_KERNEL, "%s-%d", base, bus_token) : > - kasprintf(GFP_KERNEL, "%s", base); > + if (bus_token == DOMAIN_BUS_ANY) > + domain->name = kasprintf(GFP_KERNEL, "%s", base); > + else > + domain->name = kasprintf(GFP_KERNEL, "%s-%d", base, bus_token); You could do: domain->name = bus_token == DOMAIN_BUS_ANY ? kasprintf(... to squeeze this a bit more compact (and to maintain the previous style) - but my personal preference is to not have a ternary. Well, again nothing I would have a really strong opinion. Anyways, the logic looks solid to me so, FWIW: Reviewed-by: Matti Vaittinen Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~