Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp44048pxu; Wed, 6 Jan 2021 20:43:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyF5b9AL3ss1Yfnv3AShmmTIsncWrwhdy/OSkZ0Ke/8Kbpj3YegdDeQa9nst5gj4CBRNaFe X-Received: by 2002:a17:906:3685:: with SMTP id a5mr4927555ejc.544.1609994638418; Wed, 06 Jan 2021 20:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609994638; cv=none; d=google.com; s=arc-20160816; b=QXq7YBIlVqfqCQNGV3nlu2srHK5ZUimcg3XJzJLvpnrzTvYV4bimDdV+rSdLjXjwMt Yadx2euxCqdoXNnynwvgtfBIYQDL9gkXXAJtt+/kL6/I9O2QhEfR4K8DaQMFiofMKt8t e4G+I1+UadQqZELwKUVkZvHbLYjV8f7CmmwoSo/35OcYEJc7K2Ii4QN78MUSLoHeP0RY FoZ4sNAOjPV8MfRyk8FfnexpJBQLlMG37QG1jSKUi8xN0/0K+g+hHDmqzf1xY7uTajho 3DJ4hD/G7LvREuC/HZk43JYlRm0Cw5mR7DvgregHHFRgc9AmbOVLU/pOdbPA12vRdNA1 xFFQ== 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; bh=qYbrm0ZiujLK1nLan2rBPbUudD/EAiQPvy8ngGQPV/c=; b=kVRbS/+F1/6QdblajJ55fSiY4jmT+oUBerr5EdpbcVMyRJAIx/ptBW3WMSG7ODU/LU s9sL0PQ53qlgIQT61xaMg2dkrR2a5oVTTxHa3at4hMJErEh0Kx1Sm6SS9hf3dLIFIUE5 /ulkng8Myj5derh3/0yzuuDK1tijZ81tynvNTFt1fT/hBEFdcC7f9mv7S68k2jZ5exaa JQBJsMoxAt7qwdTYvvKGt22GF+1eb6HgPbCb2AfJIUiov+U02Ic+VX8EWr5ehBnVsV2H d4byHllRitZuZwzUIh82O0L9YPwLo05bPOb5USlRsA+y0auFKPer/hJSfmsMKCoCCah3 ASKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si1864154eji.157.2021.01.06.20.43.35; Wed, 06 Jan 2021 20:43:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726929AbhAGEjH (ORCPT + 99 others); Wed, 6 Jan 2021 23:39:07 -0500 Received: from mail-pl1-f179.google.com ([209.85.214.179]:44188 "EHLO mail-pl1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbhAGEjG (ORCPT ); Wed, 6 Jan 2021 23:39:06 -0500 Received: by mail-pl1-f179.google.com with SMTP id r4so2838351pls.11; Wed, 06 Jan 2021 20:38:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qYbrm0ZiujLK1nLan2rBPbUudD/EAiQPvy8ngGQPV/c=; b=lGTZCP9WhIffsTlS9VVbxqAGfjvirwVP5SmtPDp9BdFLGpw+voei8Ls1V9Mum2w2fU 9aVuTqZoPRTwIi3sXE2DZP9sjES0mFK2TBdKgCF7dUO7CbwMb7d4ZqNU+NfpJq19C2O4 syUgngqcUaTni6LAn8urUbIFeuLLxz0YBqqWwGp689uMHmcXmZ+5GTBJ8bzau4yfYCi2 mxHdMkXuUJ/OWyLezra3KIKwbM26+39Ru8eiuy8ZrbIQqZtC0qlSqGCHjv1f374FV+xC oYayOvVXte81CYRahRsYYN8gDfIzbiiLpH/mV597pjI2ZUS3Oy+HTSXDpocSceV19bg8 VjPg== X-Gm-Message-State: AOAM531UcBLVvon1mBT2qmZ/w/KjvDSLRq7Azqv3HJyAhN2YZ3QKHlje Actu+DOPqUfSSKE4C/ZDyvY= X-Received: by 2002:a17:90a:df0d:: with SMTP id gp13mr7372759pjb.151.1609994305593; Wed, 06 Jan 2021 20:38:25 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id u12sm3871764pfn.88.2021.01.06.20.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 20:38:24 -0800 (PST) From: Moritz Fischer To: gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, moritzf@google.com, Moritz Fischer , Xu Yilun Subject: [PATCH 3/8] fpga: dfl: fix the definitions of type & feature_id for dfl devices Date: Wed, 6 Jan 2021 20:37:09 -0800 Message-Id: <20210107043714.991646-4-mdf@kernel.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210107043714.991646-1-mdf@kernel.org> References: <20210107043714.991646-1-mdf@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Yilun The value of the field dfl_device.type comes from the 12 bits register field DFH_ID according to DFL spec. So this patch changes the definition of the type field to u16. Also it is not necessary to illustrate the valid bits of the type field in comments. Instead we should explicitly define the possible values in the enumeration type for it, because they are shared by hardware spec. We should not let the compiler decide these values. Similar changes are also applied to dfl_device.feature_id. This patch also fixed the MODALIAS format according to the changes above. Signed-off-by: Xu Yilun Reviewed-by: Tom Rix Signed-off-by: Moritz Fischer --- drivers/fpga/dfl.c | 3 +-- drivers/fpga/dfl.h | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index b450870b75ed..5a6ba3b2fa05 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -298,8 +298,7 @@ static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { struct dfl_device *ddev = to_dfl_dev(dev); - /* The type has 4 valid bits and feature_id has 12 valid bits */ - return add_uevent_var(env, "MODALIAS=dfl:t%01Xf%03X", + return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X", ddev->type, ddev->feature_id); } diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h index 5dc758f655b7..ac373b1fcff9 100644 --- a/drivers/fpga/dfl.h +++ b/drivers/fpga/dfl.h @@ -520,19 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev, * enum dfl_id_type - define the DFL FIU types */ enum dfl_id_type { - FME_ID, - PORT_ID, + FME_ID = 0, + PORT_ID = 1, DFL_ID_MAX, }; /** * struct dfl_device_id - dfl device identifier - * @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. - * @feature_id: contains 12 bits feature identifier local to its DFL FIU type. + * @type: DFL FIU type of the device. See enum dfl_id_type. + * @feature_id: feature identifier local to its DFL FIU type. * @driver_data: driver specific data. */ struct dfl_device_id { - u8 type; + u16 type; u16 feature_id; unsigned long driver_data; }; @@ -543,7 +543,7 @@ struct dfl_device_id { * @dev: generic device interface. * @id: id of the dfl device. * @type: type of DFL FIU of the device. See enum dfl_id_type. - * @feature_id: 16 bits feature identifier local to its DFL FIU type. + * @feature_id: feature identifier local to its DFL FIU type. * @mmio_res: mmio resource of this dfl device. * @irqs: list of Linux IRQ numbers of this dfl device. * @num_irqs: number of IRQs supported by this dfl device. @@ -553,7 +553,7 @@ struct dfl_device_id { struct dfl_device { struct device dev; int id; - u8 type; + u16 type; u16 feature_id; struct resource mmio_res; int *irqs; -- 2.30.0