Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6651324imu; Wed, 14 Nov 2018 05:04:15 -0800 (PST) X-Google-Smtp-Source: AJdET5edQTp7vYY9CyKkhCo22YDGehCynktDvM73d1dg0fqQVnCjXcvBNB4o/9kIAWtO2t2heatX X-Received: by 2002:a63:81c7:: with SMTP id t190mr1676066pgd.393.1542200655413; Wed, 14 Nov 2018 05:04:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542200655; cv=none; d=google.com; s=arc-20160816; b=izERmdat11tKCOH4ZS6LpM6K+ydYk/pm8tGQu8fCijUk5YWjqqeaYO5C0D7skl66gI ub7jXFS2MwQq66UjF5XDRwg7U2rBvtkazhymrlC1QM7u9aIP4YneGordIcY0cr/sx2fX NXeifHIn/y59zUvj/OIw4D08Iv0o7sfkhy6pPueqfVVjwNeAy2myT0mI4ywyVcaNazh9 +MZfTdO6AI3vl5OSxjDfbB6yI5tkkXbDV8ed3n5ZGHcKCun48D0GkRuO/kRyMefGelCB jjzM7a4m+4f8cV7MUFO+YGlUlMLKN9PXhh31ADuVR7y3fLU2bFUN1wu8ggaVyWCFQM2Z uD1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8xFb2L+aRnABbXYjLUerTtbVrMMKBgvMpIuNKuT2CMs=; b=a3ZUhbUEWufl71S4lObekPvgI6a2cvv0zwZxsewgmKRdBeLfbPlWMIPTglA4b9JYls c277hFIatrcE8w7RzfExHaj3isMqHwXaVILvFd4nVZufKkrn+g2VfV4rg+DB3MpERPyk lyafxZv43lNN62r0ICNevYfTb3ge/E0r/AEInqiAd4aFp0TNGq/g7H4X34VdH8yuM8tQ onU8WDo7oTZB+ZD5MNw9SXwdQGbxDkluLyLryD10M1bRtHQvLLB2aJu62GyZ9IH0n9Jz LP31pvvx8rxBukrSHAoA7Uu3OzdfxqaMXJF22Qi7RpY6G2l91powHxuHMhAnUG5aHeJZ tIbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i198si9309736pfe.289.2018.11.14.05.03.58; Wed, 14 Nov 2018 05:04:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732565AbeKNXD1 (ORCPT + 99 others); Wed, 14 Nov 2018 18:03:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:44468 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728133AbeKNXD1 (ORCPT ); Wed, 14 Nov 2018 18:03:27 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D9B44B086; Wed, 14 Nov 2018 13:00:15 +0000 (UTC) From: Nicolas Saenz Julienne To: stefan.wahren@i2se.com, eric@anholt.net, dave.stevenson@raspberrypi.org Cc: linux-rpi-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne Subject: [PATCH 01/16] staging: vchiq_core: rework vchiq_get_config Date: Wed, 14 Nov 2018 13:59:27 +0100 Message-Id: <20181114125942.25163-2-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114125942.25163-1-nsaenzjulienne@suse.de> References: <20181114125942.25163-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function is overly complicated for what it's ultimately achieving. It's simply filling up a structure. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_arm.c | 12 ++++---- .../interface/vchiq_arm/vchiq_core.c | 30 +++++-------------- .../interface/vchiq_arm/vchiq_if.h | 3 +- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index ea789376de0f..6d503392341e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1480,13 +1480,11 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; break; } - status = vchiq_get_config(instance, args.config_size, &config); - if (status == VCHIQ_SUCCESS) { - if (copy_to_user((void __user *)args.pconfig, - &config, args.config_size) != 0) { - ret = -EFAULT; - break; - } + + vchiq_get_config(&config); + if (copy_to_user(args.pconfig, &config, args.config_size)) { + ret = -EFAULT; + break; } } break; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 7642ced31436..89f1ccdc3b98 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3583,28 +3583,14 @@ vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, short *peer_version) return status; } -VCHIQ_STATUS_T -vchiq_get_config(VCHIQ_INSTANCE_T instance, - int config_size, VCHIQ_CONFIG_T *pconfig) -{ - VCHIQ_CONFIG_T config; - - (void)instance; - - config.max_msg_size = VCHIQ_MAX_MSG_SIZE; - config.bulk_threshold = VCHIQ_MAX_MSG_SIZE; - config.max_outstanding_bulks = VCHIQ_NUM_SERVICE_BULKS; - config.max_services = VCHIQ_MAX_SERVICES; - config.version = VCHIQ_VERSION; - config.version_min = VCHIQ_VERSION_MIN; - - if (config_size > sizeof(VCHIQ_CONFIG_T)) - return VCHIQ_ERROR; - - memcpy(pconfig, &config, - min(config_size, (int)(sizeof(VCHIQ_CONFIG_T)))); - - return VCHIQ_SUCCESS; +void vchiq_get_config(VCHIQ_CONFIG_T *config) +{ + config->max_msg_size = VCHIQ_MAX_MSG_SIZE; + config->bulk_threshold = VCHIQ_MAX_MSG_SIZE; + config->max_outstanding_bulks = VCHIQ_NUM_SERVICE_BULKS; + config->max_services = VCHIQ_MAX_SERVICES; + config->version = VCHIQ_VERSION; + config->version_min = VCHIQ_VERSION_MIN; } VCHIQ_STATUS_T diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index e4109a83e628..87829a244465 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -164,8 +164,7 @@ extern VCHIQ_STATUS_T vchiq_bulk_receive_handle(VCHIQ_SERVICE_HANDLE_T service, extern int vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T service); extern void *vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T service); extern int vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T service); -extern VCHIQ_STATUS_T vchiq_get_config(VCHIQ_INSTANCE_T instance, - int config_size, VCHIQ_CONFIG_T *pconfig); +extern void vchiq_get_config(VCHIQ_CONFIG_T *config); extern VCHIQ_STATUS_T vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T service, VCHIQ_SERVICE_OPTION_T option, int value); -- 2.19.1