Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp108129iob; Tue, 17 May 2022 20:27:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcO25VJsbZLIJFyrNVLRZh1mg5XcUrZF+2WaXNSEvvdymVgi4JwqyWGziYeBTl7eb9mo+j X-Received: by 2002:a17:90a:bb16:b0:1de:fd98:94c5 with SMTP id u22-20020a17090abb1600b001defd9894c5mr24297669pjr.48.1652844432388; Tue, 17 May 2022 20:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652844432; cv=none; d=google.com; s=arc-20160816; b=FdyPb0qkmbeAT5gmDyOxkeAK9rHoVAGN8ZcKBAaOLdLEdCp0XvCYiP4zduNFCA+9M/ 0e4sGIeWDCDUCBoclPkr5+KTWnJgeorUpTn/D6GPu4W/G346SM5kauJ9Ox/ebMmgT+AY q6/P5ff0Km8P7nOirPsVVGRat/HJPWjuQXIHEKkc1MH3rq1tOu1sZ97pBqV8wgCbgjAm NgWaZdLB+usuzMAnwp1mzIUVJHR7CP1tYQw5YqTcTI+XVVhhxsP8+i5uC2dh6NY6Q75Z Z7TVR3zUXGtgJVeAt30hzmAFmrc/J7ClhtzNx03FH+mAWqYxtuXiRUTyX3KrPA9Kc8kE sWFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ASve5iJ6i7F2owTsmYDJeNs5wGbbjbewXF+807/AbRY=; b=Ph3FFwDqpvMQ7o/1aM8Az9kLrB+6+ie3vssojiwvR1/5fTo1w8SImRTNSFEzVweJMw kGjHo+5R0r5gXN6VgBWo7WhXdeA5tONYJoLkUvb7SLqGZCk18pzzMNvnm2piVK/a0B9T t6+uT5kyhjEN6Q64TmgMtzqFWGoRX3fuWhGhHGoYPKm+j3JnWo+orjkR+HHoEpG+B38U cBKSSb5SO3f7sjLmmkvzMtawRKsS/6YJZrDCAd7IcD5CEXYcZDKFIlgcSG+Rrbz4bDba AT3l69asGCApbMRraHmHEaCZ4vom/Mxhjhxc1b9nW0lUV/fZk8W4WB+u1n56Xd3B/rZe v8+A== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q17-20020a056a00089100b0050612d816e7si1816428pfj.104.2022.05.17.20.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 20:27:12 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4CB4B65D13; Tue, 17 May 2022 20:22:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350088AbiEQQqp (ORCPT + 99 others); Tue, 17 May 2022 12:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232954AbiEQQqn (ORCPT ); Tue, 17 May 2022 12:46:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AE9FD4D27B; Tue, 17 May 2022 09:46:42 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E1001042; Tue, 17 May 2022 09:46:42 -0700 (PDT) Received: from [10.57.82.55] (unknown [10.57.82.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CFD8E3F718; Tue, 17 May 2022 09:46:40 -0700 (PDT) Message-ID: <0da188fa-efd8-62d0-2ea6-5a8e0c286cb5@arm.com> Date: Tue, 17 May 2022 17:46:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] media: hantro: fix compatible string deprecation warning Content-Language: en-GB To: Martin Kepplinger , ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <20220517143521.1670663-1-martin.kepplinger@puri.sm> From: Robin Murphy In-Reply-To: <20220517143521.1670663-1-martin.kepplinger@puri.sm> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-05-17 15:35, Martin Kepplinger wrote: > of_device_is_compatible() in the end uses strlen of the string > for comparison, so in this case, the condition is true even if > the requested string "nxp,imx8mq-vpu-g1" is being used. The first > chars containing "nxp,imx8mq-vpu" are the same. Have you seen this go wrong in practice? AFAICS, unless you're on SPARC, which seems somewhat unlikely for an i.MX8 peripheral, of_compat_cmp() should map to strcasecmp(), which should do the right thing :/ Robin. > Fix this by encoding what the comment says. > > Signed-off-by: Martin Kepplinger > --- > > This is more of a bugreport as the solution doesn't look very elegant > to me. I'm happy for advice. > > thanks, > martin > > > drivers/staging/media/hantro/hantro_drv.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c > index ac232b5f7825..014fab637df0 100644 > --- a/drivers/staging/media/hantro/hantro_drv.c > +++ b/drivers/staging/media/hantro/hantro_drv.c > @@ -923,10 +923,11 @@ static int hantro_probe(struct platform_device *pdev) > > /* > * Support for nxp,imx8mq-vpu is kept for backwards compatibility > - * but it's deprecated. Please update your DTS file to use > - * nxp,imx8mq-vpu-g1 or nxp,imx8mq-vpu-g2 instead. > + * but it's deprecated. > */ > - if (of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu")) > + if ((of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu")) && > + (!of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu-g1")) && > + (!of_device_is_compatible(pdev->dev.of_node, "nxp,imx8mq-vpu-g2"))) > dev_warn(&pdev->dev, "%s compatible is deprecated\n", > match->compatible); >