{"action":"created","comment":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/comments/61175017","id":61175017,"diff_hunk":"@@ -33,35 +34,37 @@\n \n SOL_LOG_INTERNAL_DECLARE_STATIC(_log_domain, \"gpio\");\n \n-static atomic_val_t int_flag = 0;\n-static uint32_t irq_pins;\n-\n-static struct sol_ptr_vector opened_pins = SOL_PTR_VECTOR_INIT;\n-\n-/* Zephyr structure used as a \"bank of gpio pins\" */\n-static struct device *device;\n+struct sol_gpio_port {\n+    struct device *device;\n+    struct gpio_callback cb;\n+    struct sol_ptr_vector opened_pins;\n+    uint32_t irq_pins;\n+    atomic_val_t int_flag;\n+};\n \n struct sol_gpio {\n     uint32_t pin;\n-    bool active_low;\n+    struct sol_gpio_port *port;\n     void (*cb)(void *data, struct sol_gpio *gpio, bool value);\n     const void *cb_data;\n+    bool active_low;\n };\n \n static void\n sol_gpio_interrupt_process(void *data)\n {\n+    struct sol_gpio_port *port = data;\n     struct sol_gpio *g;\n     uint32_t irq;\n     uint16_t i;\n \n-    if (!atomic_cas(&int_flag, 1, 0))\n+    if (!atomic_cas(&port->int_flag, 1, 0))\n         return;\n \n-    irq = irq_pins;\n-    irq_pins = 0;\n+    irq = port->irq_pins;\n+    port->irq_pins = 0;\n \n-    SOL_PTR_VECTOR_FOREACH_IDX (&opened_pins, g, i) {\n+    SOL_PTR_VECTOR_FOREACH_IDX (&port->opened_pins, g, i) {\n         if (irq & (1U << g->pin)) {","path":"src/lib/io/sol-gpio-impl-zephyr.c","position":55,"original_position":55,"commit_id":"33f40120fe04c2542e68fd91c765c946465589d9","original_commit_id":"33f40120fe04c2542e68fd91c765c946465589d9","user":{"login":"ibriano","id":3288272,"avatar_url":"https://avatars.githubusercontent.com/u/3288272?v=3","gravatar_id":"","url":"https://api.github.com/users/ibriano","html_url":"https://github.com/ibriano","followers_url":"https://api.github.com/users/ibriano/followers","following_url":"https://api.github.com/users/ibriano/following{/other_user}","gists_url":"https://api.github.com/users/ibriano/gists{/gist_id}","starred_url":"https://api.github.com/users/ibriano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibriano/subscriptions","organizations_url":"https://api.github.com/users/ibriano/orgs","repos_url":"https://api.github.com/users/ibriano/repos","events_url":"https://api.github.com/users/ibriano/events{/privacy}","received_events_url":"https://api.github.com/users/ibriano/received_events","type":"User","site_admin":false},"body":"On Tue, 26 Apr 2016 15:15:43 -0700, Gustavo Lima Chaves wrote:\n> >  \n> > -    SOL_PTR_VECTOR_FOREACH_IDX (&opened_pins, g, i) {\n> > +    SOL_PTR_VECTOR_FOREACH_IDX (&port->opened_pins, g, i) {\n> >          if (irq & (1U << g->pin)) {\n> \n> You could use ``BIT()`` on those as well.\n\nUgh, that was already like that and I didn't notice it.\n","created_at":"2016-04-26T22:20:47Z","updated_at":"2016-04-26T22:20:47Z","html_url":"https://github.com/solettaproject/soletta/pull/1936#discussion_r61175017","pull_request_url":"https://api.github.com/repos/solettaproject/soletta/pulls/1936","_links":{"self":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/comments/61175017"},"html":{"href":"https://github.com/solettaproject/soletta/pull/1936#discussion_r61175017"},"pull_request":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1936"}}},"pull_request":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/1936","id":67914168,"html_url":"https://github.com/solettaproject/soletta/pull/1936","diff_url":"https://github.com/solettaproject/soletta/pull/1936.diff","patch_url":"https://github.com/solettaproject/soletta/pull/1936.patch","issue_url":"https://api.github.com/repos/solettaproject/soletta/issues/1936","number":1936,"state":"open","locked":false,"title":"gpio: Adapt the Zephyr changes in GPIO callbacks","user":{"login":"ibriano","id":3288272,"avatar_url":"https://avatars.githubusercontent.com/u/3288272?v=3","gravatar_id":"","url":"https://api.github.com/users/ibriano","html_url":"https://github.com/ibriano","followers_url":"https://api.github.com/users/ibriano/followers","following_url":"https://api.github.com/users/ibriano/following{/other_user}","gists_url":"https://api.github.com/users/ibriano/gists{/gist_id}","starred_url":"https://api.github.com/users/ibriano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibriano/subscriptions","organizations_url":"https://api.github.com/users/ibriano/orgs","repos_url":"https://api.github.com/users/ibriano/repos","events_url":"https://api.github.com/users/ibriano/events{/privacy}","received_events_url":"https://api.github.com/users/ibriano/received_events","type":"User","site_admin":false},"body":"Zephyr now supports adding multiple callbacks to a port, so we make use\nof the new API.\nAs a bonus, change the implementation to make it ready to work with\nmore than one port, so when we have a way of knowing how many there are\n(and how to identify them), most of the code is ready for it.\n\nSigned-off-by: Iván Briano <ivan.briano@intel.com>","created_at":"2016-04-26T16:11:24Z","updated_at":"2016-04-26T22:20:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34dddda968bb14aadc4f6794850344fb0dc6ef7e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/solettaproject/soletta/pulls/1936/commits","review_comments_url":"https://api.github.com/repos/solettaproject/soletta/pulls/1936/comments","review_comment_url":"https://api.github.com/repos/solettaproject/soletta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solettaproject/soletta/issues/1936/comments","statuses_url":"https://api.github.com/repos/solettaproject/soletta/statuses/33f40120fe04c2542e68fd91c765c946465589d9","head":{"label":"ibriano:zephyr","ref":"zephyr","sha":"33f40120fe04c2542e68fd91c765c946465589d9","user":{"login":"ibriano","id":3288272,"avatar_url":"https://avatars.githubusercontent.com/u/3288272?v=3","gravatar_id":"","url":"https://api.github.com/users/ibriano","html_url":"https://github.com/ibriano","followers_url":"https://api.github.com/users/ibriano/followers","following_url":"https://api.github.com/users/ibriano/following{/other_user}","gists_url":"https://api.github.com/users/ibriano/gists{/gist_id}","starred_url":"https://api.github.com/users/ibriano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibriano/subscriptions","organizations_url":"https://api.github.com/users/ibriano/orgs","repos_url":"https://api.github.com/users/ibriano/repos","events_url":"https://api.github.com/users/ibriano/events{/privacy}","received_events_url":"https://api.github.com/users/ibriano/received_events","type":"User","site_admin":false},"repo":{"id":37601965,"name":"soletta","full_name":"ibriano/soletta","owner":{"login":"ibriano","id":3288272,"avatar_url":"https://avatars.githubusercontent.com/u/3288272?v=3","gravatar_id":"","url":"https://api.github.com/users/ibriano","html_url":"https://github.com/ibriano","followers_url":"https://api.github.com/users/ibriano/followers","following_url":"https://api.github.com/users/ibriano/following{/other_user}","gists_url":"https://api.github.com/users/ibriano/gists{/gist_id}","starred_url":"https://api.github.com/users/ibriano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibriano/subscriptions","organizations_url":"https://api.github.com/users/ibriano/orgs","repos_url":"https://api.github.com/users/ibriano/repos","events_url":"https://api.github.com/users/ibriano/events{/privacy}","received_events_url":"https://api.github.com/users/ibriano/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ibriano/soletta","description":"Soletta Project is a framework for making IoT devices.","fork":true,"url":"https://api.github.com/repos/ibriano/soletta","forks_url":"https://api.github.com/repos/ibriano/soletta/forks","keys_url":"https://api.github.com/repos/ibriano/soletta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ibriano/soletta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ibriano/soletta/teams","hooks_url":"https://api.github.com/repos/ibriano/soletta/hooks","issue_events_url":"https://api.github.com/repos/ibriano/soletta/issues/events{/number}","events_url":"https://api.github.com/repos/ibriano/soletta/events","assignees_url":"https://api.github.com/repos/ibriano/soletta/assignees{/user}","branches_url":"https://api.github.com/repos/ibriano/soletta/branches{/branch}","tags_url":"https://api.github.com/repos/ibriano/soletta/tags","blobs_url":"https://api.github.com/repos/ibriano/soletta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ibriano/soletta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ibriano/soletta/git/refs{/sha}","trees_url":"https://api.github.com/repos/ibriano/soletta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ibriano/soletta/statuses/{sha}","languages_url":"https://api.github.com/repos/ibriano/soletta/languages","stargazers_url":"https://api.github.com/repos/ibriano/soletta/stargazers","contributors_url":"https://api.github.com/repos/ibriano/soletta/contributors","subscribers_url":"https://api.github.com/repos/ibriano/soletta/subscribers","subscription_url":"https://api.github.com/repos/ibriano/soletta/subscription","commits_url":"https://api.github.com/repos/ibriano/soletta/commits{/sha}","git_commits_url":"https://api.github.com/repos/ibriano/soletta/git/commits{/sha}","comments_url":"https://api.github.com/repos/ibriano/soletta/comments{/number}","issue_comment_url":"https://api.github.com/repos/ibriano/soletta/issues/comments{/number}","contents_url":"https://api.github.com/repos/ibriano/soletta/contents/{+path}","compare_url":"https://api.github.com/repos/ibriano/soletta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ibriano/soletta/merges","archive_url":"https://api.github.com/repos/ibriano/soletta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ibriano/soletta/downloads","issues_url":"https://api.github.com/repos/ibriano/soletta/issues{/number}","pulls_url":"https://api.github.com/repos/ibriano/soletta/pulls{/number}","milestones_url":"https://api.github.com/repos/ibriano/soletta/milestones{/number}","notifications_url":"https://api.github.com/repos/ibriano/soletta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ibriano/soletta/labels{/name}","releases_url":"https://api.github.com/repos/ibriano/soletta/releases{/id}","deployments_url":"https://api.github.com/repos/ibriano/soletta/deployments","created_at":"2015-06-17T15:02:38Z","updated_at":"2016-02-17T14:41:20Z","pushed_at":"2016-04-26T16:11:22Z","git_url":"git://github.com/ibriano/soletta.git","ssh_url":"git@github.com:ibriano/soletta.git","clone_url":"https://github.com/ibriano/soletta.git","svn_url":"https://github.com/ibriano/soletta","homepage":"","size":18582,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"solettaproject:master","ref":"master","sha":"ffc3cad7836d75c9234b92aa39e57a5de2b589a3","user":{"login":"solettaproject","id":12736897,"avatar_url":"https://avatars.githubusercontent.com/u/12736897?v=3","gravatar_id":"","url":"https://api.github.com/users/solettaproject","html_url":"https://github.com/solettaproject","followers_url":"https://api.github.com/users/solettaproject/followers","following_url":"https://api.github.com/users/solettaproject/following{/other_user}","gists_url":"https://api.github.com/users/solettaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/solettaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solettaproject/subscriptions","organizations_url":"https://api.github.com/users/solettaproject/orgs","repos_url":"https://api.github.com/users/solettaproject/repos","events_url":"https://api.github.com/users/solettaproject/events{/privacy}","received_events_url":"https://api.github.com/users/solettaproject/received_events","type":"Organization","site_admin":false},"repo":{"id":37087063,"name":"soletta","full_name":"solettaproject/soletta","owner":{"login":"solettaproject","id":12736897,"avatar_url":"https://avatars.githubusercontent.com/u/12736897?v=3","gravatar_id":"","url":"https://api.github.com/users/solettaproject","html_url":"https://github.com/solettaproject","followers_url":"https://api.github.com/users/solettaproject/followers","following_url":"https://api.github.com/users/solettaproject/following{/other_user}","gists_url":"https://api.github.com/users/solettaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/solettaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solettaproject/subscriptions","organizations_url":"https://api.github.com/users/solettaproject/orgs","repos_url":"https://api.github.com/users/solettaproject/repos","events_url":"https://api.github.com/users/solettaproject/events{/privacy}","received_events_url":"https://api.github.com/users/solettaproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solettaproject/soletta","description":"Soletta Project is a framework for making IoT devices.  With Soletta Project's libraries developers can easily write software for devices that control actuators/sensors and communicate using standard technologies. It enables adding smartness even on the smallest edge devices.  ","fork":false,"url":"https://api.github.com/repos/solettaproject/soletta","forks_url":"https://api.github.com/repos/solettaproject/soletta/forks","keys_url":"https://api.github.com/repos/solettaproject/soletta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solettaproject/soletta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solettaproject/soletta/teams","hooks_url":"https://api.github.com/repos/solettaproject/soletta/hooks","issue_events_url":"https://api.github.com/repos/solettaproject/soletta/issues/events{/number}","events_url":"https://api.github.com/repos/solettaproject/soletta/events","assignees_url":"https://api.github.com/repos/solettaproject/soletta/assignees{/user}","branches_url":"https://api.github.com/repos/solettaproject/soletta/branches{/branch}","tags_url":"https://api.github.com/repos/solettaproject/soletta/tags","blobs_url":"https://api.github.com/repos/solettaproject/soletta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solettaproject/soletta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solettaproject/soletta/git/refs{/sha}","trees_url":"https://api.github.com/repos/solettaproject/soletta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solettaproject/soletta/statuses/{sha}","languages_url":"https://api.github.com/repos/solettaproject/soletta/languages","stargazers_url":"https://api.github.com/repos/solettaproject/soletta/stargazers","contributors_url":"https://api.github.com/repos/solettaproject/soletta/contributors","subscribers_url":"https://api.github.com/repos/solettaproject/soletta/subscribers","subscription_url":"https://api.github.com/repos/solettaproject/soletta/subscription","commits_url":"https://api.github.com/repos/solettaproject/soletta/commits{/sha}","git_commits_url":"https://api.github.com/repos/solettaproject/soletta/git/commits{/sha}","comments_url":"https://api.github.com/repos/solettaproject/soletta/comments{/number}","issue_comment_url":"https://api.github.com/repos/solettaproject/soletta/issues/comments{/number}","contents_url":"https://api.github.com/repos/solettaproject/soletta/contents/{+path}","compare_url":"https://api.github.com/repos/solettaproject/soletta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solettaproject/soletta/merges","archive_url":"https://api.github.com/repos/solettaproject/soletta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solettaproject/soletta/downloads","issues_url":"https://api.github.com/repos/solettaproject/soletta/issues{/number}","pulls_url":"https://api.github.com/repos/solettaproject/soletta/pulls{/number}","milestones_url":"https://api.github.com/repos/solettaproject/soletta/milestones{/number}","notifications_url":"https://api.github.com/repos/solettaproject/soletta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solettaproject/soletta/labels{/name}","releases_url":"https://api.github.com/repos/solettaproject/soletta/releases{/id}","deployments_url":"https://api.github.com/repos/solettaproject/soletta/deployments","created_at":"2015-06-08T19:13:18Z","updated_at":"2016-04-25T14:52:03Z","pushed_at":"2016-04-26T22:06:02Z","git_url":"git://github.com/solettaproject/soletta.git","ssh_url":"git@github.com:solettaproject/soletta.git","clone_url":"https://github.com/solettaproject/soletta.git","svn_url":"https://github.com/solettaproject/soletta","homepage":"http://solettaproject.org","size":25911,"stargazers_count":86,"watchers_count":86,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":178,"forks":73,"open_issues":178,"watchers":86,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1936"},"html":{"href":"https://github.com/solettaproject/soletta/pull/1936"},"issue":{"href":"https://api.github.com/repos/solettaproject/soletta/issues/1936"},"comments":{"href":"https://api.github.com/repos/solettaproject/soletta/issues/1936/comments"},"review_comments":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1936/comments"},"review_comment":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1936/commits"},"statuses":{"href":"https://api.github.com/repos/solettaproject/soletta/statuses/33f40120fe04c2542e68fd91c765c946465589d9"}}}}