From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32CE1132103 for ; Thu, 19 Jun 2025 11:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750333237; cv=none; b=NJ5W0gRF6mwOkzH9I+BScoQPWsFnb+Ka0JcbjjvsYu/8aT/Er272t1wTJoWiqeKUZ9y3DaAJ3vr1ovIdsIYyXhDxlh4YUP3BhAxgNPlEqkZYLzMHqQ3UMylLVUUbuCwmfZji3rQ1YqLKok7waTSvuDa18CUxX+gN9HuZHLPIl1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750333237; c=relaxed/simple; bh=fI4b0JmvmR/LKJHS4kYGRgS79fqtVDdNyB26iJdkI7Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fylYRwaVH0JkndoiqiwA9upAa4Q3t6D44d9FPzaDn06ccTjyOWH8ZylHgeVM7c1fCAFkJow972HrgardsElMsSzQ2BzLLfjryActrWA/Qodix0deijomWBVCzD+k2Txd+fKYx8Jk8DL+uK/nA6kSuwhlan2VFXTuWxSGqqFW+4s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LNZcfN0O; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LNZcfN0O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750333234; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g5MqY5EbJPpgVIT/GMNbBL+m8bzhYEjTyXfnL0CxcoM=; b=LNZcfN0O5EiHbj61InS26SG0DzgdUWWkci85mvoDr02Jd0QJjHDcXuzfG+DX48i/0nJxv8 nbpvCl16f3280jjXtn0KogAmJZy/KVQsA/eBHUWqIMCPVYoR85DHFC78sitAGwReqtsP7g eGM9zD7jKB8dOuDqOW+S/QtDDyaptoA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-678-4Y5y4CpvORWPzsnzsdpFVA-1; Thu, 19 Jun 2025 07:40:33 -0400 X-MC-Unique: 4Y5y4CpvORWPzsnzsdpFVA-1 X-Mimecast-MFC-AGG-ID: 4Y5y4CpvORWPzsnzsdpFVA_1750333232 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3a54a8a0122so338153f8f.2 for ; Thu, 19 Jun 2025 04:40:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750333232; x=1750938032; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g5MqY5EbJPpgVIT/GMNbBL+m8bzhYEjTyXfnL0CxcoM=; b=Cn++z1LfSB/3sW7ggXmT5+QZuBjnQFlOi+Cv+F1PJKTeZLGTdYl8ysVzJ3Zp+F+ezH OcFm1S7I3By1T1C1lat9MadOOiKoExqSy3fBRzbu/Yc0ubZgMDhoiQcK79DihSmtICZF x396YT5yh+tTEB0JhxuR4QBffqR5FLaaDbaFcTzprVcsxDi3CMQUwss2+neGeO0AD3G8 dvMvnr1W4rJr2DGw5hWYmnU1ljUPm2XnrmNJAfdtkx7jNCSZufNXAy2fYssSLhcZ830t CyMXWwg0/kO8QQ8Un6Yux+EvifX5MoMC7zGEmWMBAu9l2XejhPWUNMevZRN0TwlsmMBN 7cFg== X-Forwarded-Encrypted: i=1; AJvYcCWD3oVona7CSayr0UC3WE2lOSh9VThp2nnHP0u7UIt4/9pwz6PMs1RhUKJBptaZ+Y6nfMGUmunfNgwZ@vger.kernel.org X-Gm-Message-State: AOJu0YxL7MM5UHAKjNFca7LapgT8uNt37xjqxZyHF9/b+WLq6Bh+hXtk YrCgQl8lDrk6t/nwZUUB6jvb+6sZFnAsCyWgioDMvxLUayU4vCqvHxUOksJCJ02/ziqPvWs6uZd WjrHTK5BHiMCDZ8ZPRsBisIaHpsTTUWs6Ua+zmFfAygE1CrtMgiCMr6mokdkiuys= X-Gm-Gg: ASbGncumAeBFU67EboVoooeZ3X9//jeROpZj2fpZudsf3n6BkgMv52RvIyv42X7Fxf5 nR1dsPKtfhGCGO4gej1NQf3QWwjubJWzwylDbla8wEDJic+SyqaEd8oa0doR7y/R8XMiPnpT6mb 2bmljlhGq2Cu8dA+zNrAIyel7NuKRLNECCwkucKt4XHTH/HjmAJW87uE5sdG2+J841lEk6rEbLS i+sCPAgsvUsJD9XBaxJKb9sRqCubHwRpFx1FMYQnM9JzRbo4z2/nUpheVjAhsqLKMmvcgHShAWm c/ozrxuxP3/qW3RiFb1sFYScThcCKPCeSotLDQKM2jmVE/6GRCADiuylbkWg2pRf2J8JgA== X-Received: by 2002:a05:6000:2d0c:b0:3a5:8d0b:d0b8 with SMTP id ffacd0b85a97d-3a58d0bd1camr4831902f8f.54.1750333231804; Thu, 19 Jun 2025 04:40:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkPsAM7rzvUuUIwuWTbnbsaa2hHEQ50y/ld0Zh2qJ6v7nBnPiul0WnrvWb0vFBIsYzskhEqg== X-Received: by 2002:a05:6000:2d0c:b0:3a5:8d0b:d0b8 with SMTP id ffacd0b85a97d-3a58d0bd1camr4831872f8f.54.1750333231356; Thu, 19 Jun 2025 04:40:31 -0700 (PDT) Received: from ?IPV6:2a0d:3344:271a:7310:d5d8:c311:8743:3e10? ([2a0d:3344:271a:7310:d5d8:c311:8743:3e10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a568b28876sm19250304f8f.73.2025.06.19.04.40.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Jun 2025 04:40:30 -0700 (PDT) Message-ID: <7fce273d-06f4-498c-a36a-d6828b4d4f30@redhat.com> Date: Thu, 19 Jun 2025 13:40:28 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v11 14/14] dpll: zl3073x: Add support to get/set frequency on output pins To: Ivan Vecera , netdev@vger.kernel.org Cc: Prathosh Satish , Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Simon Horman , Jonathan Corbet , Jason Gunthorpe , Shannon Nelson , Dave Jiang , Jonathan Cameron , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Michal Schmidt , Petr Oros References: <20250616201404.1412341-1-ivecera@redhat.com> <20250616201404.1412341-15-ivecera@redhat.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20250616201404.1412341-15-ivecera@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/16/25 10:14 PM, Ivan Vecera wrote: > +static int > +zl3073x_dpll_output_pin_frequency_set(const struct dpll_pin *dpll_pin, > + void *pin_priv, > + const struct dpll_device *dpll, > + void *dpll_priv, u64 frequency, > + struct netlink_ext_ack *extack) > +{ > + struct zl3073x_dpll *zldpll = dpll_priv; > + struct zl3073x_dev *zldev = zldpll->dev; > + struct zl3073x_dpll_pin *pin = pin_priv; > + struct device *dev = zldev->dev; > + u32 output_n_freq, output_p_freq; > + u8 out, signal_format, synth; > + u32 cur_div, new_div, ndiv; > + u32 synth_freq; > + int rc; > + > + out = zl3073x_output_pin_out_get(pin->id); > + synth = zl3073x_out_synth_get(zldev, out); > + synth_freq = zl3073x_synth_freq_get(zldev, synth); > + > + /* Check the requested frequency divides synth frequency without > + * remainder. > + */ > + if (synth_freq % (u32)frequency) { As the frequency comes from user-space and is validated only the DT info, which in turn is AFAICS imported verbatim into the kernel, I *think* it would be safer to check for 0 here or at DT info load time. /P