Re: [PATCH v5 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public

2 messages, 2 authors, 2018-07-03 · open the first message on its own page

Re: [PATCH v5 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public

From: Baoquan He <hidden>
Date: 2018-07-03 14:55:03

Hi Andy,

On 06/12/18 at 05:24pm, Andy Shevchenko wrote:
On Tue, Jun 12, 2018 at 5:20 PM, Andy Shevchenko
[off-list ref] wrote:
quoted
quoted
Hmm, I just copied it from arch/powerpc/kernel/pci-common.c. The
function interface expects an integer returned value, not sure what a
real error codes look like, could you give more hints? Will change
accordingly.
I briefly looked at the code and error codes we have, so, my proposal
is one of the following
quoted
 - use -ECANCELED (not the best choice for first occurrence here,
though I can't find better)
Actually -ENOTSUPP might suit the first case (although the actual
would be something like -EOVERLAP, which we don't have)
Sorry for late reply, and many thanks for your great suggestion.

I am fine to use -ENOTSUPP as the first returned value, and -ECANCELED
for the 2nd one. Or define an enum as you suggested inside the function
or in header file.

Or use -EBUSY for the first case because existing resource is
overlapping but not fully contained by 'res'; and -EINVAL for
the 2nd case since didn't find any one resources which is contained by
'res', means we passed in a invalid resource. 

All is fine to me, I can repost with each of them.

Thanks
Baoquan
quoted
 - use positive integers (or enum), like
  #define RES_REPARENTED 0
  #define RES_OVERLAPPED 1
  #define RES_NOCONFLICT 2

quoted
quoted
quoted
+               if (firstpp == NULL)
+                       firstpp = pp;
+       }
quoted
+       if (firstpp == NULL)
+               return -1;      /* didn't find any conflicting entries? */
Ditto.
Ditto.
quoted
quoted
quoted
+}
+EXPORT_SYMBOL(reparent_resources);
--
With Best Regards,
Andy Shevchenko


-- 
With Best Regards,
Andy Shevchenko

Re: [PATCH v5 1/4] resource: Move reparent_resources() to kernel/resource.c and make it public

From: Andy Shevchenko <hidden>
Date: 2018-07-03 20:57:48

On Tue, Jul 3, 2018 at 5:55 PM, Baoquan He [off-list ref] wrote:
On 06/12/18 at 05:24pm, Andy Shevchenko wrote:
quoted
On Tue, Jun 12, 2018 at 5:20 PM, Andy Shevchenko
[off-list ref] wrote:
quoted
quoted
I briefly looked at the code and error codes we have, so, my proposal
is one of the following
quoted
 - use -ECANCELED (not the best choice for first occurrence here,
though I can't find better)
Actually -ENOTSUPP might suit the first case (although the actual
would be something like -EOVERLAP, which we don't have)
Sorry for late reply, and many thanks for your great suggestion.
I am fine to use -ENOTSUPP as the first returned value, and -ECANCELED
for the 2nd one.
I have no strong opinion, but I like (slightly better) this approach ^^^
Or define an enum as you suggested inside the function
or in header file.
Or use -EBUSY for the first case because existing resource is
overlapping but not fully contained by 'res'; and -EINVAL for
the 2nd case since didn't find any one resources which is contained by
'res', means we passed in a invalid resource.

All is fine to me, I can repost with each of them.
quoted
quoted
 - use positive integers (or enum), like
  #define RES_REPARENTED 0
  #define RES_OVERLAPPED 1
  #define RES_NOCONFLICT 2
-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help