From patchwork Tue Dec 20 17:56:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 35153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3102522wrn; Tue, 20 Dec 2022 09:58:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXujacBpbAsQmyFGcrZy6nmxTB2ohnAqN30oTPUbZBuKYzvn+U9iSeBPWt06MbkrJNrxWleZ X-Received: by 2002:a17:906:3a09:b0:82f:ba57:f806 with SMTP id z9-20020a1709063a0900b0082fba57f806mr5643450eje.23.1671559099678; Tue, 20 Dec 2022 09:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671559099; cv=none; d=google.com; s=arc-20160816; b=KaRHZWmH/7btOoF88mK/L5c11UEUAeV5/N2jNXOYD4UHOdx5ZTzSbY6bOIwsJ1OWGU ++P0Xk8cHXJVOkNruYyqN+ND7NlINbJ6MG+2NG+UstdSIYq+4IQk8Cm5Ov2hlZS+GYyS trNqRl6ehaDosIszwlDdHtm8KQVcyvIB37dT6SlOhWtISlPZJtk1cQLDg5UOx0z3C01j UAlaIDeAjHNDxvCB0uGe7dIm0IxE8Yj+RdFdf2xEvyDRM9RlWpDCwdL9HhBh7y7GwIPE H14eOQvKRnKSCYbnycwKXBflGfUIjs+qwDZc3ymfpwwxaT67YWwfNhLiSSuJFSJuWSP8 DfMw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Unl6QfwtHEjfkMdy1Yw/MGc3MT3pIvqz7ripxlsDJwM=; b=k3qCIAFbt/lr96ibu8Vq82bJSfcQSBoQ/7+Q3uckP79bVPgrIvqy17OAQNPu7radyB lVy55Z3ddsKy20xBNjavdGowX9pr7cyLoQShkRwdj62EscB7TgTftCSGvAi5sWXHm7PN ZQYRe5nXCqqmLpYaZL3KYsBBaX38DqauIrsfNxra/kpsoYMjlLgCgsRQc/RnJYwlF3Nv IblOT3svOELtND79m1YtXkGVwuMfAeueraU8QHJA/zL8ypG9+z1lVLV9m4wiWlY2NHka YZMJ5WIfWNXBz9EQuOUMQS55lLBLRzmOQaBqjsicklMTn8mWIJGy03oF2IX11iXcv89n 1ebw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EJ1/cehc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu9-20020a170906eec900b007c164256d90si853651ejb.638.2022.12.20.09.57.55; Tue, 20 Dec 2022 09:58:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EJ1/cehc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233462AbiLTR4e (ORCPT + 99 others); Tue, 20 Dec 2022 12:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbiLTR4a (ORCPT ); Tue, 20 Dec 2022 12:56:30 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28D51DFDC; Tue, 20 Dec 2022 09:56:28 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id bx10so12570503wrb.0; Tue, 20 Dec 2022 09:56:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Unl6QfwtHEjfkMdy1Yw/MGc3MT3pIvqz7ripxlsDJwM=; b=EJ1/cehcjfRl7EyInh5Z/uLfXOFn4tMBnMQQ6rcV4YHol8i34pvIst2Ahka5JldZaP lgVnL2M95Kx7ZtPmQOiOxQrdK43tDxqmZzIJ812UKMFrrOiNznIlnm/GaQjLBl+/8DV+ ap27LBUVSlFidCzIIR8b7smAgZrmeNOmkjq7ypf+LfWlhNxBaTIX8190o8X7xLv8B/8a KfD6Y/OQ5F/pPuEo5+VmjXfIvpoW0oPYALDh51UTtJeshDp6JLpuALDQKJnj4f513YgC 97yryLVIiNobqGU5OyKP0oScWZiHPoMCcTcWjZSpv5Q8hTni76Fm9/WtO8fwkmWo/hzS Tnww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Unl6QfwtHEjfkMdy1Yw/MGc3MT3pIvqz7ripxlsDJwM=; b=eVRh/+00BlvApbIGihanaj4p3yLmTKHwURf24BOg873Co/DnNst9UBNV8P1aGRj/sU XQp4ajO9eeyzkgKGECO6CT2N3oErHTkEG7I+B8ZbfE3YGw0Lsp9aoOGLLHbO7F/oUFP1 KUnPlvMze5Vn0EY6ZOWEZCRtyuL/niJuHB5Nmq+kTq4BO2lX/ksd4rHmKSw8z/5h+Y98 qqsYFudn3Xc2mTLV8EC87gykyUyK0pWsuWv8hiaueBJxaWB/jmreezJbcWZdOmJXKIIm bOyBQvernTvRR22GupEsy1pOj0PoWPU6ZFrc2ZzxQvrzxPV/e30Cr0Z7Lpy/m21Dr+8n NK0g== X-Gm-Message-State: ANoB5pnoFDUEqwcon/sr2by1yvf5a3JX4JGZQ7cdQW4Me2lucvRGDkhZ c9TfZMpgEzDSl7KZArujMchFfbHihEk= X-Received: by 2002:a5d:40c1:0:b0:242:81da:f3c3 with SMTP id b1-20020a5d40c1000000b0024281daf3c3mr30834520wrq.63.1671558987030; Tue, 20 Dec 2022 09:56:27 -0800 (PST) Received: from xws.localdomain ([194.126.177.41]) by smtp.gmail.com with ESMTPSA id u18-20020adfeb52000000b002423dc3b1a9sm13206300wrn.52.2022.12.20.09.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 09:56:26 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] platform/surface: aggregator: Add missing call to ssam_request_sync_free() Date: Tue, 20 Dec 2022 18:56:07 +0100 Message-Id: <20221220175608.1436273-1-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752756754399942976?= X-GMAIL-MSGID: =?utf-8?q?1752756754399942976?= Although rare, ssam_request_sync_init() can fail. In that case, the request should be freed via ssam_request_sync_free(). Currently it is leaked instead. Fix this. Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") Signed-off-by: Maximilian Luz --- drivers/platform/surface/aggregator/controller.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c index 43e765199137..c6537a1b3a2e 100644 --- a/drivers/platform/surface/aggregator/controller.c +++ b/drivers/platform/surface/aggregator/controller.c @@ -1700,8 +1700,10 @@ int ssam_request_sync(struct ssam_controller *ctrl, return status; status = ssam_request_sync_init(rqst, spec->flags); - if (status) + if (status) { + ssam_request_sync_free(rqst); return status; + } ssam_request_sync_set_resp(rqst, rsp); From patchwork Tue Dec 20 17:56:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 35155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3103601wrn; Tue, 20 Dec 2022 10:00:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7UNbvMQ7YaEooJM2soLKCjuBmLDZEueC6359E6UZxA6oVci09G0BBFXHqHDym5yzmbWsXm X-Received: by 2002:a17:906:c2cc:b0:7c0:f118:624b with SMTP id ch12-20020a170906c2cc00b007c0f118624bmr40500005ejb.44.1671559251367; Tue, 20 Dec 2022 10:00:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671559251; cv=none; d=google.com; s=arc-20160816; b=z8zTVfgrclF+wN59HrbU8xDJDsUXlY6+fXt7v22EL0BMThFzH75VW2sWXll3ZYAAE+ +wNqQou+pdKBD0DoorbXfXXingZ57EZNmMWmcuAfA1FKklV6+Xaf+v1ge/F/9eWXV0vQ BzDamoPsRRwy2ykJnESEZCk1MPMH6Dgi/LufiPojzd7i6FSeUqhv8cfVvmiw9I/nznce AKQLY6TZKcu6wzt9jmEBGbemlKtkxrW9xiGmfe5rF4y14uFzI2bFSzLynEOoHWzLnaZz nUbcYH+ufQA2dEJnIDm1IkwwN80Sq4K5X8fY5JvEWzXRjy1QCuys9AfLakdbZ6gxZ/e9 VB+A== 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 :dkim-signature; bh=5kJi60gyNl4vOWh2qkNjesWcj3F4raPrJ4zGZO5DkXA=; b=rG9U9mQkTq0f2J26PKU2dMnf/yiRWvb2U0XvVUmuoqoSJN8IZ7TGaFPu5NLcCzaVIJ wYTXMgVRmCf+OlF8Gi0b8ZpLR+wRGAEr2VCHz0gDEtRiPbqsctYenCW0CdDwPjepKWxX +/vbTfPTB5pYrdjmmK+3McP8/b2msFFYpRjj0ygyKHqtmuYc0qwK0KpLOJ5YGbiho8f7 cToZdMtpGzc6jY3ySBd/HUVXZLLeAbdbHplWl6xYRIJs2WgJKOj4h9STQk3JEvVaRbED hRaNC5Kp51w5Qqg9EeA26He+wDI3Z41lJC7kmDGz2Hm+eZsg+rPcTJDA9hBmdItQ3T5n jMLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e8iBypxU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb22-20020a1709077e9600b007e08e2619e7si10311095ejc.860.2022.12.20.10.00.28; Tue, 20 Dec 2022 10:00:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e8iBypxU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233911AbiLTR4p (ORCPT + 99 others); Tue, 20 Dec 2022 12:56:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233117AbiLTR4c (ORCPT ); Tue, 20 Dec 2022 12:56:32 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5870D113E; Tue, 20 Dec 2022 09:56:30 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id m5-20020a7bca45000000b003d2fbab35c6so9435155wml.4; Tue, 20 Dec 2022 09:56:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5kJi60gyNl4vOWh2qkNjesWcj3F4raPrJ4zGZO5DkXA=; b=e8iBypxUZgZtcbEL8EpvF8Ss/jFWdwfW1yDuM/JzslzL4vf+RQqb6QfNaD57Aa1E1L 0NsLJCrdUj948YpvKboR/gTf/apbQAWMJz8zRdfE2X2yWa6p8yWmgJlaQEfBWtd5tL5o KksM3nsHyY6Vif2vibFKVzwoX4A5G3jYiJky7Hq1d9YQLk9WUQ8HOZFJjUY3350dJbap 4B5/uz8q/KCYCnjF1p0zHj2HJirQv3oVtuL4hH+YyPkMkui41k3VM6D2vJPR6H4fNDvO vwBfCu4BFUCuK2/wzjPUXrJsiMMBXXwr9uIL7Soho7n+fX1r9E5GsQVkUV/JFvHRtzfd Xkyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5kJi60gyNl4vOWh2qkNjesWcj3F4raPrJ4zGZO5DkXA=; b=kF8CSArNXY8Kc2geXelJ4OAxaHvWEJ0zEoakIeeYgdQhWEWhaKQ4OmHVFKIku4cBDs LgGUR45NNwfWUqXI08w7JUckwNoROwuIlivAWd4MH98PseEkT3vvlYkSHqi9PmXsSn07 dLFRUcDn8QK65dMZQqK8p+vieNziomypTZjDMP55pBpNy/vpgdiQN9QZ+i6Py4yqTzud 7Ly/cNBI2cqDDSBw4zPWl0CGKJQVl0c9pXxUelCN7QFNini9JLhH47e8kQb3lq2WQ8cW iJGq+VuJlb1UmcH0CRUWHlKk0vbYVtf6ebZTf8sAe4qcjvinOaML03QpIjjumOvf7nIO e/xA== X-Gm-Message-State: AFqh2kqMSflEcwNOZhIDmHSoO8ECNcyVsgOGGyM5nqNopc3b4Gooau52 3Ibe8f4GuQCrRdRt2/pASDY= X-Received: by 2002:a05:600c:3ba5:b0:3d5:3ab1:d630 with SMTP id n37-20020a05600c3ba500b003d53ab1d630mr2391276wms.8.1671558988473; Tue, 20 Dec 2022 09:56:28 -0800 (PST) Received: from xws.localdomain ([194.126.177.41]) by smtp.gmail.com with ESMTPSA id u18-20020adfeb52000000b002423dc3b1a9sm13206300wrn.52.2022.12.20.09.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 09:56:27 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , Jiri Kosina , Benjamin Tissoires , Jonathan Corbet , platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] platform/surface: aggregator: Rename top-level request functions to avoid ambiguities Date: Tue, 20 Dec 2022 18:56:08 +0100 Message-Id: <20221220175608.1436273-2-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221220175608.1436273-1-luzmaximilian@gmail.com> References: <20221220175608.1436273-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752756913554819731?= X-GMAIL-MSGID: =?utf-8?q?1752756913554819731?= We currently have a struct ssam_request_sync and a function ssam_request_sync(). While this is valid C, there are some downsides to it. One of these is that current Sphinx versions (>= 3.0) cannot disambiguate between the two (see disucssion and pull request linked below). It instead emits a "WARNING: Duplicate C declaration" and links for the struct and function in the resulting documentation link to the same entry (i.e. both to either function or struct documentation) instead of their respective own entries. While we could just ignore that and wait for a fix, there's also a point to be made that the current naming can be somewhat confusing when searching (e.g. via grep) or trying to understand the levels of abstraction at play: We currently have struct ssam_request_sync and associated functions ssam_request_sync_[alloc|free|init|wait|...]() operating on this struct. However, function ssam_request_sync() is one abstraction level above this. Similarly, ssam_request_sync_with_buffer() is not a function operating on struct ssam_request_sync, but rather a sibling to ssam_request_sync(), both using the struct under the hood. Therefore, rename the top level request functions: ssam_request_sync() -> ssam_request_do_sync() ssam_request_sync_with_buffer() -> ssam_request_do_sync_with_buffer() ssam_request_sync_onstack() -> ssam_request_do_sync_onstack() Link: https://lore.kernel.org/all/085e0ada65c11da9303d07e70c510dc45f21315b.1656756450.git.mchehab@kernel.org/ Link: https://github.com/sphinx-doc/sphinx/pull/8313 Signed-off-by: Maximilian Luz --- .../driver-api/surface_aggregator/client.rst | 8 +-- drivers/hid/surface-hid/surface_hid.c | 6 +- drivers/hid/surface-hid/surface_kbd.c | 6 +- drivers/platform/surface/aggregator/bus.c | 6 +- .../platform/surface/aggregator/controller.c | 32 +++++------ .../platform/surface/surface_acpi_notify.c | 2 +- .../surface/surface_aggregator_cdev.c | 6 +- .../surface/surface_aggregator_tabletsw.c | 2 +- include/linux/surface_aggregator/controller.h | 56 +++++++++---------- include/linux/surface_aggregator/device.h | 8 +-- 10 files changed, 66 insertions(+), 66 deletions(-) diff --git a/Documentation/driver-api/surface_aggregator/client.rst b/Documentation/driver-api/surface_aggregator/client.rst index 27f95abdbe99..dd96f8eb6578 100644 --- a/Documentation/driver-api/surface_aggregator/client.rst +++ b/Documentation/driver-api/surface_aggregator/client.rst @@ -19,7 +19,7 @@ .. |ssam_notifier_unregister| replace:: :c:func:`ssam_notifier_unregister` .. |ssam_device_notifier_register| replace:: :c:func:`ssam_device_notifier_register` .. |ssam_device_notifier_unregister| replace:: :c:func:`ssam_device_notifier_unregister` -.. |ssam_request_sync| replace:: :c:func:`ssam_request_sync` +.. |ssam_request_do_sync| replace:: :c:func:`ssam_request_do_sync` .. |ssam_event_mask| replace:: :c:type:`enum ssam_event_mask ` @@ -209,12 +209,12 @@ data received from it is converted from little-endian to host endianness. * with the SSAM_REQUEST_HAS_RESPONSE flag set in the specification * above. */ - status = ssam_request_sync(ctrl, &rqst, &resp); + status = ssam_request_do_sync(ctrl, &rqst, &resp); /* * Alternatively use * - * ssam_request_sync_onstack(ctrl, &rqst, &resp, sizeof(arg_le)); + * ssam_request_do_sync_onstack(ctrl, &rqst, &resp, sizeof(arg_le)); * * to perform the request, allocating the message buffer directly * on the stack as opposed to allocation via kzalloc(). @@ -230,7 +230,7 @@ data received from it is converted from little-endian to host endianness. return status; } -Note that |ssam_request_sync| in its essence is a wrapper over lower-level +Note that |ssam_request_do_sync| in its essence is a wrapper over lower-level request primitives, which may also be used to perform requests. Refer to its implementation and documentation for more details. diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c index d4aa8c81903a..bcb6ffd0e6ff 100644 --- a/drivers/hid/surface-hid/surface_hid.c +++ b/drivers/hid/surface-hid/surface_hid.c @@ -80,7 +80,7 @@ static int ssam_hid_get_descriptor(struct surface_hid_device *shid, u8 entry, u8 rsp.length = 0; - status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, + status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(*slice)); if (status) return status; @@ -131,7 +131,7 @@ static int ssam_hid_set_raw_report(struct surface_hid_device *shid, u8 rprt_id, buf[0] = rprt_id; - return ssam_retry(ssam_request_sync, shid->ctrl, &rqst, NULL); + return ssam_retry(ssam_request_do_sync, shid->ctrl, &rqst, NULL); } static int ssam_hid_get_raw_report(struct surface_hid_device *shid, u8 rprt_id, u8 *buf, size_t len) @@ -151,7 +151,7 @@ static int ssam_hid_get_raw_report(struct surface_hid_device *shid, u8 rprt_id, rsp.length = 0; rsp.pointer = buf; - return ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(rprt_id)); + return ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(rprt_id)); } static u32 ssam_hid_event_fn(struct ssam_event_notifier *nf, const struct ssam_event *event) diff --git a/drivers/hid/surface-hid/surface_kbd.c b/drivers/hid/surface-hid/surface_kbd.c index 0635341bc517..7ca8038026ce 100644 --- a/drivers/hid/surface-hid/surface_kbd.c +++ b/drivers/hid/surface-hid/surface_kbd.c @@ -49,7 +49,7 @@ static int ssam_kbd_get_descriptor(struct surface_hid_device *shid, u8 entry, u8 rsp.length = 0; rsp.pointer = buf; - status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(entry)); + status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(entry)); if (status) return status; @@ -75,7 +75,7 @@ static int ssam_kbd_set_caps_led(struct surface_hid_device *shid, bool value) rqst.length = sizeof(value_u8); rqst.payload = &value_u8; - return ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, NULL, sizeof(value_u8)); + return ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, NULL, sizeof(value_u8)); } static int ssam_kbd_get_feature_report(struct surface_hid_device *shid, u8 *buf, size_t len) @@ -97,7 +97,7 @@ static int ssam_kbd_get_feature_report(struct surface_hid_device *shid, u8 *buf, rsp.length = 0; rsp.pointer = buf; - status = ssam_retry(ssam_request_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(payload)); + status = ssam_retry(ssam_request_do_sync_onstack, shid->ctrl, &rqst, &rsp, sizeof(payload)); if (status) return status; diff --git a/drivers/platform/surface/aggregator/bus.c b/drivers/platform/surface/aggregator/bus.c index de539938896e..7004eb4a63a2 100644 --- a/drivers/platform/surface/aggregator/bus.c +++ b/drivers/platform/surface/aggregator/bus.c @@ -136,9 +136,9 @@ int ssam_device_add(struct ssam_device *sdev) * is always valid and can be used for requests as long as the client * device we add here is registered as child under it. This essentially * guarantees that the client driver can always expect the preconditions - * for functions like ssam_request_sync (controller has to be started - * and is not suspended) to hold and thus does not have to check for - * them. + * for functions like ssam_request_do_sync() (controller has to be + * started and is not suspended) to hold and thus does not have to check + * for them. * * Note that for this to work, the controller has to be a parent device. * If it is not a direct parent, care has to be taken that the device is diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c index c6537a1b3a2e..9c43b9665a2c 100644 --- a/drivers/platform/surface/aggregator/controller.c +++ b/drivers/platform/surface/aggregator/controller.c @@ -1674,7 +1674,7 @@ int ssam_request_sync_submit(struct ssam_controller *ctrl, EXPORT_SYMBOL_GPL(ssam_request_sync_submit); /** - * ssam_request_sync() - Execute a synchronous request. + * ssam_request_do_sync() - Execute a synchronous request. * @ctrl: The controller via which the request will be submitted. * @spec: The request specification and payload. * @rsp: The response buffer. @@ -1686,9 +1686,9 @@ EXPORT_SYMBOL_GPL(ssam_request_sync_submit); * * Return: Returns the status of the request or any failure during setup. */ -int ssam_request_sync(struct ssam_controller *ctrl, - const struct ssam_request *spec, - struct ssam_response *rsp) +int ssam_request_do_sync(struct ssam_controller *ctrl, + const struct ssam_request *spec, + struct ssam_response *rsp) { struct ssam_request_sync *rqst; struct ssam_span buf; @@ -1722,10 +1722,10 @@ int ssam_request_sync(struct ssam_controller *ctrl, ssam_request_sync_free(rqst); return status; } -EXPORT_SYMBOL_GPL(ssam_request_sync); +EXPORT_SYMBOL_GPL(ssam_request_do_sync); /** - * ssam_request_sync_with_buffer() - Execute a synchronous request with the + * ssam_request_do_sync_with_buffer() - Execute a synchronous request with the * provided buffer as back-end for the message buffer. * @ctrl: The controller via which the request will be submitted. * @spec: The request specification and payload. @@ -1738,17 +1738,17 @@ EXPORT_SYMBOL_GPL(ssam_request_sync); * SSH_COMMAND_MESSAGE_LENGTH() macro can be used to compute the required * message buffer size. * - * This function does essentially the same as ssam_request_sync(), but instead - * of dynamically allocating the request and message data buffer, it uses the - * provided message data buffer and stores the (small) request struct on the - * heap. + * This function does essentially the same as ssam_request_do_sync(), but + * instead of dynamically allocating the request and message data buffer, it + * uses the provided message data buffer and stores the (small) request struct + * on the heap. * * Return: Returns the status of the request or any failure during setup. */ -int ssam_request_sync_with_buffer(struct ssam_controller *ctrl, - const struct ssam_request *spec, - struct ssam_response *rsp, - struct ssam_span *buf) +int ssam_request_do_sync_with_buffer(struct ssam_controller *ctrl, + const struct ssam_request *spec, + struct ssam_response *rsp, + struct ssam_span *buf) { struct ssam_request_sync rqst; ssize_t len; @@ -1772,7 +1772,7 @@ int ssam_request_sync_with_buffer(struct ssam_controller *ctrl, return status; } -EXPORT_SYMBOL_GPL(ssam_request_sync_with_buffer); +EXPORT_SYMBOL_GPL(ssam_request_do_sync_with_buffer); /* -- Internal SAM requests. ------------------------------------------------ */ @@ -1864,7 +1864,7 @@ static int __ssam_ssh_event_request(struct ssam_controller *ctrl, result.length = 0; result.pointer = &buf; - status = ssam_retry(ssam_request_sync_onstack, ctrl, &rqst, &result, + status = ssam_retry(ssam_request_do_sync_onstack, ctrl, &rqst, &result, sizeof(params)); return status < 0 ? status : buf; diff --git a/drivers/platform/surface/surface_acpi_notify.c b/drivers/platform/surface/surface_acpi_notify.c index 50500e562963..897cdd9c3aae 100644 --- a/drivers/platform/surface/surface_acpi_notify.c +++ b/drivers/platform/surface/surface_acpi_notify.c @@ -590,7 +590,7 @@ static acpi_status san_rqst(struct san_data *d, struct gsb_buffer *buffer) return san_rqst_fixup_suspended(d, &rqst, buffer); } - status = __ssam_retry(ssam_request_sync_onstack, SAN_REQUEST_NUM_TRIES, + status = __ssam_retry(ssam_request_do_sync_onstack, SAN_REQUEST_NUM_TRIES, d->ctrl, &rqst, &rsp, SAN_GSB_MAX_RQSX_PAYLOAD); if (!status) { diff --git a/drivers/platform/surface/surface_aggregator_cdev.c b/drivers/platform/surface/surface_aggregator_cdev.c index 492c82e69182..07f0ed658369 100644 --- a/drivers/platform/surface/surface_aggregator_cdev.c +++ b/drivers/platform/surface/surface_aggregator_cdev.c @@ -302,8 +302,8 @@ static long ssam_cdev_request(struct ssam_cdev_client *client, struct ssam_cdev_ * theoretical maximum (SSH_COMMAND_MAX_PAYLOAD_SIZE) of the * underlying protocol (note that nothing remotely this size * should ever be allocated in any normal case). This size is - * validated later in ssam_request_sync(), for allocation the - * bound imposed by u16 should be enough. + * validated later in ssam_request_do_sync(), for allocation + * the bound imposed by u16 should be enough. */ spec.payload = kzalloc(spec.length, GFP_KERNEL); if (!spec.payload) { @@ -342,7 +342,7 @@ static long ssam_cdev_request(struct ssam_cdev_client *client, struct ssam_cdev_ } /* Perform request. */ - status = ssam_request_sync(client->cdev->ctrl, &spec, &rsp); + status = ssam_request_do_sync(client->cdev->ctrl, &spec, &rsp); if (status) goto out; diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c index 27d95a6a7851..c3a5b7f56c8f 100644 --- a/drivers/platform/surface/surface_aggregator_tabletsw.c +++ b/drivers/platform/surface/surface_aggregator_tabletsw.c @@ -382,7 +382,7 @@ static int ssam_pos_get_sources_list(struct ssam_tablet_sw *sw, struct ssam_sour rsp.length = 0; rsp.pointer = (u8 *)sources; - status = ssam_retry(ssam_request_sync_onstack, sw->sdev->ctrl, &rqst, &rsp, 0); + status = ssam_retry(ssam_request_do_sync_onstack, sw->sdev->ctrl, &rqst, &rsp, 0); if (status) return status; diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h index d11a1c6e3186..350d6c6c0a1d 100644 --- a/include/linux/surface_aggregator/controller.h +++ b/include/linux/surface_aggregator/controller.h @@ -207,17 +207,17 @@ static inline int ssam_request_sync_wait(struct ssam_request_sync *rqst) return rqst->status; } -int ssam_request_sync(struct ssam_controller *ctrl, - const struct ssam_request *spec, - struct ssam_response *rsp); +int ssam_request_do_sync(struct ssam_controller *ctrl, + const struct ssam_request *spec, + struct ssam_response *rsp); -int ssam_request_sync_with_buffer(struct ssam_controller *ctrl, - const struct ssam_request *spec, - struct ssam_response *rsp, - struct ssam_span *buf); +int ssam_request_do_sync_with_buffer(struct ssam_controller *ctrl, + const struct ssam_request *spec, + struct ssam_response *rsp, + struct ssam_span *buf); /** - * ssam_request_sync_onstack - Execute a synchronous request on the stack. + * ssam_request_do_sync_onstack - Execute a synchronous request on the stack. * @ctrl: The controller via which the request is submitted. * @rqst: The request specification. * @rsp: The response buffer. @@ -227,7 +227,7 @@ int ssam_request_sync_with_buffer(struct ssam_controller *ctrl, * fully initializes it via the provided request specification, submits it, * and finally waits for its completion before returning its status. This * helper macro essentially allocates the request message buffer on the stack - * and then calls ssam_request_sync_with_buffer(). + * and then calls ssam_request_do_sync_with_buffer(). * * Note: The @payload_len parameter specifies the maximum payload length, used * for buffer allocation. The actual payload length may be smaller. @@ -235,12 +235,12 @@ int ssam_request_sync_with_buffer(struct ssam_controller *ctrl, * Return: Returns the status of the request or any failure during setup, i.e. * zero on success and a negative value on failure. */ -#define ssam_request_sync_onstack(ctrl, rqst, rsp, payload_len) \ +#define ssam_request_do_sync_onstack(ctrl, rqst, rsp, payload_len) \ ({ \ u8 __data[SSH_COMMAND_MESSAGE_LENGTH(payload_len)]; \ struct ssam_span __buf = { &__data[0], ARRAY_SIZE(__data) }; \ \ - ssam_request_sync_with_buffer(ctrl, rqst, rsp, &__buf); \ + ssam_request_do_sync_with_buffer(ctrl, rqst, rsp, &__buf); \ }) /** @@ -349,7 +349,7 @@ struct ssam_request_spec_md { * zero on success and negative on failure. The ``ctrl`` parameter is the * controller via which the request is being sent. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_N(name, spec...) \ @@ -366,7 +366,7 @@ struct ssam_request_spec_md { rqst.length = 0; \ rqst.payload = NULL; \ \ - return ssam_request_sync_onstack(ctrl, &rqst, NULL, 0); \ + return ssam_request_do_sync_onstack(ctrl, &rqst, NULL, 0); \ } /** @@ -389,7 +389,7 @@ struct ssam_request_spec_md { * parameter is the controller via which the request is sent. The request * argument is specified via the ``arg`` pointer. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_W(name, atype, spec...) \ @@ -406,8 +406,8 @@ struct ssam_request_spec_md { rqst.length = sizeof(atype); \ rqst.payload = (u8 *)arg; \ \ - return ssam_request_sync_onstack(ctrl, &rqst, NULL, \ - sizeof(atype)); \ + return ssam_request_do_sync_onstack(ctrl, &rqst, NULL, \ + sizeof(atype)); \ } /** @@ -430,7 +430,7 @@ struct ssam_request_spec_md { * the controller via which the request is sent. The request's return value is * written to the memory pointed to by the ``ret`` parameter. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_R(name, rtype, spec...) \ @@ -453,7 +453,7 @@ struct ssam_request_spec_md { rsp.length = 0; \ rsp.pointer = (u8 *)ret; \ \ - status = ssam_request_sync_onstack(ctrl, &rqst, &rsp, 0); \ + status = ssam_request_do_sync_onstack(ctrl, &rqst, &rsp, 0); \ if (status) \ return status; \ \ @@ -491,7 +491,7 @@ struct ssam_request_spec_md { * request argument is specified via the ``arg`` pointer. The request's return * value is written to the memory pointed to by the ``ret`` parameter. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_WR(name, atype, rtype, spec...) \ @@ -514,7 +514,7 @@ struct ssam_request_spec_md { rsp.length = 0; \ rsp.pointer = (u8 *)ret; \ \ - status = ssam_request_sync_onstack(ctrl, &rqst, &rsp, sizeof(atype)); \ + status = ssam_request_do_sync_onstack(ctrl, &rqst, &rsp, sizeof(atype)); \ if (status) \ return status; \ \ @@ -550,7 +550,7 @@ struct ssam_request_spec_md { * parameter is the controller via which the request is sent, ``tid`` the * target ID for the request, and ``iid`` the instance ID. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_MD_N(name, spec...) \ @@ -567,7 +567,7 @@ struct ssam_request_spec_md { rqst.length = 0; \ rqst.payload = NULL; \ \ - return ssam_request_sync_onstack(ctrl, &rqst, NULL, 0); \ + return ssam_request_do_sync_onstack(ctrl, &rqst, NULL, 0); \ } /** @@ -592,7 +592,7 @@ struct ssam_request_spec_md { * ``tid`` the target ID for the request, and ``iid`` the instance ID. The * request argument is specified via the ``arg`` pointer. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_MD_W(name, atype, spec...) \ @@ -609,7 +609,7 @@ struct ssam_request_spec_md { rqst.length = sizeof(atype); \ rqst.payload = (u8 *)arg; \ \ - return ssam_request_sync_onstack(ctrl, &rqst, NULL, \ + return ssam_request_do_sync_onstack(ctrl, &rqst, NULL, \ sizeof(atype)); \ } @@ -635,7 +635,7 @@ struct ssam_request_spec_md { * the target ID for the request, and ``iid`` the instance ID. The request's * return value is written to the memory pointed to by the ``ret`` parameter. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_MD_R(name, rtype, spec...) \ @@ -658,7 +658,7 @@ struct ssam_request_spec_md { rsp.length = 0; \ rsp.pointer = (u8 *)ret; \ \ - status = ssam_request_sync_onstack(ctrl, &rqst, &rsp, 0); \ + status = ssam_request_do_sync_onstack(ctrl, &rqst, &rsp, 0); \ if (status) \ return status; \ \ @@ -698,7 +698,7 @@ struct ssam_request_spec_md { * The request argument is specified via the ``arg`` pointer. The request's * return value is written to the memory pointed to by the ``ret`` parameter. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_MD_WR(name, atype, rtype, spec...) \ @@ -722,7 +722,7 @@ struct ssam_request_spec_md { rsp.length = 0; \ rsp.pointer = (u8 *)ret; \ \ - status = ssam_request_sync_onstack(ctrl, &rqst, &rsp, sizeof(atype)); \ + status = ssam_request_do_sync_onstack(ctrl, &rqst, &rsp, sizeof(atype)); \ if (status) \ return status; \ \ diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h index 46c45d1b6368..0e353f5cc2e6 100644 --- a/include/linux/surface_aggregator/device.h +++ b/include/linux/surface_aggregator/device.h @@ -456,7 +456,7 @@ static inline int ssam_device_register_clients(struct ssam_device *sdev) * device of the request and by association the controller via which the * request is sent. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_CL_N(name, spec...) \ @@ -490,7 +490,7 @@ static inline int ssam_device_register_clients(struct ssam_device *sdev) * which the request is sent. The request's argument is specified via the * ``arg`` pointer. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_CL_W(name, atype, spec...) \ @@ -524,7 +524,7 @@ static inline int ssam_device_register_clients(struct ssam_device *sdev) * the request is sent. The request's return value is written to the memory * pointed to by the ``ret`` parameter. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_CL_R(name, rtype, spec...) \ @@ -560,7 +560,7 @@ static inline int ssam_device_register_clients(struct ssam_device *sdev) * specified via the ``arg`` pointer. The request's return value is written to * the memory pointed to by the ``ret`` parameter. * - * Refer to ssam_request_sync_onstack() for more details on the behavior of + * Refer to ssam_request_do_sync_onstack() for more details on the behavior of * the generated function. */ #define SSAM_DEFINE_SYNC_REQUEST_CL_WR(name, atype, rtype, spec...) \