Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp56875lqt; Wed, 5 Jun 2024 17:14:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+uWFhsBQ2LoTHNf7dI0FWtmJsBV3JpwcghBnwlASceNOVNGmwn2bquMXPrNR65wV2w5a597mQGdzgZjrb9J4petCPHqcTk7RhzGiqbA== X-Google-Smtp-Source: AGHT+IGYJfYyFvp2+OsM23WNlv8zrdBP8PxfLAbkzyxcnlCtu4B1EgIfxYyACL7FDfLaMYHeYoFZ X-Received: by 2002:a50:cc9e:0:b0:57a:6eb4:101a with SMTP id 4fb4d7f45d1cf-57a8bcc43c5mr2885669a12.39.1717632888665; Wed, 05 Jun 2024 17:14:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717632888; cv=pass; d=google.com; s=arc-20160816; b=X9vg/w0/JjlGsOFyQrEEvWQGAnVQaxVY5ZORf2pZTOWTeCp+S7O2M1pM6Fzc55iREd el+uDcIrGM51tvyc3zvAORGfFTzMH2ub2YAGgXeXFZwUIUfOb6QuRhdGBBvCaSCAyRn/ OQIAxkLWevUaKpn8Utp7AztWJhnalTbJ6kJUZmPl/tzzSVcEWryZusG5bcJUOkE2vN9E 6ZC/srCg3+ixCxyJGVGGBqH4EzIliu9+uIjmEXQbFE5ZHzKyQP+hQFX3vKNW4GiBi5qY WTq/bZO+Qtng6uPzGZws0EOVrFFvJXtV/iHEgAnFKK8cNN13DpLlRGoliginLKCj3s3X /Gxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=bWof0tvW+gB1Bs1dWeYtyZYYo8ZfFi7RpvNi77t2sIw=; fh=5EQyDiYgg+kua2A2AF9eJME8jasrrRA/Pgg86y+lzvY=; b=wAfhnYO5qsY9s1q4sxjKwnh1yEpSwM3m0f8KnWdJo4KJa7RBwBuf2Fj7djYdRl2EFI XJ7nHZDM/Pb+X0OOZaisYB6ZArNaiSVok18AEcrCQrGsHB1jEkR9jPIfO76V5z5cJzx1 qBTvYT4ZvDCemrHOkMutMc0M8/pdbJaDs3Er1Srt71O3+nunidQ179mveyvQiUeZTLMt +1YR43g57xtJiFQH9PuUSuryoIY7L/Dt8bCSajPg/zT+V4MhStQkZHeofP0OFkeU2PFn YSp3jx32WdZNl/WfJXNaAk6BLwPjwJDjpiBJbgFdgDWGzzsi1bM3CwXln0H8vKuJ6p2n 345w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=ZchT7BhK; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=OsebbhZq; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-203425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203425-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae0c769dsi88061a12.1.2024.06.05.17.14.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 17:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=ZchT7BhK; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=OsebbhZq; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-203425-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203425-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3C3CB1F2577B for ; Wed, 5 Jun 2024 23:53:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A77616D9AC; Wed, 5 Jun 2024 23:52:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="ZchT7BhK"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OsebbhZq" Received: from wfhigh5-smtp.messagingengine.com (wfhigh5-smtp.messagingengine.com [64.147.123.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D955516C864 for ; Wed, 5 Jun 2024 23:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.156 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717631532; cv=none; b=BnPJsC80s2xWEcKWmgZ4zGxo8cAwkrern2CrOkbzJoMFTNT6knzg8UCneVwGc8Z9kC0Y1BolJONTTlnvzIB/fy7zf4DFzGWDRzIdNMgooFg0Wc8rTG2ya+aiEDZKG0kcmy1oGCMZlQDQp4PXap4L6Lf+FOAHU23m5uYeGypO/sI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717631532; c=relaxed/simple; bh=CcTJ2hXsAQcrYr0T8FwNXmr1zWjQFOatTtsGZ7PucoU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DVCLY//zUSTykIgTiOlrOMr2kF+7iE/Rd5KQRWYYDNjLf3zawv0fGSIzYxGHXKNpNqxo/DTkw7xInKUXkA2/DEpmfyXCx3UkTtteUgZWrdOVq69nRvvgtWGH0kVIK1dkHcphJQR3fmXu7pK3eVmuB6TpA5ON7gsph2Yd01B9Z+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=ZchT7BhK; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=OsebbhZq; arc=none smtp.client-ip=64.147.123.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.west.internal (Postfix) with ESMTP id EF056180012C; Wed, 5 Jun 2024 19:52:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 05 Jun 2024 19:52:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1717631528; x= 1717717928; bh=bWof0tvW+gB1Bs1dWeYtyZYYo8ZfFi7RpvNi77t2sIw=; b=Z chT7BhKOt27y3TKOHYIUMg0hooTAw2Uyqkf3nlGn3wTe8Bv60tQSC4rr7gIwMYX6 b3WoYDZPzQTRh9wTbBFNZ3fbPuRWA8WygjlcXGCnIear2oA5PwYsNQuY3Aqbjwg0 IZsZziYRrzNCzOMbyndGchTuiHGML6UsslxfP7tLuPe7DB/vgeJixmJHNT+J49t2 YP9Nl95hRFEwigziM/nJqwrYrVnYTBC05FlGyMpZ5cmd+i99KrGBJkGTvnH6g6xN W7MS1TqLn87jKQTTmRAL6mpVqdba6GgR7Dh7TMJ4kVq0ciIb0FZjZ78pRj7/te0N OvxEkjmBxKuJZds/V5WJQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717631528; x= 1717717928; bh=bWof0tvW+gB1Bs1dWeYtyZYYo8ZfFi7RpvNi77t2sIw=; b=O sebbhZqZXNcq3iVeTaH+nChpBD1mTI8Sq7uOOv10+bxDC1DJYKlfDwqVoqrx1pjK p7z2uBCnUUERHbAbjN5nmidcaCjAgSRGO8N5UWp1oZHD/cr6k6+JpdQ/6pVWrASN 3g/suDQ49X7Gem5COz0EIRxYRmT8w05wgg5dzEU+dFMqHdmR+VDb4ux6Ktee8/DQ CkLTRoHCOLuD9YejUHaf+3tD19MCCD5Xfn9kqt5DLY1SqWfaBDeaUpLnHIa1d7Io W28sFtxQNf08SQj9T6ZeUB/G4XBghqEGEWIxhC933DadP2ldrcWacOEqAXkrrv3U nslMoR+enev1SuJqGZAQQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeljedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Jun 2024 19:52:07 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [PATCH 04/11] firewire: ohci: minor code refactoring for self ID logging Date: Thu, 6 Jun 2024 08:51:48 +0900 Message-ID: <20240605235155.116468-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605235155.116468-1-o-takashi@sakamocchi.jp> References: <20240605235155.116468-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Current implementation to log self ID sequence has the rest to be refactored; e.g. moving translation-unit level variables to the dependent block. This commit is for the purpose. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index f6de0b3a9a55..0ef76cf7b328 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -437,22 +437,21 @@ static void log_irqs(struct fw_ohci *ohci, u32 evt) ? " ?" : ""); } -static const char *speed[] = { - [0] = "S100", [1] = "S200", [2] = "S400", [3] = "beta", -}; -static const char *power[] = { - [0] = "+0W", [1] = "+15W", [2] = "+30W", [3] = "+45W", - [4] = "-3W", [5] = " ?W", [6] = "-3..-6W", [7] = "-3..-10W", -}; -static const char port[] = { '.', '-', 'p', 'c', }; - -static char _p(u32 *s, int shift) +static unsigned int _p(u32 *s, int shift) { - return port[*s >> shift & 3]; + return *s >> shift & 3; } static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count) { + static const char *const speed[] = { + [0] = "S100", [1] = "S200", [2] = "S400", [3] = "beta", + }; + static const char *const power[] = { + [0] = "+0W", [1] = "+15W", [2] = "+30W", [3] = "+45W", + [4] = "-3W", [5] = " ?W", [6] = "-3..-6W", [7] = "-3..-10W", + }; + static const char port[] = { '.', '-', 'p', 'c', }; u32 *s; if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS))) @@ -465,7 +464,10 @@ static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count) if ((*s & 1 << 23) == 0) ohci_notice(ohci, "selfID 0: %08x, phy %d [%c%c%c] %s gc=%d %s %s%s%s\n", - *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2), + *s, *s >> 24 & 63, + port[_p(s, 6)], + port[_p(s, 4)], + port[_p(s, 2)], speed[*s >> 14 & 3], *s >> 16 & 63, power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "", *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : ""); @@ -473,8 +475,14 @@ static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count) ohci_notice(ohci, "selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n", *s, *s >> 24 & 63, - _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10), - _p(s, 8), _p(s, 6), _p(s, 4), _p(s, 2)); + port[_p(s, 16)], + port[_p(s, 14)], + port[_p(s, 12)], + port[_p(s, 10)], + port[_p(s, 8)], + port[_p(s, 6)], + port[_p(s, 4)], + port[_p(s, 2)]); } static const char *evts[] = { -- 2.43.0