Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2402968rdb; Mon, 20 Nov 2023 09:48:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IET1hKdRyXywn01CpHbYH6zVPqgOnVKwAPzT2yBwvk1Qd7IiA37fzU6F25TlCgH1tjU1aTJ X-Received: by 2002:a05:6830:18d0:b0:6c4:e507:3747 with SMTP id v16-20020a05683018d000b006c4e5073747mr8211409ote.30.1700502481255; Mon, 20 Nov 2023 09:48:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502481; cv=none; d=google.com; s=arc-20160816; b=r2tDdRnUWdJSVHka1QzpULTFEFOANRoVLL5rOV0lPGDtSws0Q/+1BQIhcyFOFzakue z5APT2QPk97CR9qap3OdOZiMD+sbOZ0BQiAnL+LtsRFszwDNt7wDxymYAcY+5JxlyYno 6R9FhiHajRTbfdKXG5+zlnB5BHKyoUtbhyakzCR2w4E7GMMXZlFI7XU8H7oSzQKjNxce JhTm5wNTpbv1DtuWXeRhBnhb2DqkhSmw2PCmzvK6uIlw0gG8OSfwY2jI/+kS+ECBj9PE yYXO2eD5CXwhnAhaWyTjAIZ+GWKiwXuLddYxkln9RXICaRyox5J0yN1lW0t9bMapAuEi 8W4g== 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=BPwJyVhhexCZzbUP41lTNUU8tlh1YKVSoA80AxKe1yA=; fh=j4R8ciFJa/4UpvmdXkMw+9PvKvnYkU35E9g6S4Wcz68=; b=VksECdgmEVkrz0ipTShvxSdO+Uvslivq7KYA2ja+VY3ZzqBXWb2CM06EK3ucGI1dj3 pLs8TayCLJtipm3HKPWmBdJdJYIbiB6Ewf+iIecmor9gtUxUllSGFx4W9m6c2ts58kRN sEn8FVe+AuChAlLoFC8Owe3P/8zSJc66iP7jCK1NBqTElWVkyKfeFgtiBJChk6Xqth/W 2rrEeBEAM7BdK134jCzPktED6O3ieiA7S7r/qBIHfu5ATPXcqzObydaRZnlZ93l6wPW4 /Wc254gGWGva3xVSObQqMfAfSZh07gBkSMnYgJTrQnRD/7ukfohGtX281gFELOBLIysC 7LCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hn1cuqKD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k13-20020a63560d000000b005c215239071si6956536pgb.543.2023.11.20.09.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:48:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hn1cuqKD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9F94A802FA94; Mon, 20 Nov 2023 09:47:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232158AbjKTRrc (ORCPT + 99 others); Mon, 20 Nov 2023 12:47:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231136AbjKTRrb (ORCPT ); Mon, 20 Nov 2023 12:47:31 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54CE811C for ; Mon, 20 Nov 2023 09:47:27 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40a4848c6e1so15477725e9.1 for ; Mon, 20 Nov 2023 09:47:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700502446; x=1701107246; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BPwJyVhhexCZzbUP41lTNUU8tlh1YKVSoA80AxKe1yA=; b=hn1cuqKDewPGlGC0CKnX9RcqXiSOllL1UDJOAu6bWGLUMGKDzr58qxV9j8RcajRR/R bOLpXs7J/usWMQkByne191vlyDrU8Xxunzv1oKVFb9T8shiZA0guVUOjCSNQcowmCTru /DEeq6DVvYaeyTTWvurUc3WRweIOXArnuy+3c/7y7QUMJbIpwPGfWsjw59oqen5fIjVR F25AfQhFz13kjwzOKKvM8LPyFPZXvok41RDpPDEmSgkmZId0EfW3akjr8z2pfbZ9tVhu mwJpq/VQrAchFoN8CuZ764olktS3/vOO3KT1E9xkk7BzCyxtcta/OfIobdf67iCWxaMP vkHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700502446; x=1701107246; 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=BPwJyVhhexCZzbUP41lTNUU8tlh1YKVSoA80AxKe1yA=; b=VdWethUngQ2CO08/qkNeVfRMfOObWhm504LLXmPoGj338P8ZLqmJJCTwM2Tl3nJaB0 y7O8YFo2eotm7+muUvfd7y+6QOrbMiBY7pYNi0brbEkFWURnrapv2G5noDjUTYJjgvl6 OgrpClTzGAxCvnV2zW3BtFD+IDgP9S+iDsgCUy17upTv8QVTyqckThm0HPslUiOTcQOa dYoS+8ZxVu6bzFYWkSvaTGFVtbDSU2bh3KFUqPtCRzlnHqglTrE/YBV7jq9U3D36FC+o K+r7uQRWitGO/5Nqu+ednC7KebhZKdYRnXkSnrRPTcoOL3CvWkU9m6KWZc+EajBmFjGQ p8rg== X-Gm-Message-State: AOJu0YwgevRpbbwPURs1shiEXF8LhLfx57nnDD5WGASiNL97yNqWCfEm Z2CUZMD0tOPHwupKdlpdAfatKg== X-Received: by 2002:a05:600c:4707:b0:40a:6239:39b with SMTP id v7-20020a05600c470700b0040a6239039bmr6589583wmo.21.1700502445681; Mon, 20 Nov 2023 09:47:25 -0800 (PST) Received: from krzk-bin.. ([178.197.222.11]) by smtp.gmail.com with ESMTPSA id d19-20020adf9b93000000b003316eb9db40sm9595734wrc.51.2023.11.20.09.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:47:24 -0800 (PST) From: Krzysztof Kozlowski To: Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH] soundwire: stream: constify sdw_port_config when adding devices Date: Mon, 20 Nov 2023 18:47:20 +0100 Message-Id: <20231120174720.239610-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:47:50 -0800 (PST) sdw_stream_add_master() and sdw_stream_add_slave() do not modify contents of passed sdw_port_config, so it can be made const for code safety and as documentation of expected usage. Signed-off-by: Krzysztof Kozlowski --- drivers/soundwire/stream.c | 10 +++++----- include/linux/soundwire/sdw.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 69719b335bcb..9dc6399f206a 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -897,7 +897,7 @@ static struct sdw_port_runtime *sdw_port_alloc(struct list_head *port_list) } static int sdw_port_config(struct sdw_port_runtime *p_rt, - struct sdw_port_config *port_config, + const struct sdw_port_config *port_config, int port_index) { p_rt->ch_mask = port_config[port_index].ch_mask; @@ -970,7 +970,7 @@ static int sdw_slave_port_is_valid_range(struct device *dev, int num) static int sdw_slave_port_config(struct sdw_slave *slave, struct sdw_slave_runtime *s_rt, - struct sdw_port_config *port_config) + const struct sdw_port_config *port_config) { struct sdw_port_runtime *p_rt; int ret; @@ -1026,7 +1026,7 @@ static int sdw_master_port_alloc(struct sdw_master_runtime *m_rt, } static int sdw_master_port_config(struct sdw_master_runtime *m_rt, - struct sdw_port_config *port_config) + const struct sdw_port_config *port_config) { struct sdw_port_runtime *p_rt; int ret; @@ -1861,7 +1861,7 @@ EXPORT_SYMBOL(sdw_release_stream); */ int sdw_stream_add_master(struct sdw_bus *bus, struct sdw_stream_config *stream_config, - struct sdw_port_config *port_config, + const struct sdw_port_config *port_config, unsigned int num_ports, struct sdw_stream_runtime *stream) { @@ -1981,7 +1981,7 @@ EXPORT_SYMBOL(sdw_stream_remove_master); */ int sdw_stream_add_slave(struct sdw_slave *slave, struct sdw_stream_config *stream_config, - struct sdw_port_config *port_config, + const struct sdw_port_config *port_config, unsigned int num_ports, struct sdw_stream_runtime *stream) { diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 4f3d14bb1538..904004d8b562 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -1040,7 +1040,7 @@ int sdw_compute_params(struct sdw_bus *bus); int sdw_stream_add_master(struct sdw_bus *bus, struct sdw_stream_config *stream_config, - struct sdw_port_config *port_config, + const struct sdw_port_config *port_config, unsigned int num_ports, struct sdw_stream_runtime *stream); int sdw_stream_remove_master(struct sdw_bus *bus, @@ -1062,7 +1062,7 @@ void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id int sdw_stream_add_slave(struct sdw_slave *slave, struct sdw_stream_config *stream_config, - struct sdw_port_config *port_config, + const struct sdw_port_config *port_config, unsigned int num_ports, struct sdw_stream_runtime *stream); int sdw_stream_remove_slave(struct sdw_slave *slave, @@ -1084,7 +1084,7 @@ int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val); static inline int sdw_stream_add_slave(struct sdw_slave *slave, struct sdw_stream_config *stream_config, - struct sdw_port_config *port_config, + const struct sdw_port_config *port_config, unsigned int num_ports, struct sdw_stream_runtime *stream) { -- 2.34.1