From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752357AbdKHRhb (ORCPT ); Wed, 8 Nov 2017 12:37:31 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:50276 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbdKHRh3 (ORCPT ); Wed, 8 Nov 2017 12:37:29 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D607060542 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: <76b030eb-232f-e075-f5e8-09731a5b6670@codeaurora.org> Date: Wed, 8 Nov 2017 12:37:26 -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 12:12 PM, Timur Tabi wrote: > On 11/08/2017 10:58 AM, Sinan Kaya wrote: >> 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[] >> } > > Why not this: > > const struct of_device_id hidma_msi_of_ids[] = { >     {.compatible = "qcom,hidma-1.1",}, >     {.compatible = "qcom,hidma-1.2",}, >     {}, > }, > > static const struct acpi_device_id hidma_msi_acpi_ids[] = { >     {"QCOM8001", QDF2XXX_V1}, >     {"QCOM8002", QDF2XXX_V2}, >     {}, > }; > > struct hidma_cap { >     const struct of_device_id *of; >     const struct acpi_device_id *acpi; > }; > > static struct hidma_cap hidma_msi_cap = { >     hidma_msi_of_ids, >     hidma_msi_acpi_ids > } > I think we are talking styles here. I started with your proposal and wanted to group the settings together as much as I can for maintenance reasons only because I don't have to remember that there are two different arrays that I need to take care of when I add a new HW in the future. +static struct hidma_cap hidma_msi_cap = { + .of = { + {.compatible = "qcom,hidma-1.1",}, + {.compatible = "qcom,hidma-1.2",}, + {}, + }, + + .acpi = { + {"QCOM8062"}, + {"QCOM8063"}, + {}, + } +}; I like this better than what you are proposing. > Keep in mind that you also need to add MODULE_DEVICE_TABLE entries, which you can't really do with your approach. > > MODULE_DEVICE_TABLE(of, hidma_msi_of_ids); > MODULE_DEVICE_TABLE(acpi, hidma_msi_acpi_ids); > HIDMA capable devices are a subset of the devices that need to be probed. That's also why I don't touch the device_table. In the end both approaches work. It is a choice between what is more manageable. That was the initial objection. I tried to close on this request. -- 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.