From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: Rob Herring <robherring2@gmail.com>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Bjorn Helgaas <bhelgaas@google.com>,
Grant Likely <grant.likely@linaro.org>,
Pantelis Antoniou <panto@antoniou-consulting.com>,
aik@ozlabs.ru
Subject: Re: [PATCH v6 41/42] drivers/of: Export OF changeset functions
Date: Fri, 7 Aug 2015 11:43:50 +1000 [thread overview]
Message-ID: <20150807014350.GA23647@gwshan> (raw)
In-Reply-To: <CAL_JsqK5NhRz4Pg3m=OJMHa5rxV9O5F74Ew-xGjyNgbW=SwDLg@mail.gmail.com>
On Thu, Aug 06, 2015 at 08:48:10AM -0500, Rob Herring wrote:
>On Wed, Aug 5, 2015 at 11:11 PM, Gavin Shan <gwshan@linux.vnet.ibm.com> wrote:
Thanks, Rob. All your comments will be covered in next revision.
Thanks,
Gavin
>> The PowerNV PCI hotplug driver is going to use the OF changeset
>> to manage the changed device sub-tree, which requires those OF
>> changeset functions are exported.
>>
>> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>> ---
>> drivers/of/dynamic.c | 65 ++++++++++++++++++++++++++++++++++++---------------
>> drivers/of/overlay.c | 8 +++----
>> drivers/of/unittest.c | 4 ++--
>> include/linux/of.h | 2 ++
>> 4 files changed, 54 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
>> index 53826b8..af65b5b 100644
>> --- a/drivers/of/dynamic.c
>> +++ b/drivers/of/dynamic.c
>> @@ -646,6 +646,7 @@ void of_changeset_init(struct of_changeset *ocs)
>> memset(ocs, 0, sizeof(*ocs));
>> INIT_LIST_HEAD(&ocs->entries);
>> }
>> +EXPORT_SYMBOL(of_changeset_init);
>
>We probably want these to be the _GPL variant.
>
>>
>> /**
>> * of_changeset_destroy - Destroy a changeset
>> @@ -662,20 +663,9 @@ void of_changeset_destroy(struct of_changeset *ocs)
>> list_for_each_entry_safe_reverse(ce, cen, &ocs->entries, node)
>> __of_changeset_entry_destroy(ce);
>> }
>> +EXPORT_SYMBOL(of_changeset_destroy);
>>
>> -/**
>> - * of_changeset_apply - Applies a changeset
>> - *
>> - * @ocs: changeset pointer
>> - *
>> - * Applies a changeset to the live tree.
>> - * Any side-effects of live tree state changes are applied here on
>> - * sucess, like creation/destruction of devices and side-effects
>> - * like creation of sysfs properties and directories.
>> - * Returns 0 on success, a negative error value in case of an error.
>> - * On error the partially applied effects are reverted.
>> - */
>> -int of_changeset_apply(struct of_changeset *ocs)
>> +int __of_changeset_apply(struct of_changeset *ocs)
>> {
>> struct of_changeset_entry *ce;
>> int ret;
>> @@ -704,17 +694,30 @@ int of_changeset_apply(struct of_changeset *ocs)
>> }
>>
>> /**
>> - * of_changeset_revert - Reverts an applied changeset
>> + * of_changeset_apply - Applies a changeset
>> *
>> * @ocs: changeset pointer
>> *
>> - * Reverts a changeset returning the state of the tree to what it
>> - * was before the application.
>> - * Any side-effects like creation/destruction of devices and
>> - * removal of sysfs properties and directories are applied.
>> + * Applies a changeset to the live tree.
>> + * Any side-effects of live tree state changes are applied here on
>> + * sucess, like creation/destruction of devices and side-effects
>
>s/sucess/success/
>
>> + * like creation of sysfs properties and directories.
>> * Returns 0 on success, a negative error value in case of an error.
>> + * On error the partially applied effects are reverted.
>> */
>> -int of_changeset_revert(struct of_changeset *ocs)
>> +int of_changeset_apply(struct of_changeset *ocs)
>> +{
>> + int ret;
>> +
>> + mutex_lock(&of_mutex);
>> + ret = __of_changeset_apply(ocs);
>> + mutex_unlock(&of_mutex);
>> +
>> + return ret;
>> +}
>> +EXPORT_SYMBOL(of_changeset_apply);
>> +
>> +int __of_changeset_revert(struct of_changeset *ocs)
>> {
>> struct of_changeset_entry *ce;
>> int ret;
>> @@ -742,6 +745,29 @@ int of_changeset_revert(struct of_changeset *ocs)
>> }
>>
>> /**
>> + * of_changeset_revert - Reverts an applied changeset
>> + *
>> + * @ocs: changeset pointer
>> + *
>> + * Reverts a changeset returning the state of the tree to what it
>> + * was before the application.
>> + * Any side-effects like creation/destruction of devices and
>> + * removal of sysfs properties and directories are applied.
>> + * Returns 0 on success, a negative error value in case of an error.
>> + */
>> +int of_changeset_revert(struct of_changeset *ocs)
>> +{
>> + int ret;
>> +
>> + mutex_lock(&of_mutex);
>> + ret = __of_changeset_revert(ocs);
>> + mutex_unlock(&of_mutex);
>> +
>> + return ret;
>> +}
>> +EXPORT_SYMBOL(of_changeset_revert);
>> +
>> +/**
>> * of_changeset_action - Perform a changeset action
>> *
>> * @ocs: changeset pointer
>> @@ -779,3 +805,4 @@ int of_changeset_action(struct of_changeset *ocs, unsigned long action,
>> list_add_tail(&ce->node, &ocs->entries);
>> return 0;
>> }
>> +EXPORT_SYMBOL(of_changeset_action);
>> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
>> index 24e025f..804ea33 100644
>> --- a/drivers/of/overlay.c
>> +++ b/drivers/of/overlay.c
>> @@ -378,9 +378,9 @@ int of_overlay_create(struct device_node *tree)
>> }
>>
>> /* apply the changeset */
>> - err = of_changeset_apply(&ov->cset);
>> + err = __of_changeset_apply(&ov->cset);
>> if (err) {
>> - pr_err("%s: of_changeset_apply() failed for tree@%s\n",
>> + pr_err("%s: __of_changeset_apply() failed for tree@%s\n",
>> __func__, tree->full_name);
>> goto err_revert_overlay;
>> }
>> @@ -508,7 +508,7 @@ int of_overlay_destroy(int id)
>>
>>
>> list_del(&ov->node);
>> - of_changeset_revert(&ov->cset);
>> + __of_changeset_revert(&ov->cset);
>> of_free_overlay_info(ov);
>> idr_remove(&ov_idr, id);
>> of_changeset_destroy(&ov->cset);
>> @@ -539,7 +539,7 @@ int of_overlay_destroy_all(void)
>> /* the tail of list is guaranteed to be safe to remove */
>> list_for_each_entry_safe_reverse(ov, ovn, &ov_list, node) {
>> list_del(&ov->node);
>> - of_changeset_revert(&ov->cset);
>> + __of_changeset_revert(&ov->cset);
>> of_free_overlay_info(ov);
>> idr_remove(&ov_idr, ov->id);
>> kfree(ov);
>> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
>> index 2270830..06eb3e5 100644
>> --- a/drivers/of/unittest.c
>> +++ b/drivers/of/unittest.c
>> @@ -527,7 +527,7 @@ static void __init of_unittest_changeset(void)
>> unittest(!of_changeset_update_property(&chgset, parent, ppupdate), "fail update prop\n");
>> unittest(!of_changeset_remove_property(&chgset, parent, ppremove), "fail remove prop\n");
>> mutex_lock(&of_mutex);
>> - unittest(!of_changeset_apply(&chgset), "apply failed\n");
>> + unittest(!__of_changeset_apply(&chgset), "apply failed\n");
>
>You can just remove the mutex here.
>
>> mutex_unlock(&of_mutex);
>>
>> /* Make sure node names are constructed correctly */
>> @@ -536,7 +536,7 @@ static void __init of_unittest_changeset(void)
>> of_node_put(np);
>>
>> mutex_lock(&of_mutex);
>> - unittest(!of_changeset_revert(&chgset), "revert failed\n");
>> + unittest(!__of_changeset_revert(&chgset), "revert failed\n");
>
>And here.
>
>> mutex_unlock(&of_mutex);
>>
>> of_changeset_destroy(&chgset);
>> diff --git a/include/linux/of.h b/include/linux/of.h
>> index edc068d..5c030e1 100644
>> --- a/include/linux/of.h
>> +++ b/include/linux/of.h
>> @@ -1001,7 +1001,9 @@ extern int of_reconfig_get_state_change(unsigned long action,
>>
>> extern void of_changeset_init(struct of_changeset *ocs);
>> extern void of_changeset_destroy(struct of_changeset *ocs);
>> +extern int __of_changeset_apply(struct of_changeset *ocs);
>> extern int of_changeset_apply(struct of_changeset *ocs);
>> +extern int __of_changeset_revert(struct of_changeset *ocs);
>
>These should go in of_private.h.
>
>> extern int of_changeset_revert(struct of_changeset *ocs);
>> extern int of_changeset_action(struct of_changeset *ocs,
>> unsigned long action, struct device_node *np,
>> --
>> 2.1.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-08-07 1:43 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 4:11 [PATCH v6 00/42] powerpc/powernv: PCI hotplug suppport Gavin Shan
2015-08-06 4:11 ` [PATCH v6 01/42] PCI: Add pcibios_setup_bridge() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 02/42] powerpc/powernv: Drop pnv_ioda_setup_dev_PE() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 03/42] powerpc/powernv: Enable M64 on P7IOC Gavin Shan
2015-08-10 6:30 ` Alexey Kardashevskiy
2015-08-10 23:45 ` Gavin Shan
2015-08-11 2:06 ` Alexey Kardashevskiy
2015-08-12 10:28 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 04/42] powerpc/powernv: Reorder fields in struct pnv_phb Gavin Shan
2015-08-06 4:11 ` [PATCH v6 05/42] powerpc/powernv: Track IO/M32/M64 segments from PE Gavin Shan
2015-08-10 7:16 ` Alexey Kardashevskiy
2015-08-11 0:03 ` Gavin Shan
2015-08-11 2:23 ` Alexey Kardashevskiy
2015-08-12 10:45 ` Gavin Shan
2015-08-12 11:05 ` Alexey Kardashevskiy
2015-08-12 11:20 ` Gavin Shan
2015-08-12 12:57 ` Alexey Kardashevskiy
2015-08-12 23:34 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 06/42] powerpc/powernv: Simplify pnv_ioda_setup_pe_seg() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 07/42] powerpc/powernv: Improve IO and M32 mapping Gavin Shan
[not found] ` <1438834307-26960-8-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-10 7:40 ` Alexey Kardashevskiy
2015-08-11 0:12 ` Gavin Shan
2015-08-11 2:32 ` Alexey Kardashevskiy
2015-08-12 23:42 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 08/42] powerpc/powernv: Calculate PHB's DMA weight dynamically Gavin Shan
2015-08-10 7:48 ` Alexey Kardashevskiy
2015-08-10 9:21 ` Alexey Kardashevskiy
2015-08-12 23:57 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 09/42] powerpc/powernv: DMA32 cleanup Gavin Shan
2015-08-10 8:07 ` Alexey Kardashevskiy
2015-08-11 0:19 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 10/42] powerpc/powernv: pnv_ioda_setup_dma() configure one PE only Gavin Shan
2015-08-10 9:31 ` Alexey Kardashevskiy
2015-08-11 0:29 ` Gavin Shan
2015-08-11 2:39 ` Alexey Kardashevskiy
2015-08-12 23:59 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 11/42] powerpc/powernv: Trace DMA32 segments consumed by PE Gavin Shan
2015-08-10 9:43 ` Alexey Kardashevskiy
2015-08-11 0:33 ` Gavin Shan
2015-08-13 0:02 ` Gavin Shan
[not found] ` <1438834307-26960-1-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-06 4:11 ` [PATCH v6 12/42] powerpc/powernv: Increase PE# capacity Gavin Shan
[not found] ` <1438834307-26960-13-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-10 9:53 ` Alexey Kardashevskiy
2015-08-11 0:38 ` Gavin Shan
2015-08-11 2:47 ` Alexey Kardashevskiy
2015-08-13 0:23 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 17/42] powerpc/powernv: Rename PE# fields in PHB Gavin Shan
2015-08-10 14:21 ` Alexey Kardashevskiy
2015-08-11 0:40 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 28/42] powerpc/powernv: Fundamental reset in pnv_pci_reset_secondary_bus() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 32/42] powerpc/powernv: Introduce pnv_pci_poll() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 33/42] powerpc/powernv: Functions to get/reset PCI slot status Gavin Shan
2015-08-06 4:11 ` [PATCH v6 34/42] powerpc/pci: Delay creating pci_dn Gavin Shan
2015-08-06 4:11 ` [PATCH v6 37/42] powerpc/powernv: Select OF_DYNAMIC Gavin Shan
2015-08-06 4:11 ` [PATCH v6 13/42] powerpc/pci: Cleanup on pci_controller_ops Gavin Shan
2015-08-06 4:11 ` [PATCH v6 14/42] powerpc/pci: Override pcibios_setup_bridge() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 15/42] powerpc/powernv: PE oriented during configuration Gavin Shan
2015-08-10 10:02 ` Alexey Kardashevskiy
2015-08-11 0:39 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 16/42] powerpc/powernv: Helper function pnv_ioda_init_pe() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 18/42] powerpc/powernv: Allocate PE# in deasending order Gavin Shan
2015-08-10 14:39 ` Alexey Kardashevskiy
2015-08-11 0:43 ` Gavin Shan
2015-08-11 2:50 ` Alexey Kardashevskiy
2015-08-13 0:28 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 19/42] powerpc/powernv: Reserve PE# for root bus Gavin Shan
2015-08-06 4:11 ` [PATCH v6 20/42] powerpc/powernv: Create PEs dynamically Gavin Shan
2015-08-14 13:52 ` Alexey Kardashevskiy
2015-08-15 4:59 ` Gavin Shan
2015-08-15 9:23 ` Alexey Kardashevskiy
2015-08-06 4:11 ` [PATCH v6 21/42] powerpc/powernv: Remove DMA32 list of PEs Gavin Shan
2015-08-06 4:11 ` [PATCH v6 22/42] powerpc/powernv: Move functions around Gavin Shan
2015-08-06 4:11 ` [PATCH v6 23/42] powerpc/powernv: Release PEs dynamically Gavin Shan
2015-08-11 13:03 ` Alexey Kardashevskiy
2015-08-13 0:54 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 24/42] powerpc/powernv: Supports slot ID Gavin Shan
2015-08-06 4:11 ` [PATCH v6 25/42] powerpc/powernv: Use PCI slot reset infrastructure Gavin Shan
2015-08-06 4:11 ` [PATCH v6 26/42] powerpc/powernv: Simplify pnv_eeh_reset() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 27/42] powerpc/powernv: Don't cover root bus in pnv_pci_reset_secondary_bus() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 29/42] powerpc/pci: Don't scan empty slot Gavin Shan
2015-08-06 4:11 ` [PATCH v6 30/42] powerpc/pci: Move pcibios_find_pci_bus() around Gavin Shan
2015-08-06 4:11 ` [PATCH v6 31/42] powerpc/pci: Rename pcibios_{add,remove}_pci_devices Gavin Shan
2015-08-06 4:11 ` [PATCH v6 35/42] powerpc/pci: Export traverse_pci_device_nodes() Gavin Shan
2015-08-06 4:11 ` [PATCH v6 36/42] powerpc/pci: Update bridge windows on PCI plugging Gavin Shan
2015-08-06 4:11 ` [PATCH v6 38/42] drivers/of: Unflatten subordinate nodes after specified level Gavin Shan
2015-08-06 14:09 ` Rob Herring
2015-11-03 23:16 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 39/42] drivers/of: Allow to specify root node in of_fdt_unflatten_tree() Gavin Shan
2015-08-10 22:42 ` Frank Rowand
2015-08-11 0:52 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 40/42] drivers/of: Return allocated memory chunk from of_fdt_unflatten_tree() Gavin Shan
[not found] ` <1438834307-26960-41-git-send-email-gwshan-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2015-08-06 14:19 ` Rob Herring
2015-08-10 22:42 ` Frank Rowand
2015-08-11 0:52 ` Gavin Shan
2015-08-06 4:11 ` [PATCH v6 41/42] drivers/of: Export OF changeset functions Gavin Shan
2015-08-06 13:48 ` Rob Herring
2015-08-07 1:43 ` Gavin Shan [this message]
2015-08-06 4:11 ` [PATCH v6 42/42] pci/hotplug: PowerPC PowerNV PCI hotplug driver Gavin Shan
2015-08-15 3:13 ` Alexey Kardashevskiy
2015-08-15 4:47 ` Gavin Shan
2015-08-15 9:15 ` Alexey Kardashevskiy
2015-08-10 6:05 ` [PATCH v6 00/42] powerpc/powernv: PCI hotplug suppport Alexey Kardashevskiy
2015-08-10 7:17 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150807014350.GA23647@gwshan \
--to=gwshan@linux.vnet.ibm.com \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=panto@antoniou-consulting.com \
--cc=robherring2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).