From patchwork Tue Aug 27 02:52:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13778748 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 D844F175AB for ; Tue, 27 Aug 2024 02:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724726706; cv=none; b=AKs11BdQz9J/jAXvLml+T3uynPRLLbWb6WHFjMbJCABz/YG3D0gQzRGTjvZ742ElxWNlvVR5Tc8jh838j/25haVwNLLHc9gQElOakh6Q3SZwxQUwYLscGfMDJ1wno75UuKcKhBoQCJAmmVWqASI1AMiHajBytInqEKkt9qYs8r8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724726706; c=relaxed/simple; bh=Ul9iJUX23pdklvWim5EAP6jDRbMEQ+YSQOKACCo8WGc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GDWcBEknXFwVgeVTI9sdNRWt2D3i18A24D7Gcy/cHrZCD0zau4kvvkSEh3DUo6zTFbdAC9hk6KPcLCANUOblLYRVNXje9OnjdUa6ZpYtC06+coznEWQQwqX0EfH2RhcFOT4VcbPoT/EZKBVRNvb2XqMRxHrI8Q6RSFd0f2f24kA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4WtBfr31Jzz1xvNc; Tue, 27 Aug 2024 10:43:00 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 78DAF140154; Tue, 27 Aug 2024 10:44:57 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 27 Aug 2024 10:44:57 +0800 From: Hongbo Li To: , , , , , CC: , Subject: [PATCH net-next v2 1/2] net/ncsi: Use str_up_down to simplify the code Date: Tue, 27 Aug 2024 10:52:45 +0800 Message-ID: <20240827025246.963115-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240827025246.963115-1-lihongbo22@huawei.com> References: <20240827025246.963115-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500022.china.huawei.com (7.185.36.66) X-Patchwork-Delegate: kuba@kernel.org As str_up_down is the common helper to reback "up/down" string, we can replace the target with it to simplify the code and fix the coccinelle warning. Signed-off-by: Hongbo Li --- net/ncsi/ncsi-manage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 5ecf611c8820..13b4d393fb2d 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -1281,7 +1281,7 @@ static int ncsi_choose_active_channel(struct ncsi_dev_priv *ndp) netdev_dbg(ndp->ndev.dev, "NCSI: Channel %u added to queue (link %s)\n", nc->id, - ncm->data[2] & 0x1 ? "up" : "down"); + str_up_down(ncm->data[2] & 0x1)); } spin_unlock_irqrestore(&nc->lock, cflags); From patchwork Tue Aug 27 02:52:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13778747 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 AF81211185 for ; Tue, 27 Aug 2024 02:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724726701; cv=none; b=oYDZCLLSydcopc3TjHcYjcRHxIvXWwg0HL3meJB/xXZL7kDQPChaTfUI0ocS3mA/eh+SOJOPltWUDbvWLiWYuxPsSu+Y/FG/T46qIbmnxBc6+PloXsU/CYfVdlIWE+STSyFykIKJxIoSaqgdlGhaS+PlHEynHDynuUcieOrHHtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724726701; c=relaxed/simple; bh=h2UukjmGU0/aG4gaa+uCHV7OpV88skuBkXYcNYUxV3g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RayoTSU9Z7Mokm4ogxQGhiU1v9nFbUoHUv7w2UJsCJTbW+ZGJqVwP+kb7MPvoaq0U/rWDyCb5UX160P6rqxYGetooqQ589S07RshOB4Zd6DZqRCwNBOMKqIsEix58ktT1Xzav2OHOK//kJ0sbtfWSse7gLHPJnBRHLwyx+jVs6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WtBfk2gJdzfbYx; Tue, 27 Aug 2024 10:42:54 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id A04091402DE; Tue, 27 Aug 2024 10:44:57 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 27 Aug 2024 10:44:57 +0800 From: Hongbo Li To: , , , , , CC: , Subject: [PATCH net-next v2 2/2] net/ncsi: Use str_up_down to simplify the code Date: Tue, 27 Aug 2024 10:52:46 +0800 Message-ID: <20240827025246.963115-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240827025246.963115-1-lihongbo22@huawei.com> References: <20240827025246.963115-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500022.china.huawei.com (7.185.36.66) X-Patchwork-Delegate: kuba@kernel.org As str_up_down is the common helper to reback "up/down" string, we can replace the target with it to simplify the code and fix the coccinelle warning. Signed-off-by: Hongbo Li --- net/ncsi/ncsi-aen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-aen.c b/net/ncsi/ncsi-aen.c index 62fb1031763d..25814f06d7da 100644 --- a/net/ncsi/ncsi-aen.c +++ b/net/ncsi/ncsi-aen.c @@ -75,7 +75,7 @@ static int ncsi_aen_handler_lsc(struct ncsi_dev_priv *ndp, has_link = !!(data & 0x1); netdev_dbg(ndp->ndev.dev, "NCSI: LSC AEN - channel %u state %s\n", - nc->id, data & 0x1 ? "up" : "down"); + nc->id, str_up_down(data & 0x1)); chained = !list_empty(&nc->link); state = nc->state;