From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752840AbdKHQ6r (ORCPT ); Wed, 8 Nov 2017 11:58:47 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:58708 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752608AbdKHQ6p (ORCPT ); Wed, 8 Nov 2017 11:58:45 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4216E6071F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH V2 2/3] dmaengine: qcom_hidma: add support for the new revision To: Timur Tabi , dmaengine@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1510158582-5343-1-git-send-email-okaya@codeaurora.org> <1510158582-5343-2-git-send-email-okaya@codeaurora.org> From: Sinan Kaya Message-ID: Date: Wed, 8 Nov 2017 11:58:42 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/2017 11:49 AM, Timur Tabi wrote: > On 11/08/2017 10:29 AM, Sinan Kaya wrote: >> +#define HIDMA_MAX_DEV_MATCH 10 >> + >> +struct hidma_cap { >> +    const struct of_device_id of[HIDMA_MAX_DEV_MATCH]; >> +    const struct acpi_device_id acpi[HIDMA_MAX_DEV_MATCH]; >> +}; > > This seems wrong.  You're defining an array of size 10, but it only has three elements.  And the third element is a sentinel, which is typically used to avoid specifying the size of the array. > It is true that I define an array of size 10. It is just some arbitrary number with forward thinking. I don't really have to use it to the maximum today as long as I satisfy the calling conventions. What is important is that the of_device_match() and acpi_device_match() functions will stop searching only if they find an empty element. The {} element. That's the calling semantics of of_device_match() and acpi_device_match(). Besides, C compiler also won't let me put two arrays together like this. struct my_struct { struct some_struct array1[] struct some_struct array2[] } -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.