Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp42314pja; Fri, 22 Nov 2019 03:12:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyaIybet2ikl8DmZ2545hAtqOWDfZ9KSvhfhmSqh85AJjQKa1khLvFc9b/ELVdzDZbUb9li X-Received: by 2002:a50:91ba:: with SMTP id g55mr354072eda.118.1574421159743; Fri, 22 Nov 2019 03:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574421159; cv=none; d=google.com; s=arc-20160816; b=Dc6GNc4RkE1utf73kvxxeQyiU+hdW0+09TYFXZ2o0+u6cg2upFa2tZKpGRxnEGZJg4 y/nvdwch1OFaiTQg+TS1Oag5HtgqeHq14PzLnMRT6GAgli0G7mzB6k87K8FRxyJOAn5V SnoZ+g7JMzPuFZDUyfkiGgAlDjQZLJakd235WmQVMf3rxwDwA3cCveXGKMWCfHFv/3A7 +YNOsn1CfjCgSXjcQmyPr55soFc1pYVM6+TxGAzDgSraOLMpwtDGvmQUVt6FsCDA0EVD wpT0IsrVtI8NPfFeFY2bjfCsPWH0RTO17JCzNrRpRS2kYdlq6jY0CvD0bDxNh/4xd65k Y+DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IJy6qLE0NRKxh6Mha+gfkzQC4wbFrGA2MrCeqsDL3k0=; b=CIeUgQLEZGmuXFa5eU+28ypgo4QhIkyHkyoNtQS+L2WUC4Eq8Cirh4S6cxOnDu2n1c FnXz8MctIgup3XPM/V16sgp2o8/BtMkQ0ffw3G9PcBzdYDL2ZChKrPfqJm3FJ37i147G 6KKkFl053qE4DLXj4c9Ztjj3n8nLIisG0Uqp4IlhoHl1vOG1A2PzxMnOUF0KUHgfH3Il +7SW/aqISKpzL8OcGF28MqS/4cKKqQkNqnegqQC5UN2kO7LP5D7iWEe1+uyjUHAaTjD0 c0wTJ1eAZp8QSf6HJ3Jb/7F8ARDSbyf1HRJsAPGsI4bx83T0yue8LV6Dx2uhGbaOXZAn 29yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p6646ryq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si321242ejt.8.2019.11.22.03.12.15; Fri, 22 Nov 2019 03:12:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p6646ryq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731048AbfKVLDw (ORCPT + 99 others); Fri, 22 Nov 2019 06:03:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:58204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731457AbfKVLDt (ORCPT ); Fri, 22 Nov 2019 06:03:49 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D4F7207FC; Fri, 22 Nov 2019 11:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420628; bh=tWMoYBDBxFN95d0VknL5vepaomjR5eoKtzCaE7yb/NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6646ryqChr7X07+fyEuQpYq2hbaRe7+9Ev7Ol3HLY/oyQWYPC/Hh2xrjUd3KaIqC ahW5WQH+rJQF4SdsA0qK+sG46QfwMmf0G3Ss4Yx6K8jWlf3TEvgZxVZDYFAdPJqPm3 W5kLaG8N/EsEwsiSXChRsbwjT3Hh559OFWSD0Q5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Andy Gross , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 128/220] i2c: qup: use core to detect no zero length quirk Date: Fri, 22 Nov 2019 11:28:13 +0100 Message-Id: <20191122100922.027888422@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang [ Upstream commit de82bb431855580ad659bfed3e858bd9dd12efd0 ] And don't reimplement in the driver. Signed-off-by: Wolfram Sang Reviewed-by: Andy Gross Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-qup.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index c86c3ae1318f2..e09cd0775ae91 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1088,11 +1088,6 @@ static int qup_i2c_xfer(struct i2c_adapter *adap, writel(I2C_MINI_CORE | I2C_N_VAL, qup->base + QUP_CONFIG); for (idx = 0; idx < num; idx++) { - if (msgs[idx].len == 0) { - ret = -EINVAL; - goto out; - } - if (qup_i2c_poll_state_i2c_master(qup)) { ret = -EIO; goto out; @@ -1520,9 +1515,6 @@ qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup, /* All i2c_msgs should be transferred using either dma or cpu */ for (idx = 0; idx < num; idx++) { - if (msgs[idx].len == 0) - return -EINVAL; - if (msgs[idx].flags & I2C_M_RD) max_rx_len = max_t(unsigned int, max_rx_len, msgs[idx].len); @@ -1636,9 +1628,14 @@ static const struct i2c_algorithm qup_i2c_algo_v2 = { * which limits the possible read to 256 (QUP_READ_LIMIT) bytes. */ static const struct i2c_adapter_quirks qup_i2c_quirks = { + .flags = I2C_AQ_NO_ZERO_LEN, .max_read_len = QUP_READ_LIMIT, }; +static const struct i2c_adapter_quirks qup_i2c_quirks_v2 = { + .flags = I2C_AQ_NO_ZERO_LEN, +}; + static void qup_i2c_enable_clocks(struct qup_i2c_dev *qup) { clk_prepare_enable(qup->clk); @@ -1701,6 +1698,7 @@ static int qup_i2c_probe(struct platform_device *pdev) is_qup_v1 = true; } else { qup->adap.algo = &qup_i2c_algo_v2; + qup->adap.quirks = &qup_i2c_quirks_v2; is_qup_v1 = false; if (acpi_match_device(qup_i2c_acpi_match, qup->dev)) goto nodma; -- 2.20.1