Re: [PATCH v3] bus: uniphier-system-bus: add UniPhier System Bus driver

From: Masahiro Yamada
Date: Tue Dec 08 2015 - 22:56:53 EST


Hi Arnd,

2015-12-09 1:59 GMT+09:00 Arnd Bergmann <arnd@xxxxxxxx>:
>
> Just a little thought about one thing I found odd:
>
>> +static int uniphier_system_bus_check_overlap(
>> + struct uniphier_system_bus_priv tmp)
>> +{
>
> Did you intentionally pass this by value?

Yes, I did not want to disturb the original one.

It is copied to a temporary storage, and sorted by the base address,
and discarded after the overlap checking.

But, you are right. It is possible (and simpler)
to check the region overlap without sorting.


> Maybe do it explicitly using a pointer
> and memcpy to a local variable, which has a similar effect. Alternatively
> just check each newly probed child node for conflicts with any of the
> previous children. That is slightly more expensive at O(n^2) instead of O(n)
> but n is always small here and you can avoid sorting first.

Good idea. I simplified this function in v4.



--
Best Regards
Masahiro Yamada
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/