DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: liwencheng <liwencheng@phytium.com.cn>
Cc: dev@dpdk.org
Subject: Re: [PATCH v1 2/2] /usertools/dpdk-devbind:add the binding and unbinding of platform device
Date: Tue, 5 Nov 2024 19:55:45 -0800	[thread overview]
Message-ID: <20241105195545.20c0327c@hermes.local> (raw)
In-Reply-To: <1730455640-1084345-2-git-send-email-liwencheng@phytium.com.cn>

On Fri,  1 Nov 2024 10:07:20 +0000
liwencheng <liwencheng@phytium.com.cn> wrote:

> +def unbind_platform_one(dev_name):
> +    filename = "/sys/bus/platform/devices/%s/driver" % dev_name
> +
> +    if exists(filename):
> +        try:
> +            f = open(os.path.join(filename, "unbind"), "w")
> +        except OSError as err:
> +            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
> +                     (dev_name, os.path.join(filename, "unbind"), err))
> +        f.write(dev_name)
> +        f.close()
> +        filename = "/sys/bus/platform/devices/%s/driver_override" % dev_name
> +        try:
> +            f = open(filename, "w")
> +        except OSError as err:
> +            sys.exit("Error: unbind failed for %s - Cannot open %s: %s" %
> +                     (dev_name, filename, err))
> +        f.write("")
> +        f.close()
> +        print("Successfully unbind platform device %s" % dev_name)
> +
> +

Looks fine, but probably worth the effort in the future to update to current
Python style guidelines. Applies to all of devbind.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

************* Module dpdk-devbind
usertools/dpdk-devbind.py:1:0: C0114: Missing module docstring (missing-module-docstring)
usertools/dpdk-devbind.py:1:0: C0103: Module name "dpdk-devbind" doesn't conform to snake_case naming style (invalid-name)
usertools/dpdk-devbind.py:104:0: C0103: Constant name "loaded_modules" doesn't conform to UPPER_CASE naming style (invalid-name)
usertools/dpdk-devbind.py:107:0: C0103: Constant name "b_flag" doesn't conform to UPPER_CASE naming style (invalid-name)
usertools/dpdk-devbind.py:108:0: C0103: Constant name "status_flag" doesn't conform to UPPER_CASE naming style (invalid-name)
usertools/dpdk-devbind.py:109:0: C0103: Constant name "force_flag" doesn't conform to UPPER_CASE naming style (invalid-name)
usertools/dpdk-devbind.py:110:0: C0103: Constant name "noiommu_flag" doesn't conform to UPPER_CASE naming style (invalid-name)
usertools/dpdk-devbind.py:115:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:116:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:142:17: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:150:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:151:4: W0601: Global variable 'platform_devices' undefined at the module level (global-variable-undefined)
usertools/dpdk-devbind.py:157:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:171:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:212:33: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:226:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:234:4: W0602: Using global for 'devices' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:235:4: W0602: Using global for 'dpdk_drivers' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:246:31: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:248:31: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:278:4: C0206: Consider iterating with .items() (consider-using-dict-items)
usertools/dpdk-devbind.py:278:13: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:299:51: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:230:0: R0912: Too many branches (21/12) (too-many-branches)
usertools/dpdk-devbind.py:311:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:312:4: C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
usertools/dpdk-devbind.py:312:4: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
usertools/dpdk-devbind.py:343:4: C0206: Consider iterating with .items() (consider-using-dict-items)
usertools/dpdk-devbind.py:343:13: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:352:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:356:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:357:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:361:16: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:363:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:367:19: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:361:16: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:369:16: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:371:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:375:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:369:16: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:382:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:388:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:393:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:395:12: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:397:17: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:395:12: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:403:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:404:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:407:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:410:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:414:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:417:16: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:419:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:425:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:428:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:417:16: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:430:12: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:432:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:439:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:442:10: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:430:12: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:453:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:460:18: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:474:19: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:477:20: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:479:22: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:483:24: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:486:22: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:491:23: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:493:20: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:495:22: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:500:24: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:504:22: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:509:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:493:20: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:511:12: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:513:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:528:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:537:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:511:12: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:540:16: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:542:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:548:21: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:445:0: R0911: Too many return statements (9/6) (too-many-return-statements)
usertools/dpdk-devbind.py:445:0: R0912: Too many branches (18/12) (too-many-branches)
usertools/dpdk-devbind.py:445:0: R0915: Too many statements (61/50) (too-many-statements)
usertools/dpdk-devbind.py:540:16: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
usertools/dpdk-devbind.py:556:8: C0206: Consider iterating with .items() (consider-using-dict-items)
usertools/dpdk-devbind.py:556:17: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:582:4: W0602: Using global for 'noiommu_flag' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:586:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:596:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
usertools/dpdk-devbind.py:605:4: W0602: Using global for 'devices' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:614:17: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:622:17: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:644:18: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:644:62: W0631: Using possibly undefined loop variable 'd' (undefined-loop-variable)
usertools/dpdk-devbind.py:645:8: C0206: Consider iterating with .items() (consider-using-dict-items)
usertools/dpdk-devbind.py:645:17: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:665:10: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:672:31: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:677:31: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:683:0: C0116: Missing function or method docstring (missing-function-docstring)
usertools/dpdk-devbind.py:684:4: W0602: Using global for 'dpdk_drivers' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:690:4: C0206: Consider iterating with .items() (consider-using-dict-items)
usertools/dpdk-devbind.py:690:13: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
usertools/dpdk-devbind.py:704:14: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:712:24: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:718:24: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:722:24: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
usertools/dpdk-devbind.py:731:7: E0606: Possibly using variable 'status_dev' before assignment (possibly-used-before-assignment)
usertools/dpdk-devbind.py:777:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:778:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:779:4: W0601: Global variable 'status_dev' undefined at the module level (global-variable-undefined)
usertools/dpdk-devbind.py:780:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:781:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:782:4: W0603: Using the global statement (global-statement)
usertools/dpdk-devbind.py:887:4: W0602: Using global for 'b_flag' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:888:4: W0602: Using global for 'status_flag' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:889:4: W0602: Using global for 'force_flag' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:890:4: W0602: Using global for 'args' but no assignment is done (global-variable-not-assigned)
usertools/dpdk-devbind.py:916:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)

------------------------------------------------------------------
Your code has been rated at 7.69/10 (previous run: 7.69/10, +0.00)


  parent reply	other threads:[~2024-11-06  3:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 10:07 [PATCH v1 1/2] net/macb: add new driver liwencheng
2024-11-01 10:07 ` [PATCH v1 2/2] /usertools/dpdk-devbind:add the binding and unbinding of platform device liwencheng
2024-11-05  8:43   ` [PATCH v2 3/3] usertools/dpdk-devbind: add platform device bind/unbind liwencheng
2024-11-06  3:34     ` [PATCH v2 3/3] usertools/dpdk-devbind: add bind/unbind for platform device liwencheng
2024-11-06  3:55   ` Stephen Hemminger [this message]
2024-11-01 16:13 ` [PATCH v1 1/2] net/macb: add new driver Stephen Hemminger
2024-11-01 17:42 ` Stephen Hemminger
2024-11-02  5:43 ` Stephen Hemminger
2024-11-05  8:41 ` [PATCH v2 1/3] " liwencheng
2024-11-05  8:41   ` [PATCH v2 2/3] net/macb: add NEON vectorized Rx/Tx liwencheng
2024-11-06  3:33     ` liwencheng
2024-11-06  3:32   ` [PATCH v2 1/3] net/macb: add new driver liwencheng

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=20241105195545.20c0327c@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=liwencheng@phytium.com.cn \
    /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).