Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2531146rdb; Fri, 22 Sep 2023 00:59:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHWf5rO1zVoVFJcznLXGS07gH6MErDHjPue/dcxMbdOCuTNOlu2jXYmQKEJUOeLChBFm1RG X-Received: by 2002:a67:ebc1:0:b0:452:707c:3f73 with SMTP id y1-20020a67ebc1000000b00452707c3f73mr7625599vso.3.1695369574783; Fri, 22 Sep 2023 00:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695369574; cv=none; d=google.com; s=arc-20160816; b=fdVCO3bP/sSrzXuRYxpM6JGawi6zBlmJ3PtgbrwcCk0XHE78uBU3i6ALu75k5P4zim kKilHqUZmHv1tJg7n1szylgkGmCpD6S9cj+zsem/D+vSlWqAeFv0kh44yKRO6JZ64REU cYmcUA3zX/w6SfHzad5rCj0RwMjSbyhU3URleQx0JKEs+khSnpUHNDWZmUvvgrKyyjGy 3wCFCAXTHS+j536H4KV1I4Kq9km1vS7yoKQvN8xFY8elKYYML8QLM8S35mOWt9H5+t9k kL0d4wn0jn/YVWO5bLiDUd8WZh7OinVie8fw9DMHljzz9Osv7wIEez9RD5kQiYpSfH9l pGhA== 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=slQGgC+n3mHwJljnWEkqFB/RwirQhAxYjwE0dRVLlYw=; fh=ejZKMPXw/wpgIkBgg4R8fhS2jsJTspCs9srLwjcCwrU=; b=zZo2Awh4ie0yuvSqdFooH8GnTXHZcvV1nvNnegGJbH7BJryR3WHUp949AtN1v9Tt9t Pxeu+lwjU4aabkeoyzl9HUIaQfMNPASsDvwlJskN3KUP3JOFUa1Uuj8tY2iiEyHAtKVF nbVw+UBWvBS7ovAtHBXICuP6F5Arz/a14Cxojo9mJul/XW0PXovuaoq9j9twVZvYPx8l MN3QBN/9Fpi/C3we3rxreMbZG3+85E4cJOXMotBuzoeeJV54IsDTuS/rLzDOTLpdRWkF FbfmErQ3bTTrPFplnGKxO09rFeN3KQEzOyMb5IzylOqxLJ7uWj+J2tfTAr/5qDGPLFxq 01Qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a22-20020a63cd56000000b00577516d9a1esi3219822pgj.172.2023.09.22.00.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:59:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 07D4081ED060; Fri, 22 Sep 2023 00:55:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbjIVHzC (ORCPT + 99 others); Fri, 22 Sep 2023 03:55:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231567AbjIVHzB (ORCPT ); Fri, 22 Sep 2023 03:55:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73976CA; Fri, 22 Sep 2023 00:54:55 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14CDBC433C7; Fri, 22 Sep 2023 07:54:53 +0000 (UTC) Message-ID: Date: Fri, 22 Sep 2023 09:54:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 1/2] Added Digiteq Automotive MGB4 driver Content-Language: en-US, nl To: tumic@gpxsee.org, Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Martin_T=C5=AFma?= References: <20230919165923.2509-1-tumic@gpxsee.org> <20230919165923.2509-2-tumic@gpxsee.org> From: Hans Verkuil In-Reply-To: <20230919165923.2509-2-tumic@gpxsee.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 00:55:06 -0700 (PDT) Hi Martin, One more thing that I forgot to mention: On 19/09/2023 18:59, tumic@gpxsee.org wrote: > From: Martin Tůma > > Digiteq Automotive MGB4 is a modular frame grabber PCIe card for automotive > video interfaces. As for now, two modules - FPD-Link and GMSL - are > available and supported by the driver. The card has two inputs and two > outputs (FPD-Link only). > > In addition to the video interfaces it also provides a trigger signal > interface and a MTD interface for FPGA firmware upload. > > Signed-off-by: Martin Tůma > --- > +static ssize_t video_source_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct video_device *vdev = to_video_device(dev); > + struct mgb4_vout_dev *voutdev = video_get_drvdata(vdev); > + struct mgb4_dev *mgbdev = voutdev->mgbdev; > + struct mgb4_vin_dev *loopin_new = NULL, *loopin_old = NULL; > + unsigned long val; > + ssize_t ret; > + u32 config; > + int i; > + > + ret = kstrtoul(buf, 10, &val); > + if (ret) > + return ret; > + if (val > 3) > + return -EINVAL; > + > + if (test_and_set_bit(0, &mgbdev->io_reconfig)) > + return -EBUSY; You need some documentation here on how and why io_reconfig is used, with a reference to the queue_setup functions, and there you need a reference back to this function. It is something unusual, and unusual code needs documentation. > + > + ret = -EBUSY; > + for (i = 0; i < MGB4_VIN_DEVICES; i++) > + if (mgbdev->vin[i] && is_busy(&mgbdev->vin[i]->vdev)) > + goto end; > + for (i = 0; i < MGB4_VOUT_DEVICES; i++) > + if (mgbdev->vout[i] && is_busy(&mgbdev->vout[i]->vdev)) > + goto end; > + > + config = mgb4_read_reg(&mgbdev->video, voutdev->config->regs.config); > + > + if (((config & 0xc) >> 2) < MGB4_VIN_DEVICES) > + loopin_old = mgbdev->vin[(config & 0xc) >> 2]; > + if (val < MGB4_VIN_DEVICES) > + loopin_new = mgbdev->vin[val]; > + if (loopin_old && loopin_cnt(loopin_old) == 1) > + mgb4_mask_reg(&mgbdev->video, loopin_old->config->regs.config, > + 0x2, 0x0); > + if (loopin_new) > + mgb4_mask_reg(&mgbdev->video, loopin_new->config->regs.config, > + 0x2, 0x2); > + > + if (val == voutdev->config->id + MGB4_VIN_DEVICES) > + mgb4_write_reg(&mgbdev->video, voutdev->config->regs.config, > + config & ~(1 << 1)); > + else > + mgb4_write_reg(&mgbdev->video, voutdev->config->regs.config, > + config | (1U << 1)); > + > + mgb4_mask_reg(&mgbdev->video, voutdev->config->regs.config, 0xc, > + val << 2); > + > + ret = count; > +end: > + clear_bit(0, &mgbdev->io_reconfig); > + > + return ret; > +} Regards, Hans