[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181210112934.GA2058@nanopsycho>
Date: Mon, 10 Dec 2018 12:29:34 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Vasundhara Volam <vasundhara-v.volam@...adcom.com>
Cc: David Miller <davem@...emloft.net>,
"michael.chan@...adcom.com" <michael.chan@...adcom.com>,
Jiri Pirko <jiri@...lanox.com>, Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next RFC 1/7] devlink: Add devlink_param for port
register and unregister
Mon, Dec 10, 2018 at 10:21:03AM CET, vasundhara-v.volam@...adcom.com wrote:
>On Wed, Dec 5, 2018 at 5:24 PM Jiri Pirko <jiri@...nulli.us> wrote:
>>
>> Wed, Dec 05, 2018 at 06:56:54AM CET, vasundhara-v.volam@...adcom.com wrote:
[...]
>> >+ mutex_lock(&devlink->lock);
>> >+ for (i = 0; i < params_count; i++) {
>> >+ if (!param || !param->name || !param->supported_cmodes) {
>> >+ err = -EINVAL;
>> >+ goto rollback;
>> >+ }
>> >+ if (param->generic) {
>> >+ err = devlink_port_param_generic_verify(param);
>> >+ if (err)
>> >+ goto rollback;
>> >+ } else {
>> >+ err = devlink_port_param_driver_verify(param);
>>
>> This is duplicated code from devlink_params_register(). Once you use a
>> single enum for all params, you can push this into a common function for
>> both devlink_params_register() and devlink_port_params_register()
>Jiri, you are referring to move only param verification code into a
>common function. right?
Once you will have a single enum, you need only one verify() function.
Powered by blists - more mailing lists